Priority: P2: Important
Affects Version/s: 4.7.3, 5.3.0, 5.3.1, 5.3.2
Environment:Windows 7 x64
All Windows Platforms
Commits:6a3f8cbc3ad47d8585aac25d3775ed2350afe20c (qt/qtbase/dev) 9e278ec1f570fb7150cf0053727fe45d187a6bab (qt/qtbase/6.0) 99d3a65cf373bd563710ff91d9922845befa47a2 (qt/tqtc-qtbase/tqtc/lts-5.15)
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.
|For Gerrit Dashboard: QTBUG-20900|
|329582,2||Use design metrics when adding text to QPainterPath||6.0||qt/qtbase||Status: MERGED||+2||0|
|329620,2||Use design metrics when adding text to QPainterPath||dev||qt/qtbase||Status: MERGED||+2||0|
|329676,2||Use design metrics when adding text to QPainterPath||tqtc/lts-5.15||qt/tqtc-qtbase||Status: MERGED||+2||0|