http://bugs.winehq.org/show_bug.cgi?id=50
------- Additional Comments From keithdunwoody@yahoo.com 2006-28-03 19:01 ------- Hi,
I'm not sure I'll really have time/motivation to work on this; I'll explain what the problem is, and hopefully someone else can put together a better patch.
Basically, the problem is that Wine's current text justification code takes the amount of space to be added, and adds a fixed number of extra pixels of space between each word, and then puts any extra space which doesn't divide evenly at the end. This extra space at the end can be up to (number of spaces - 1) pixels, which causes long lines to appear jagged.
What my patch does conceptually is it calculates the target number of pixels per space (which won't be an integer). It then adds the floor of the number of pixels per space (same as at the moment), but it also keeps track of the fractional number of pixels which should have been added, but havn't. Once an entire extra pixel should have been added, it adds an extra pixel to the next space, and subtracts one from the accumulated fractional pixels.
Now, the real patch tries to use fixed-point arithmatic to avoid using floats; however I might have messed up my fixed-point code. Visually it looks right, but my patch might not quite match the above description. The reasons why I was using fixed point over floating is mainly for efficiency, and because I needed to replace a couple of ints in the hdc structure with my new variables, so I wanted to make my new variables ints. This connects with why you can't break up the patch -- this is the minimal set of changes which implements my solution; any breaking-up of the patch would require totally breaking text justification somewhere in the middle, and then fixing it again.
-- keith