diff options
-rw-r--r-- | src/gui/text/qtextengine.cpp | 12 | ||||
-rw-r--r-- | src/gui/text/qtextengine_p.h | 1 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 4 |
3 files changed, 12 insertions, 5 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index a0e1751..a1b0cb0 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1387,6 +1387,7 @@ QTextEngine::~QTextEngine() if (!stackEngine) delete layoutData; delete specialData; + resetFontEngineCache(); } const HB_CharAttributes *QTextEngine::attributes() const @@ -1447,6 +1448,13 @@ static inline void releaseCachedFontEngine(QFontEngine *fontEngine) } } +void QTextEngine::resetFontEngineCache() +{ + releaseCachedFontEngine(feCache.prevFontEngine); + releaseCachedFontEngine(feCache.prevScaledFontEngine); + feCache.reset(); +} + void QTextEngine::invalidate() { freeMemory(); @@ -1455,9 +1463,7 @@ void QTextEngine::invalidate() if (specialData) specialData->resolvedFormatIndices.clear(); - releaseCachedFontEngine(feCache.prevFontEngine); - releaseCachedFontEngine(feCache.prevScaledFontEngine); - feCache.reset(); + resetFontEngineCache(); } void QTextEngine::clearLineData() diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 0a86886..9362022 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -629,6 +629,7 @@ public: int lineNumberForTextPosition(int pos); int positionAfterVisualMovement(int oldPos, QTextCursor::MoveOperation op); void insertionPointsForLine(int lineNum, QVector<int> &insertionPoints); + void resetFontEngineCache(); private: void setBoundary(int strPos) const; diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index c92e15b..d0c1a0e 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -375,7 +375,7 @@ QTextLayout::~QTextLayout() void QTextLayout::setFont(const QFont &font) { d->fnt = font; - d->feCache.reset(); + d->resetFontEngineCache(); } /*! @@ -515,7 +515,7 @@ void QTextLayout::setAdditionalFormats(const QList<FormatRange> &formatList) } if (d->block.docHandle()) d->block.docHandle()->documentChange(d->block.position(), d->block.length()); - d->feCache.reset(); + d->resetFontEngineCache(); } /*! |