DirectWrite: Fix crash when embedding empty glyphs in PDF

Empty QPainterPaths can have one move-to element, so the test
to detect this case was incomplete. For empty glyphs returned
from DirectWrite this would trigger a crash. This is only
reproducible after also enabling embedding of fonts with the
DirectWrite engine.

Task-number: QTBUG-54740
Change-Id: I3fbbfb8d958818550d5ab5234242d39688b84811
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2016-08-23 12:25:05 +02:00
parent 95c767f5be
commit 660c34077e

View File

@ -966,7 +966,7 @@ static QTtfGlyph generateGlyph(int index, const QPainterPath &path, qreal advanc
glyph.advanceWidth = qRound(advance * 2048. / ppem);
glyph.lsb = qRound(lsb * 2048. / ppem);
if (!path.elementCount()) {
if (path.isEmpty()) {
//qDebug("glyph %d is empty", index);
lsb = 0;
glyph.xMin = glyph.xMax = glyph.yMin = glyph.yMax = 0;