diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2009-12-08 14:07:02 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2009-12-08 14:17:21 (GMT) |
commit | 1de8a5bc428a53158028f5a71319d88538c19c54 (patch) | |
tree | b6f7253b7a29920c15d73bbbf6dbb92da96d4192 /src | |
parent | ac90a37e5bec3c5b6cdc01a836f8e562395a3863 (diff) | |
download | Qt-1de8a5bc428a53158028f5a71319d88538c19c54.zip Qt-1de8a5bc428a53158028f5a71319d88538c19c54.tar.gz Qt-1de8a5bc428a53158028f5a71319d88538c19c54.tar.bz2 |
Fix possible off-by-one inconsistency against system look and feel when
drawing vertically aligned text
When text is drawn in a font which has an odd-numbered height and it's
vertically aligned in a rectangle which has an even-numbered height
(or vice versa) we have to round the y-position, as the backend cannot
position the text in subpixels. The y-position in this case will be at
half a pixel and we can either round it up or down without increasing
the size of the error.
In Qt 4.5, the font height would be reported as one higher than what it
actually was. Therefore, in many widgets such as comboboxes, we would
appear to round the y-position down when faced with this issue. This is
apparently also what Windows does, probably because most latin fonts
have more glyphs extending into the maximum descent than the ascent.
In Qt 4.6, the font height bug was fixed, and since we use qRound() we
now round half-pixels up, thus moving all the text faced with this issue
one pixel down. This looks odd and inconsistent, both with the platform
look and feel and with older versions of Qt.
The patch reverts to the old look and feel by rounding the half pixels
down rather than up for the particular case in question.
Task-number: QTBUG-6578
Reviewed-by: Samuel
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qpainter.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 30f8c9e..66bf4f7 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -7630,7 +7630,7 @@ start_lengthVariant: // in the paint engines when drawing on floating point offsets const qreal scale = painter->transform().m22(); if (scale != 0) - yoff = qRound(yoff * scale) / scale; + yoff = -qRound(-yoff * scale) / scale; } } } |