summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextlayout.cpp
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-07-08 15:40:43 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2011-07-11 11:31:11 (GMT)
commit1f90ae36cff8acf581d1624bf011fe3a55c623c0 (patch)
treeb53e135f8354a026a25060dce8c3003e952ab988 /src/gui/text/qtextlayout.cpp
parentc5f3ea858679d07d753e29af87f04efadd7683e9 (diff)
downloadQt-1f90ae36cff8acf581d1624bf011fe3a55c623c0.zip
Qt-1f90ae36cff8acf581d1624bf011fe3a55c623c0.tar.gz
Qt-1f90ae36cff8acf581d1624bf011fe3a55c623c0.tar.bz2
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
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 c1bc846..2d5b453 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -2381,13 +2381,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);