Jump to content
  • Advertisement
Sign in to follow this  
browny

Calculating Text width in pixel using D3DXFont

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

How do i calculate the exact width and height of the text to be rendered by D3DXFont::DrawText() I think i need to use the D3DXFont::GetGlyphData() but not sure how

Share this post


Link to post
Share on other sites
Advertisement
From the DX docs for ID3DXFont::DrawText:
Quote:

Format
[in] Specifies the method of formatting the text. It can be any combination of the following values:
...
DT_CALCRECT
Determines the width and height of the rectangle. If there are multiple lines of text, ID3DXFont::DrawText uses the width of the rectangle pointed to by the pRect parameter and extends the base of the rectangle to bound the last line of text. If there is only one line of text, ID3DXFont::DrawText modifies the right side of the rectangle so that it bounds the last character in the line. In either case, ID3DXFont::DrawText returns the height of the formatted text but does not draw the text.

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!