Jump to content
  • Advertisement
Sign in to follow this  
utilae

D3DXFont How to set a RECT to be after the last character drawn

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

D3DXFont - How to set a RECT to be in the character position after the last character drawn by D3DXFont DrawText(). Basically I have a string, eg "Hello", which is drawn by D3DXFont DrawText(). I want to figure out a RECT.left that is immediately after the last letter in the word, so that I can draw a texture there, eg Hello*, where * is a texture. I want the height and width of this texture to match the character height and width. Anyone able to help???

Share this post


Link to post
Share on other sites
Advertisement
Use the Win32 API function GetTextExtentPoint32 to get the exact width and height of your text string. It takes a device context and uses the selected font, so you'll need to obtain a device context with the font, i.e. ID3DXFont::GetDC

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!