From 660c34077eb97c3aa49671fe555ecca717933e0d Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 23 Aug 2016 12:25:05 +0200 Subject: 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 --- src/gui/text/qfontsubset.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp index 49638832e0..92eeaf7919 100644 --- a/src/gui/text/qfontsubset.cpp +++ b/src/gui/text/qfontsubset.cpp @@ -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; -- cgit v1.2.3