From 4804d42ab837a920a96b722d4afc688b596687da Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 7 Feb 2018 21:17:09 +0100 Subject: Fix ligature handling in QTextLine::cursorToX() If the script item is rtl, we need to subtract the offset inside the ligature again, as the full width of the ligature would have already been added in the loop before. Change-Id: I544ac6fa19484b35335767e1ba1befc3dfa07693 Reviewed-by: Konstantin Ritt Reviewed-by: Lars Knoll --- src/gui/text/qtextlayout.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 87f73e1e83..6e824b2ed1 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2762,6 +2762,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const glyph_start++; for (int i = glyph_end - 1; i >= glyph_start; i--) x += glyphs.effectiveAdvance(i); + x -= eng->offsetInLigature(si, pos, end, glyph_pos); } else { int start = qMax(line.from - si->position, 0); int glyph_start = logClusters[start]; @@ -2770,8 +2771,8 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const glyph_end--; for (int i = glyph_start; i <= glyph_end; i++) x += glyphs.effectiveAdvance(i); + x += eng->offsetInLigature(si, pos, end, glyph_pos); } - x += eng->offsetInLigature(si, pos, end, glyph_pos); } if (eng->option.wrapMode() != QTextOption::NoWrap && x > line.x + line.width) -- cgit v1.2.3