Hey Pedro, Was there supposed to be an attachment on your last message? I didn't see one.
Regards, John Klehm
On 2/8/07, Pedro Araujo Chaves Jr. inckie@gmail.com wrote:
Attached is my proposed patch for Bug #50; the test case was attached in my previous message. -- Patch description:
This patch fixes Wine's Bug #50: "PrgWin95: Text justification needs beefing up".
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 1925-1929 added).
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.
-- Regards, Pedro Araújo.