diff options
author | Alessandro Portale <aportale@trolltech.com> | 2009-06-03 12:31:57 (GMT) |
---|---|---|
committer | Alessandro Portale <aportale@trolltech.com> | 2009-06-03 12:31:57 (GMT) |
commit | 9db0d28080b4b08ef484e2fb767e20a2754f537d (patch) | |
tree | 4797f00cce3500b1198746536650d9736881e41b | |
parent | 9877c2b3b4b9bb8afaac9b207917ccdd866ad1d3 (diff) | |
download | Qt-9db0d28080b4b08ef484e2fb767e20a2754f537d.zip Qt-9db0d28080b4b08ef484e2fb767e20a2754f537d.tar.gz Qt-9db0d28080b4b08ef484e2fb767e20a2754f537d.tar.bz2 |
Fixed QFontEngineS60::boundingBox. It was actually returning the tight
bounding rect, before.
-rw-r--r-- | src/gui/text/qfontengine_s60.cpp | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index eec09f4..3862b36 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -197,27 +197,14 @@ QImage QFontEngineS60::alphaMapForGlyph(glyph_t glyph) glyph_metrics_t QFontEngineS60::boundingBox(const QGlyphLayout &glyphs) { - glyph_metrics_t overall; - // initialize with line height, we get the same behaviour on all platforms - overall.y = -ascent(); - overall.height = ascent() + descent() + 1; - - QFixed ymax = 0; - QFixed xmax = 0; - for (int i = 0; i < glyphs.numGlyphs; i++) { - const glyph_metrics_t glyphBounds = boundingBox_const(glyphs.glyphs[i]); - QFixed x = overall.xoff + glyphs.offsets[i].x + glyphBounds.x; - QFixed y = overall.yoff + glyphs.offsets[i].y - glyphBounds.y; - overall.x = qMin(overall.x, x); - overall.y = qMin(overall.y, y); - xmax = qMax(xmax, x + glyphBounds.width); - ymax = qMax(ymax, y + glyphBounds.height); - overall.xoff += glyphBounds.xoff; - } - overall.height = qMax(overall.height, ymax - overall.y); - overall.width = xmax - overall.x; + if (glyphs.numGlyphs == 0) + return glyph_metrics_t(); + + QFixed w = 0; + for (int i = 0; i < glyphs.numGlyphs; ++i) + w += glyphs.effectiveAdvance(i); - return overall; + return glyph_metrics_t(0, -ascent(), w, ascent()+descent()+1, w, 0); } glyph_metrics_t QFontEngineS60::boundingBox_const(glyph_t glyph) const |