gdiplus: add support for string alignment to GdipDrawString (try 2)

Vincent Povirk madewokherd+8cd9 at gmail.com
Tue Jun 2 11:30:27 CDT 2009


>>Maybe, but builtin gdiplus has its own world transform and doesn't use
>>the gdi32 one. That's what transform_and_round_points is for.
>
> True but you're still using the GDI32 DrawText to actually render the text. transform_and_round_points is only doing what it says, transforming the coordinates. If you rotate the text by 90 degrees, DrawText is still going to have to be aware that the text is to be rotated 90 degrees to draw it correctly or else you'll get your text at the right position, but the text direction will be wrong. Unless I'm overlooking something?

I don't really understand how this works, but it looks to me like
GdipDrawString is using the world transform to decide on an angle and
altering the font based on the angle, then sending the upper-left
corner to DrawTextW. That's theoretically enough information for left
alignment, but I'm not sure whether it works properly. For centered
text, you also give it the X coordinate of the upper-right corner, but
with text rotated 90 degrees this will be the same as the X coordinate
of the upper-left corner.

>>> Ok question then, how do I separate this into two patches? Never done
>>anything with patches like this before so this is a first for me.
>>
>>Just make two commits in Git, and format-patch will create two patch files.
>>
>
> That makes sense but, one question there. Does this mean I'm going to have to restore the file to it's original state, then add the one change, commit, add the other change, then commit again? With a change of this size, that isn't that big a deal. But on larger changes I could see that being a bit problematic. But maybe I'm just not used to it. =)

In this case, yes, it'll probably be easiest if you do it that way.

In general, there are tools you can use to make it easier:
* You can use git commit with the -a switch to modify the last commit.
* git rebase -i origin/master will give you a list of the new commits,
which it would normally apply in sequence on top of origin/master. You
can then edit the list, having it apply the commits in a different
order or stop at certain times in the process to let you add or modify
commits.
* git reset will move your current branch without changing your
working directory. You can then redo commit(s) differently.
* git add -p will let you interactively stage some changes but not
others. I don't think this will make things much easier for you
because you have one hunk that's involved in both horizontal and
vertical alignment.

Git will keep anything you commit for at least 30 days, so a backup
branch isn't strictly necessary. You can use the reflog command to
find the id's of old commits.



More information about the wine-devel mailing list