ProfEich
03-30-2003, 06:42 AM
Hi!
How can I get the Fontwidth in pixel of a font I created.
Here's the code where I create the font:
UINT CreateOpenGLFont(LPSTR strFontName, int height)
{
UINT fontListID = 0;
HFONT hFont;
fontListID = glGenLists(MAX_CHARS);
hFont = CreateFont( height,
0, // The WIDTH (If we leave this zero it will pick the best width depending on the height)
0,
0,
FW_BOLD,
FALSE,
FALSE,
FALSE,
ANSI_CHARSET,
OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS,
ANTIALIASED_QUALITY,
FF_DONTCARE|DEFAULT_PITCH,
strFontName);
hOldFont = (HFONT)SelectObject(g_window->hDC, hFont);
wglUseFontBitmaps(g_window->hDC, 0, MAX_CHARS - 1, fontListID);
return fontListID;
}
How can I get the font width?
How can I get the Fontwidth in pixel of a font I created.
Here's the code where I create the font:
UINT CreateOpenGLFont(LPSTR strFontName, int height)
{
UINT fontListID = 0;
HFONT hFont;
fontListID = glGenLists(MAX_CHARS);
hFont = CreateFont( height,
0, // The WIDTH (If we leave this zero it will pick the best width depending on the height)
0,
0,
FW_BOLD,
FALSE,
FALSE,
FALSE,
ANSI_CHARSET,
OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS,
ANTIALIASED_QUALITY,
FF_DONTCARE|DEFAULT_PITCH,
strFontName);
hOldFont = (HFONT)SelectObject(g_window->hDC, hFont);
wglUseFontBitmaps(g_window->hDC, 0, MAX_CHARS - 1, fontListID);
return fontListID;
}
How can I get the font width?