From 9db0d28080b4b08ef484e2fb767e20a2754f537d Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 3 Jun 2009 14:31:57 +0200 Subject: Fixed QFontEngineS60::boundingBox. It was actually returning the tight bounding rect, before. --- src/gui/text/qfontengine_s60.cpp | 27 +++++++-------------------- 1 file 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 -- cgit v0.12