summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfontengine_ft.cpp5
-rw-r--r--src/gui/text/qtextformat.cpp3
-rw-r--r--src/gui/text/qtextlayout.cpp9
3 files changed, 8 insertions, 9 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 09b0475a84..6d575e0e88 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -320,8 +320,9 @@ void QFreetypeFace::release(const QFontEngine::FaceId &face_id)
cleanup();
- if (freetypeData->faces.contains(face_id))
- freetypeData->faces.take(face_id);
+ auto it = freetypeData->faces.constFind(face_id);
+ if (it != freetypeData->faces.constEnd())
+ freetypeData->faces.erase(it);
if (freetypeData->faces.isEmpty()) {
FT_Done_FreeType(freetypeData->library);
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 8adeb3e659..39fec032dc 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -3409,8 +3409,7 @@ int QTextFormatCollection::indexForFormat(const QTextFormat &format)
f.d = new QTextFormatPrivate;
f.d->resolveFont(defaultFnt);
- if (!hashes.contains(hash, idx))
- hashes.insert(hash, idx);
+ hashes.insert(hash, idx);
} QT_CATCH(...) {
formats.pop_back();
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;
}
}
}