• Advertisement
Sign in to follow this  

How to measure string length in pixel

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

Hello, Is it possible to know how big a piece of text will be on screen depending of the font I'm using with unmanaged DirectX? Every article on this I've found so far are in managed code. Thanks, -Roxanne

Share this post


Link to post
Share on other sites
Advertisement
Assuming you're using Direct3D 9 and ID3DXFont to draw the text, then calling ID3DXFont::DrawText with DT_CALCRECT for the Format parameter will return the rectangle that will be used, as described in the docs for that function. If you're using something else, then some details would help.

Share this post


Link to post
Share on other sites
Yes that's what i'm using. I was looking on msdn for something like a MeasureString method or something... didnt think of looking the flags for DrawText. Thanks a lot :)

Share this post


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

  • Advertisement