summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@nokia.com>2010-04-27 13:53:13 (GMT)
committerTor Arne Vestbø <tor.arne.vestbo@nokia.com>2010-04-27 14:05:06 (GMT)
commit346b680ab51776e6660df635b0921637f727cc75 (patch)
tree0c8d206967b87f1c9a0f15490dd031f3676d2989 /src/gui
parent939fdb8f03b998996e532cb89c8e522565c1aecc (diff)
downloadQt-346b680ab51776e6660df635b0921637f727cc75.zip
Qt-346b680ab51776e6660df635b0921637f727cc75.tar.gz
Qt-346b680ab51776e6660df635b0921637f727cc75.tar.bz2
Fix crash when CoreText fails to shape text for us
As a fallback we assume one glyph per character and manually build a list of invalid glyphs with zero advance. Reviewed-and-inspired-by: Simon Hausmann
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qfontengine_mac.mm15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index 0bfdbc0..a6510cb 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -226,8 +226,19 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
QFixed *outAdvances_y = glyphs->advances_y;
glyph_t *initialGlyph = outGlyphs;
- if (arraySize == 0)
- return false;
+ if (arraySize == 0) {
+ // CoreText failed to shape the text we gave it, so we assume one glyph
+ // per character and build a list of invalid glyphs with zero advance
+ *nglyphs = len;
+ for (int i = 0; i < len; ++i) {
+ outGlyphs[i] = 0;
+ logClusters[i] = i;
+ outAdvances_x[i] = QFixed();
+ outAdvances_y[i] = QFixed();
+ outAttributes[i].clusterStart = true;
+ }
+ return true;
+ }
const bool rtl = (CTRunGetStatus(static_cast<CTRunRef>(CFArrayGetValueAtIndex(array, 0))) & kCTRunStatusRightToLeft);