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>
This commit is contained in:
Jiang Jiang 2011-10-10 17:43:59 +02:00 committed by Qt by Nokia
parent 93c8522dc3
commit 612ac2b8c8

View File

@ -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;