Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Centering text with wglUseFontBitmaps?

This topic is 6253 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anyone know of a straightforward way to center text with bitmapped fonts (wglUseFontBitmaps)? NeHe''s Tutorial 13 demonstrates the use of bitmapped fonts, but I can''t seem to figure out how to get the width of a string. Tutorials 14 and 15 generate outlined fonts, which you can center quite easily. However, it seems bad practice to generate an outlined font just to get the metrics for the equivalent bitmapped one. Anyone have more luck on this front? Thanks, Thomas

Share this post

Link to post
Share on other sites
// find out how big in pixels the string is
SIZE sz;

This assumes that you have set the bitmapped font as the current (GDI) font for this window

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!