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 4934 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!