• Advertisement
Sign in to follow this  

[.net] MDX Text Measure with Wordwrap?

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

I'm looking to measure the hieght of a rectangle that would be required to render a certain font with certain text, given a certain fixed width; in C# using [ideally] MDX. In non-managed, I'd use DrawText with DT_CALCRECT, but in MDX calcrect seems to be gone, and replaced with the generally more friendly Font.MeasureString(). Neither seem to have an overload for fixed width and wrapping measurement. Any suggestions or links to something I overlooked?

Share this post


Link to post
Share on other sites
Advertisement
Before I wrote my own text engine, I used GDI+ for texts. It has the functionality you need - StringFormatFlags.FitBlackBox IIRC. (You should be able to provide the Graphics object with a pointer to your surface, no unnecessary Bitmap step involved)

Share this post


Link to post
Share on other sites
I don't know about the latest releases of the MDX SDK but when I was tinkering with it a year or so ago you did have to use GDI for text manipulation and blitting.

Share this post


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

  • Advertisement