From 37f20ea8e64afa2d29d9fb56ac34ff405367a2b8 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 20 May 2011 10:26:54 +0200 Subject: Fix ligature offset in multi-line text Reviewed-by: Eskil (cherry picked from commit 278cf1f37945050c4a46d5acab0659f3a7546a43) Change-Id: Ice20aa38a49ea16cf56bd3705c7d400ee165a9c2 Reviewed-on: http://codereview.qt.nokia.com/195 Reviewed-by: Jiang Jiang --- src/gui/text/qtextlayout.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gui/text') diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 9e067d763f..2e2a6234ae 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2609,8 +2609,8 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const } else { bool rtl = eng->isRightToLeft(); bool visual = eng->visualCursorMovement(); + int end = qMin(lineEnd, si->position + l) - si->position; if (reverse) { - int end = qMin(lineEnd, si->position + l) - si->position; int glyph_end = end == l ? si->num_glyphs : logClusters[end]; int glyph_start = glyph_pos; if (visual && !rtl && !(lastLine && itm == (visualOrder[nItems - 1] + firstItem))) @@ -2626,7 +2626,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const for (int i = glyph_start; i <= glyph_end; i++) x += glyphs.effectiveAdvance(i); } - x += eng->offsetInLigature(si, pos, line.length, glyph_pos); + x += eng->offsetInLigature(si, pos, end, glyph_pos); } *cursorPos = pos + si->position; -- cgit v1.2.3