nanogui: Load TRUETYPE font problem !!
Subject:
Load TRUETYPE font problem !!
From:
"Hiep Nguyen" ####@####.####
Date:
17 Mar 2004 17:55:30 +0000
Message-Id: <002501c40c51$648e2ce0$eb01a8c0@hoahiep>
hello !!
i read some topic about the load font problems. anh this is my code
/********************************************************************/
PLOGFONT init_title_logfont(char* fontname, int height)
{
if(vpfont!=0) return vpfont;
vpfont = (PLOGFONT) malloc(sizeof(LOGFONT));
vpfont->lfHeight = height;
vpfont->lfWidth = 0;
vpfont->lfEscapement = 0;
vpfont->lfOrientation = 0;
vpfont->lfWeight = 700;//chu in dam
vpfont->lfItalic = 0;
vpfont->lfUnderline = 1;
vpfont->lfStrikeOut = 0;
vpfont->lfCharSet = 0; //DEFAULT_CHATSET;
vpfont->lfOutPrecision = 0;
vpfont->lfClipPrecision = 0;
vpfont->lfQuality = 0;
vpfont->lfPitchAndFamily= 0;
//vpfont->lfFaceName = fontname;
strcpy(vpfont->lfFaceName, fontname);
return vpfont;
}
void DrawWindowTitle (HDC hdc, PLOGFONT plogfont, const char *title)
{
RECT rcClient;
rcClient.left = 0;
rcClient.top = 0;
rcClient.right = PNL_WIDTH;
rcClient.bottom = PNL_HEIGHT;
HFONT hFont = CreateFontIndirect(plogfont);
SelectObject(hdc, hFont);
SetTextColor(hdc,GetSysColor(COLOR_WINDOWTEXT));
SetBkMode(hdc,TRANSPARENT);
DrawText(hdc, title, -1, &rcClient, DT_VCENTER | DT_SINGLELINE);
DeleteObject(hFont);
DeleteObject(SelectObject(hdc, GetStockObject(SYSTEM_FONT)));
}
/--------------------------------------------------------------------------------------------------------/
DrawWindowTitle(hdc, init_title_logfont("Arial.ttf", 24), PANEL_NAME);
/***********************************************************************************************/
and i copy Arial*.ttf files the same directory width the executed file. but the microwindown can't load font.
Could you show me the my misstake?
Thank You !!!