Sign in to follow this  
Telastyn

[.net] MDX Text Measure with Wordwrap?

Recommended Posts

Telastyn    3777
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
Jonas B    100
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
Talonius    643
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this