PDA

View Full Version : lfEscapement problem



eggzcape
04-07-2008, 12:20 PM
im setting up a font that uses lfEscapement
i call CreateFontIndirect and wglUseFontBitmaps to create the font sisplay list, then i use
glCallLists (strlen(text), GL_UNSIGNED_BYTE, text);
to draw the text.

but the letters they come out cliped, like if there was a rectangle around with the size of the font without using the escapement.
what could be causing this?

tkx

Relic
04-08-2008, 02:56 AM
Most likely a bug in Microsoft's OpenGL32.dll which implements the wglUseFontBitmaps.
I have found other bugs in that as well, for example that it doesn't take the text metric's overhang into account for raster fonts. Doh! Try italic or bold raster fonts and you'll experience wrong spacing.
I've also seen problems with font bitmaps while ClearType font smoothing was enabled.

You could either write your own bitmap font generation code (sounds harder than it is) or use a different font library.

Reading bitmaps from Windows fonts is "rather simple". I did that before and implementing the bitmap data readout took only about 100 lines of code. Central clue is using the Win32 API function GetGlyphOutline(), the rest is matching glyph metrics to glBitmap parameters.