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 <qt_sanity_bot@ovi.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
bb10
Eskil Abrahamsen Blomfeldt 2011-06-20 10:45:36 +02:00 committed by Qt Continuous Integration System
parent f562b90518
commit 18eb310d5b
1 changed files with 2 additions and 2 deletions

View File

@ -2151,7 +2151,7 @@ QList<QGlyphRun> 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<QGlyphRun> 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(),