Fast fonts

Started by
11 comments, last by KalvinB 21 years, 6 months ago
"Will build the texture for you from two True Type fonts. The program also allows you to export font width information to a file to let you import character information into your application."

Building the fonts is easy as the screenshot I posted demonstrates I''ve already accomplished.

Your app doesn''t help because the whole point of what I''m trying to do is to allow the End User to choose any font they want of any size by changing a couple variable in an ini file. Having a predrawn bitmap defeats the entire purpose. The DirectX version of my app does exactly what I''m trying to get OpenGL to do.

How do I go from the HBITMAP with the fonts drawn on it to an OpenGL surface? Besides by saving it at a bitmap and then loading it.

Ben


IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Tiberian Merchandise!!!! | GameShot ]
Advertisement
Got it. I just had to GetPixel over the part of the HDC I wanted and then convert the resulting values to bytes and put them into the data array for the texture.

This is an amazingly bad way of doing it but it works. Now for my next trick I''ll do all this off screen so you don''t see the font bitmap on load.

Ben


IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Tiberian Merchandise!!!! | GameShot ]
Glad you got your trouble figured out, Ben - here''s another way you could do that though. Instead of using GetPixel from the HDC, you could build your HDC, draw your text to it, and then use the GetBitmapBits call.

Example: In the fire screensaver I released on my page, there''s a clock mode where you see some flaming numbers flying around. To generate the bitmap font, I simply used GetBitmapBits(clockBitmap, 60*33*2, clockBitmapBits) after drawing the font to the clockBitmap HBITMAP by selecting the clockBitmap into a DC. Hope this gives you a boost in the right direction.

This topic is closed to new replies.

Advertisement