PDA

View Full Version : font size



dlswimmer
07-11-2003, 10:29 AM
I am using the font outline example form NeHe's tutorial, but when I generate the font in the opengl screen, it is never big enough, no matter what size I set it to, it stays the same size. What am I doing wrong? here is some code:


Build font:
HFONT font;
base = glGenLists(256);
font = CreateFont(-20,10,0,0,FW_BOLD,FALSE,FALSE,FALSE,ANSI_CHARSET,O UT_TT_PRECIS,
CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY,
FF_DONTCARE|DEFAULT_PITCH,"Comic Sans MS");
SelectObject(*hDC,font);
wglUseFontOutlines(*hDC,0,255,base,0.0f,0.2f,WGL_F ONT_POLYGONS,gmf);

Example call for output
glCallLists(strlen(str),GL_UNSIGNED_BYTE, str);

V-man
07-12-2003, 08:20 AM
Try scaling it (glScale)

yaro_dup1
07-12-2003, 12:45 PM
Originally posted by V-man:
Try scaling it (glScale)

You cannot scale bitmap font.


Try to use this code, then if it work You modify it to wglFontOutlines:

int CreateFontBitmaps(HDC hdc, char* fontname, int height, int weight, DWORD italic)
{
int base;
HFONT font;

if ((base = glGenLists(256)) == 0) return 0;

font = CreateFont(height, 0, 0, 0, weight, italic, false, false,
ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,
FF_DONTCARE| |DEFAULT_PITCH, fontname);

SelectObject(hdc, font);
wglUseFontBitmaps(hdc, 32, 256, base);
return base;
}

[This message has been edited by glYaro (edited 07-12-2003).]

[This message has been edited by glYaro (edited 07-12-2003).]

dlswimmer
07-14-2003, 07:52 AM
thanks, the glscale worked like a charm