This looks wrong to me. You're only adjusting the left coordinate, but in case of a rotation in the world transform, you'll need to adjust the top as well.
Also, I think you may still be able to use DT_CENTER and DT_RIGHT rather than measuring the string beforehand. Creating a rectangle something like the original is difficult, but DrawText probably only needs to know the top-center or top-right point to do these other alignments. So it should be able to align things properly if you give it a rectangle where all corners are the point where it anchors the text.
DrawText doesn't need the original rectangle because gdiplus does the clipping and wrapping (and it already doesn't get the original rectangle anyway).
Vincent Povirk
On Sat, Jun 6, 2009 at 2:19 PM, Stephan Rosekermos@somrek.net wrote:
Adds support for horizontal string alignment to GdipDrawString without using DT_CENTER or DT_RIGHT.
On Sun, 2009-06-07 at 19:53 -0500, Vincent Povirk wrote:
This looks wrong to me. You're only adjusting the left coordinate, but in case of a rotation in the world transform, you'll need to adjust the top as well.
Also, I think you may still be able to use DT_CENTER and DT_RIGHT rather than measuring the string beforehand. Creating a rectangle something like the original is difficult, but DrawText probably only needs to know the top-center or top-right point to do these other alignments. So it should be able to align things properly if you give it a rectangle where all corners are the point where it anchors the text.
Well it'd have to be top left and top right. Given those two, top center will be determined by DrawText on it's own when given DT_CENTER alignment.
Ok I think that I'm really going to have to do is make a rotated test app to see what happens. Only 'issue' here is that I am not even remotely setup here at home for writing / compiling any kind of native windows software. While I have a windows installation, use it like maybe once every couple weeks for some occasional gaming.
Is there any easy way for me to do this under linux? MingW I suppose?
Thanks,
Stephan
On Sun, Jun 7, 2009 at 8:27 PM, Stephan Rosekermos@somrek.net wrote:
Well it'd have to be top left and top right. Given those two, top center will be determined by DrawText on it's own when given DT_CENTER alignment.
Ok I think that I'm really going to have to do is make a rotated test app to see what happens. Only 'issue' here is that I am not even remotely setup here at home for writing / compiling any kind of native windows software. While I have a windows installation, use it like maybe once every couple weeks for some occasional gaming.
Is there any easy way for me to do this under linux? MingW I suppose?
Mingw should work. I've found sometimes that the mingw headers and libraries have been inadequate, and I've had to compile with the switches used by "make crosstest". I think they'll be good enough in this case.
Technically, you could also run the test case using native gdiplus in Wine. In that case you could use winegcc. But I think you'll want to set up mingw anyway so you can compile Wine tests for Windows.
Vincent Povirk