On Mon, 2009-06-01 at 13:03 -0400, Stephan Rose wrote: > >I don't know why gdiplus does its own linebreaks. I haven't really > >done any work in that area. > > > >If I had to guess, I'd say it's because StringFormatFlagsNoWrap has no > >equivalent flag for DrawText. That probably means you can't pass it > >off to DrawText. > > > >Since they'll probably have to be done differently, it's best to > >implement one direction at a time. When you're happy with horizontal > >alignment, you can send a patch for that regardless of the status of > >vertical alignment. > > > >You should be able to use GdipMeasureString to get the size of the > >text. In fact, the alignments will need to be implemented there too, > >and it may be better to start there. > > Hmm the only way I can see alignments having any influence on MeasureString > would be if the boundingBox of the text is to be aligned to the layoutRect > based on the alignment flags. Should just be able to then take the calculated > bounding rect and align that to the layout based on the flags. > > And you're right, if I use MeasureString I solve my issue where I don't know > the height of the text ahead of time. Perfect.]
My initial implementation for the string alignment stuff seems to be working. Haven't done anything inside MeasureString yet (that'll be next though). Here's a screenshot comparing the windows version from the bug report against my implementation. http://www.somrek.net/stringformat.png Now how do I go about creating the patch and trying to get this committed? =) Thanks, Stephan
