QDistanceField: a zero glyph index means the glyph was not found

In qt_fontHasNarrowOutlines, if we proceed to call alphaMapForGlyph
when the glyph does not exist, there will be a failed assertion.
The docs for FT_Get_Char_Index say that zero means the glyph was
not found.

Change-Id: I371e9a2797a34fa3ebeae44531af51e24dadad79
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Shawn Rutledge 2014-11-19 12:00:18 +01:00 committed by Konstantin Ritt
parent 0e0464c50d
commit 23517bfc35

View File

@ -751,7 +751,7 @@ bool qt_fontHasNarrowOutlines(const QRawFont &f)
return false;
QVector<quint32> glyphIndices = font.glyphIndexesForString(QLatin1String("O"));
if (glyphIndices.size() < 1)
if (glyphIndices.isEmpty() || glyphIndices[0] == 0)
return false;
return imageHasNarrowOutlines(font.alphaMapForGlyph(glyphIndices.at(0),