[GDI32] Fix for GetTextExtentExPointW() and ExtTextOutW() - Fixes
Pedro Araujo Chaves Jr.
inckie at gmail.com
Thu Feb 8 08:45:15 CST 2007
Attached is my proposed patch for Bug #50; the test case was attached
in my previous message.
This patch fixes Wine's Bug #50: "PrgWin95: Text justification needs
What it does: first, it takes in consideration that not always the
number of extra pixels will be a multiple of the number of break
characters in a given extent of a given string that should be
justified, and so the integer division of extra by breaks in
SetTextJustification() is likely to leave a remainder (which the
latter function addresses, of course, but ExtTextOutW() seems to
overlook — that's the reason for the changes at lines 1788 (breakRem),
and 1901 and 1922 (dc->breakExtra || breakRem), which prevent some
lines from being ignored in the justification).
That fixed, if there remained any pixels indeed, their number
shouldn't be greater than dc->breakCount; then the first breakRem
break characters in that given extent are widened by one pixel (lines
GetTextExtentExPointW() is also fixed so that it now returns the
expected width of the text when it is to be justified. This has the
good side effect that TabbedTextOut() now also returns the proper
width when called after SetTextJustification(). What the patch does
here is that GetTextExtentExPointW() now calculates the extra width
only when (breakExtra || breakRem) resolves TRUE , and corrects the
extra space additions by applying them only to break characters. What
was broken before is that it always added extra space, regardless of
whether it was measuring a single character or a full string, or
whether it was a break character or not. (Lines added: 1191, 1199,
1227, 1229, 1236-1245, 1254-1268).
This patch is copyrighted by Banco do Brasil under the LGPL.
More information about the wine-patches