From 18eb310d5bcbc4193bef0a5d45c01ed10f46579e Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 20 Jun 2011 10:45:36 +0200 Subject: [PATCH] Fix bug which caused repeated characters in a QML Text We would include too much in the characters displayed, since itemEnd is actually the start of the next item and not the end of the current one. Adding a minus one removes the duplicated characters at the end of text lines. Change-Id: I1e13470548fafaa692ae58e019e9e2469a947f5e Reviewed-on: http://codereview.qt.nokia.com/495 Reviewed-by: Qt Sanity Bot Reviewed-by: Gunnar Sletta --- src/gui/text/qtextlayout.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 781dd23..f9bfcbf 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2151,7 +2151,7 @@ QList QTextLine::glyphRuns(int from, int length) const } int relativeFrom = qMax(iterator.itemStart, from) - si.position; - int relativeTo = qMin(iterator.itemEnd, from + length - 1) - si.position; + int relativeTo = qMin(iterator.itemEnd - 1, from + length - 1) - si.position; unsigned short *logClusters = eng->logClusters(&si); int glyphsStart = logClusters[relativeFrom]; @@ -2170,7 +2170,7 @@ QList QTextLine::glyphRuns(int from, int length) const pos += QPointF((glyphLayout.advances_x[i] + justification).toReal(), glyphLayout.advances_y[i].toReal()); } - } else if (relativeTo != (iterator.itemEnd - si.position) && rtl) { + } else if (relativeTo != (iterator.itemEnd - si.position - 1) && rtl) { for (int i=glyphLayout.numGlyphs - 1; i>glyphsEnd; --i) { QFixed justification = QFixed::fromFixed(glyphLayout.justifications[i].space_18d6); pos += QPointF((glyphLayout.advances_x[i] + justification).toReal(), -- 2.7.4