summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextlayout.cpp
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-07-08 17:40:43 +0200
committerJiang Jiang <jiang.jiang@nokia.com>2011-07-11 13:37:20 +0200
commit0b996f435fb0da42e4f563986ef8214d542398f4 (patch)
tree074a79120d72b7a7a77962a56f5d3b5df884a610 /src/gui/text/qtextlayout.cpp
parente5e1ff0d6f4e6a8457da61b5b215730de6f960bd (diff)
Fix crash when app font is added
Loading app fonts will clear the application font cache, but QFontPrivate::engineWithScript will try to load the font again, in Mac the font engine used here must be the one used for shaping, because subsequent sub font engines may be added to it during the shaping process (QCoreTextFontEngineMulti::stringToCMap). That is why we need to fetch the font engine directly from QTextEngine's fontEngine cache instead of QFontCache. Task-number: QTBUG-20250 Reviewed-by: Eskil (cherry picked from commit 1f90ae36cff8acf581d1624bf011fe3a55c623c0)
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-rw-r--r--src/gui/text/qtextlayout.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 0fbf838495..86c6f48919 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -2319,13 +2319,13 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR
unsigned short *logClusters = eng->logClusters(&si);
QGlyphLayout glyphs = eng->shapedGlyphs(&si);
- QTextItemInt gf(si, &f, format);
- gf.glyphs = glyphs.mid(iterator.glyphsStart, iterator.glyphsEnd - iterator.glyphsStart);
- gf.chars = eng->layoutData->string.unicode() + iterator.itemStart;
+ QTextItemInt gf(glyphs.mid(iterator.glyphsStart, iterator.glyphsEnd - iterator.glyphsStart),
+ &f, eng->layoutData->string.unicode() + iterator.itemStart,
+ iterator.itemEnd - iterator.itemStart, eng->fontEngine(si), format);
gf.logClusters = logClusters + iterator.itemStart - si.position;
- gf.num_chars = iterator.itemEnd - iterator.itemStart;
gf.width = iterator.itemWidth;
gf.justified = line.justified;
+ gf.initWithScriptItem(si);
Q_ASSERT(gf.fontEngine);