summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextlayout.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2009-09-24 12:31:17 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2009-09-24 12:35:44 (GMT)
commit121349cb90d66625728fdcecc8e4f75f268b3a53 (patch)
treeab3f3b4e21a48f4c6cb5932f490f2c9fd86aea65 /src/gui/text/qtextlayout.cpp
parentbc101d83b313d9ebf7c54789077d6710d3e78cd9 (diff)
downloadQt-121349cb90d66625728fdcecc8e4f75f268b3a53.zip
Qt-121349cb90d66625728fdcecc8e4f75f268b3a53.tar.gz
Qt-121349cb90d66625728fdcecc8e4f75f268b3a53.tar.bz2
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
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-rw-r--r--src/gui/text/qtextlayout.cpp2
1 files changed, 1 insertions, 1 deletions
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)) {