Jump to content
  • Advertisement
Sign in to follow this  
Samurai Jack

Doom 3 Font Aligment Problem

This topic is 4691 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

Greetings! I have decided to go for the Doom 3 fonts, because they are very easy to handle/generate. What bothers me is the font aligment. Here is the official method: for ( const char *p=message; *p; p++ ) { glyphInfo_t &glyph = fontInfo.fontInfoSmall.glyphs[*p]; renderSystem->DrawStretchPic( x, y - glyph.top, glyph.imageWidth, glyph.imageHeight, glyph.s, glyph.t, glyph.s2, glyph.t2, glyph.glyph ); x += glyph.xSkip; } One might review it at http://www.q3acn.com/iddevnet/index_en.html . The acctual problem is the "y - glyph.top" because that is the only way, that souch fonts work. Glyph.bottom is the same as Glyph.imageHeight so it is not useful. In practice it means, if you try wo write at (x:50, y:50 "test") test will be rendered excatly above the y=50, and I do not know how to put it under the line, because each glyph (character) has its own image height and so on.

Share this post


Link to post
Share on other sites
Advertisement
This is off topic and the doom 3 is a bad engine for begineers to play with. You should have known that nothing is ever as easy as it looks in programming

Share this post


Link to post
Share on other sites
Basically, you need to know where the baseline in each character is. The baseline is where the text lines up (with the bottom part of a 'g' for example going below the baseline).

It sounds like you'll need to use 'glyph.top' and the character height to fake a baseline number.

It sounds like the height of each character is variable, so you have a few choices on how to generate a constant height: either take the maximum height or the average height. You only want to do this a single time per font, because the info shouldn't change.

Now that you have the current glyph's baseline info and the font's character height info, you just do 'y + Height - glyph.top' and you're done. If that doesn't work, try 'y + Height - 2 * glyph.top'

Unfortunately, I'm not familiar with the doom 3 font system so I can't give an absolute answer =-/

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!