diff options
author | Alessandro Portale <alessandro.portale@nokia.com> | 2010-07-27 11:55:43 (GMT) |
---|---|---|
committer | Alessandro Portale <alessandro.portale@nokia.com> | 2010-07-27 11:55:43 (GMT) |
commit | f4f10d2a2d60790939492694abf6b9578a5f048a (patch) | |
tree | 5075585f290e230a80667039d87bca52ba4f2891 | |
parent | 3695cb25e4a53921880cfea4d4c731df44fa4396 (diff) | |
download | Qt-f4f10d2a2d60790939492694abf6b9578a5f048a.zip Qt-f4f10d2a2d60790939492694abf6b9578a5f048a.tar.gz Qt-f4f10d2a2d60790939492694abf6b9578a5f048a.tar.bz2 |
Workaround for QTBUG-8013: Do not return an ascent of 0
Symbian's CFont::FontMaxAscent() returns in some cases an
incorrect value of 0. That usually happens (for some font sizes)
if a stroke based font is the main system font.
We were able to reproduce it on some S60 3.2 devices with a
chinese language pack installed.
This patch will test if CFont::FontMaxAscent() returns 0. And if
so, it alculates an ascent taht makes more sense.
Task-number: QTBUG-8013
Reviewed-by: Liang Qi
-rw-r--r-- | src/gui/text/qfontengine_s60.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 93f02ff..9073f89 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -291,7 +291,10 @@ glyph_metrics_t QFontEngineS60::boundingBox(glyph_t glyph) QFixed QFontEngineS60::ascent() const { - return m_originalFont->FontMaxAscent(); + // Workaround for QTBUG-8013 + // Stroke based fonts may return an incorrect FontMaxAscent of 0. + const QFixed ascent = m_originalFont->FontMaxAscent(); + return (ascent > 0) ? ascent : QFixed::fromReal(m_originalFontSizeInPixels) - descent(); } QFixed QFontEngineS60::descent() const |