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>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2022-11-28 13:13:41 +01:00
parent 0dcd640a1f
commit 64847a3930

View File

@ -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();