summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextlayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-rw-r--r--src/gui/text/qtextlayout.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index f5827bb683..28a5eb6a89 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1059,9 +1059,10 @@ QList<QGlyphRun> QTextLayout::glyphRuns(int from, int length) const
QGlyphRun::GlyphRunFlags flags = glyphRun.flags();
QPair<QFontEngine *, int> key(fontEngine, int(flags));
// merge the glyph runs using the same font
- if (glyphRunHash.contains(key)) {
- QGlyphRun &oldGlyphRun = glyphRunHash[key];
-
+ QGlyphRun &oldGlyphRun = glyphRunHash[key];
+ if (oldGlyphRun.isEmpty()) {
+ oldGlyphRun = glyphRun;
+ } else {
QVector<quint32> indexes = oldGlyphRun.glyphIndexes();
QVector<QPointF> positions = oldGlyphRun.positions();
QRectF boundingRect = oldGlyphRun.boundingRect();
@@ -1073,8 +1074,6 @@ QList<QGlyphRun> QTextLayout::glyphRuns(int from, int length) const
oldGlyphRun.setGlyphIndexes(indexes);
oldGlyphRun.setPositions(positions);
oldGlyphRun.setBoundingRect(boundingRect);
- } else {
- glyphRunHash[key] = glyphRun;
}
}
}