On Windows only, the spacing between characters is often incorrect when using QPainterPath::addText. In the test application below, the drawn strings should be more or less identical.
A screenshot of what this looks like on my machine is attached. Some things I have noticed:
- It is fine on X11 (Ubuntu, at least) and Mac OS X.
- It only affects certain fonts at certain sizes. If, for example, you change the font in the example to pixel size 12 or point size 11, it looks fine.
In my application I have to use a QPainterPath, and the output looks horrible on Windows because of this.
Some more information. I wrote out all the points that are being used for the outline of the "w". Note that the path is drawn such that the left-most part is at 50, and the width is a little under 8.
The problem seems to be that the "w" as drawn by addText is putting the left of the "w" at 51. There is a tiny pixel bleed that goes at x=50, but this bleed is not reflected in the path information. Thus, the "w" is shifted one pixel too far to the left on the path (or 1 pixel too far to the right on addText, one could argue.) In the screenshot below, the red line is at x=49. Notice that the first "w" (addPath) starts at 50 and is roughly 8 pixels wide. The second "w" (addText) really starts at 51 (with a pixel bleed at 50) and has a width of 10.