summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2022-11-28 13:13:41 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2022-12-05 07:55:33 +0100
commit64847a3930a1d29dfec47dc6fd084f42deeced20 (patch)
tree41dc08eddd3e7084edbd9514072ef57d0a9d27e5 /src/gui
parent0dcd640a1faa9943645ab0e15ebfdbe263058529 (diff)
Don't return empty glyph runs from QTextLine
The last (or only) QGlyphRun would be ignored if it did not contain any glyphs, but we did not have the same conditions for substrings represented by different font engines. This was an oversight and we should be consistent. Pick-to: 6.4 Task-number: QTBUG-108799 Change-Id: Idfa187f6198247d5cc94804a4e55d5de3ccd739e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qtextlayout.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index d168a77d57..6eaefc945c 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -2534,19 +2534,23 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from,
if (start == 0 && startsInsideLigature)
subFlags |= QGlyphRun::SplitLigature;
- glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which),
- eng->text,
- subLayout,
- pos,
- subFlags,
- retrievalFlags,
- x,
- width,
- glyphsStart + start,
- glyphsStart + end,
- logClusters + relativeFrom,
- relativeFrom + si.position,
- relativeTo - relativeFrom + 1));
+ {
+ QGlyphRun glyphRun = glyphRunWithInfo(multiFontEngine->engine(which),
+ eng->text,
+ subLayout,
+ pos,
+ subFlags,
+ retrievalFlags,
+ x,
+ width,
+ glyphsStart + start,
+ glyphsStart + end,
+ logClusters + relativeFrom,
+ relativeFrom + si.position,
+ relativeTo - relativeFrom + 1);
+ if (!glyphRun.isEmpty())
+ glyphRuns.append(glyphRun);
+ }
for (int i = 0; i < subLayout.numGlyphs; ++i) {
QFixed justification = QFixed::fromFixed(subLayout.justifications[i].space_18d6);
pos.rx() += (subLayout.advances[i] + justification).toReal();