diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2011-10-10 17:43:59 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-11 16:01:12 +0200 |
commit | 612ac2b8c8e0d5c67b17ad3a9a564f5a049846a6 (patch) | |
tree | 8012fab233e280a1bbc3b6db52e393dd5bb7c63b /src | |
parent | 93c8522dc3f2525bb5838dadde671b70a6ec3fe5 (diff) |
Don't crash when no usable font is available
We will fallback to box engine when no usable font is available,
and QRawFont (which scenegraph depends on) won't allocate glyph
index array on certain occasions. In those cases, QFontEngineBox
needs to support GlyphIndicesOnly flag.
Change-Id: I408ddd1b2f1a5f7ac2b6681cb7bf531bbbfc68e6
Reviewed-on: http://codereview.qt-project.org/6360
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/text/qfontengine.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index fabd8c3634..1960b1e9b2 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1197,7 +1197,7 @@ QFontEngineBox::~QFontEngineBox() { } -bool QFontEngineBox::stringToCMap(const QChar *, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags) const +bool QFontEngineBox::stringToCMap(const QChar *, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const { if (*nglyphs < len) { *nglyphs = len; @@ -1206,8 +1206,10 @@ bool QFontEngineBox::stringToCMap(const QChar *, int len, QGlyphLayout *glyphs, for (int i = 0; i < len; i++) { glyphs->glyphs[i] = 0; - glyphs->advances_x[i] = _size; - glyphs->advances_y[i] = 0; + if (!(flags & QTextEngine::GlyphIndicesOnly)) { + glyphs->advances_x[i] = _size; + glyphs->advances_y[i] = 0; + } } *nglyphs = len; |