summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2018-02-07 21:17:09 +0100
committerLars Knoll <lars.knoll@qt.io>2018-02-28 17:11:37 +0000
commit4804d42ab837a920a96b722d4afc688b596687da (patch)
tree9638261f6941fea9a69b3b2bc1035ea607e6fc61
parent5d365b96b9a9d8585a0be5cc1c2376b7b2f27101 (diff)
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 <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/gui/text/qtextlayout.cpp3
1 files changed, 2 insertions, 1 deletions
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)