From 121349cb90d66625728fdcecc8e4f75f268b3a53 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 24 Sep 2009 14:31:17 +0200 Subject: Only account for a negative right bearing in QTextLayout We only want to expand the width of the text, never shrink it. This is so that we can account for text where the pixels of the text extend beyond the edge of the last glyph. When we shrinked the width, code that depended on the natural text width equalling the advance of the text (such as WebKit) broke, and some text items would be positioned wrongly. We now only take negative right bearings into account (right bearing is left-bound), meaning that we only expand the text width, never shrink it due to right bearing. Reviewed-by: Simon Hausmann --- src/gui/text/qtextlayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 39a8bb8..c5f0e35 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1813,7 +1813,7 @@ void QTextLine::layout_helper(int maxGlyphs) glyph_t glyph = glyphs.glyphs[logClusters[pos - 1]]; glyph_metrics_t gi = fontEngine->boundingBox(glyph); if (gi.isValid()) - lbh.rightBearing = -qRound(gi.xoff - gi.x - gi.width); + lbh.rightBearing = qMax(QFixed(), -(gi.xoff - gi.x - gi.width)); } if ((sb_or_ws|breakany) && lbh.checkFullOtherwiseExtend(line)) { -- cgit v0.12