diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2009-12-15 12:15:34 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2009-12-15 12:28:30 (GMT) |
commit | da918327fdaaf45774c074d911882141cf77ea7e (patch) | |
tree | 5281d2d03e7aa5f2656ea9d0a6a60b353245d384 /src/gui | |
parent | 39ca4450e0c2ca16ba253f1a3ac3ea5bdd23f290 (diff) | |
download | Qt-da918327fdaaf45774c074d911882141cf77ea7e.zip Qt-da918327fdaaf45774c074d911882141cf77ea7e.tar.gz Qt-da918327fdaaf45774c074d911882141cf77ea7e.tar.bz2 |
Fix vertical text centering on Mac OS X
Change 04d18b38 fixed the windows and ft font engines so that the height
reported in QFontMetrics is now correct, but this make vertical text
centering one off as the platform defaults is to round down rather than
up when the vertical position of the text is in the middle of a pixel.
When this was fixed in change 1de8a5b, the vertical centering broke on
Mac, since it still reported a too great font height. This patch applies
the same hack to the mac font engines to report the correct font
height.
Task-number: QTBUG-6770
Reviewed-by: joerg
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qfontengine_mac.mm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index a4e7c04..a75d70f 100644 --- a/src/gui/text/qfontengine_mac.mm +++ b/src/gui/text/qfontengine_mac.mm @@ -404,7 +404,9 @@ QFixed QCoreTextFontEngine::ascent() const } QFixed QCoreTextFontEngine::descent() const { - return QFixed::fromReal(CTFontGetDescent(ctfont)).ceil(); + // subtract a pixel to even out the historical +1 in QFontMetrics::height(). + // Fix in Qt 5. + return QFixed::fromReal(CTFontGetDescent(ctfont)).ceil() - 1; } QFixed QCoreTextFontEngine::leading() const { @@ -1406,7 +1408,9 @@ QFixed QFontEngineMac::ascent() const QFixed QFontEngineMac::descent() const { - return m_descent; + // subtract a pixel to even out the historical +1 in QFontMetrics::height(). + // Fix in Qt 5. + return m_descent - 1; } QFixed QFontEngineMac::leading() const |