Beispiel #1
0
void tTVPSysFont::Assign( const tTVPFont &font ) {
	LOGFONT LogFont={0};
	LogFont.lfHeight = -std::abs(font.Height);
	LogFont.lfItalic = (font.Flags & TVP_TF_ITALIC) ? TRUE:FALSE;
	LogFont.lfWeight = (font.Flags & TVP_TF_BOLD) ? 700 : 400;
	LogFont.lfUnderline = (font.Flags & TVP_TF_UNDERLINE) ? TRUE:FALSE;
	LogFont.lfStrikeOut = (font.Flags & TVP_TF_STRIKEOUT) ? TRUE:FALSE;
	LogFont.lfEscapement = LogFont.lfOrientation = font.Angle;
	LogFont.lfCharSet = DEFAULT_CHARSET;
	LogFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
	LogFont.lfQuality = DEFAULT_QUALITY;
	LogFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
	std::wstring face = TVPFontSystem->GetBeingFont(font.Face.AsStdString());
	TJS_strncpy_s(LogFont.lfFaceName, LF_FACESIZE, face.c_str(), LF_FACESIZE -1);
	LogFont.lfFaceName[LF_FACESIZE-1] = 0;
	ApplyFont( &LogFont );
}
Beispiel #2
0
tTVPSysFont::tTVPSysFont() : hFont_(INVALID_HANDLE_VALUE), hOldFont_(INVALID_HANDLE_VALUE), hMemDC_(INVALID_HANDLE_VALUE),
	hBmp_(INVALID_HANDLE_VALUE), hOldBmp_(INVALID_HANDLE_VALUE) {

	InitializeMemDC();

	HFONT hFont = (HFONT)::GetStockObject( ANSI_FIXED_FONT );
	LOGFONT logfont={0};
	::GetObject( hFont_, sizeof(LOGFONT), &logfont );
	logfont.lfHeight = -12;
	logfont.lfWidth = 0;
	logfont.lfCharSet = DEFAULT_CHARSET;
	TJS_strncpy_s( logfont.lfFaceName, LF_FACESIZE, TVPDefaultFontName, LF_FACESIZE );
	logfont.lfItalic = FALSE;
	logfont.lfUnderline = FALSE;
	logfont.lfStrikeOut = FALSE;
	ApplyFont( &logfont );
}
Beispiel #3
0
GLvoid Print3DFont::BuildFont(GLvoid)
{
	if (true == m_usingTex)
		m_tex.LoadTexture("mingzhuta.bmp");

	m_base = glGenLists(256);

	GenFont(); //3D字体只能显示TrueType字体!
	ApplyFont();

	wglUseFontOutlines(
		m_hDC,				//设置当前窗口设备描述表的句柄
		0,					//用于创建显示列表字体的第一个字符的ASCII值
		255,				//字符数
		m_base,				//一个显示列表的名称
		0.0f,				//字体的光滑度,越小越光滑,0.0为最光滑的状态
		0.2f,				//在z方向突出的距离
		WGL_FONT_POLYGONS,	//使用多边形来生成字符,每个顶点具有独立的法线
		m_gmf);				//一个接收字形度量数据的数组的地址,每个数组元素用它对应的显示列表字符的数据填充 

	DestroyFont();
}
Beispiel #4
0
tTVPSysFont::tTVPSysFont( const tTVPFont &font ) : hFont_(INVALID_HANDLE_VALUE), hOldFont_(INVALID_HANDLE_VALUE), hMemDC_(INVALID_HANDLE_VALUE),
	hBmp_(INVALID_HANDLE_VALUE), hOldBmp_(INVALID_HANDLE_VALUE) {

	InitializeMemDC();

	HFONT hFont = (HFONT)::GetStockObject( ANSI_FIXED_FONT );
	LOGFONT LogFont={0};
	LogFont.lfHeight = -std::abs(font.Height);
	LogFont.lfItalic = (font.Flags & TVP_TF_ITALIC) ? TRUE:FALSE;
	LogFont.lfWeight = (font.Flags & TVP_TF_BOLD) ? 700 : 400;
	LogFont.lfUnderline = (font.Flags & TVP_TF_UNDERLINE) ? TRUE:FALSE;
	LogFont.lfStrikeOut = (font.Flags & TVP_TF_STRIKEOUT) ? TRUE:FALSE;
	LogFont.lfEscapement = LogFont.lfOrientation = font.Angle;
	LogFont.lfCharSet = DEFAULT_CHARSET;
	LogFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
	LogFont.lfQuality = DEFAULT_QUALITY;
	LogFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
	std::wstring face = TVPFontSystem->GetBeingFont(font.Face.AsStdString());
	TJS_strncpy_s(LogFont.lfFaceName, LF_FACESIZE, face.c_str(), LF_FACESIZE -1);
	LogFont.lfFaceName[LF_FACESIZE-1] = 0;

	ApplyFont( &LogFont );
}
Beispiel #5
0
void tTVPSysFont::Assign( const tTVPSysFont* font ) {
	LOGFONT logfont = {0};
	font->GetFont( &logfont );
	ApplyFont( &logfont );
}
Beispiel #6
0
void GDIFontRasterizer::ApplyFont( tTVPNativeBaseBitmap *bmp, bool force ) {
	if( bmp != LastBitmap || force ) {
		ApplyFont( bmp->GetFont() );
		LastBitmap = bmp;
	}
}