From a2bc19c0ad67b948df624770498f76441bf6da91 Mon Sep 17 00:00:00 2001 From: Teemu Katajisto Date: Fri, 12 Oct 2012 10:58:38 +0300 Subject: Mac: fix invalid context in imageForGlyph The bounding rectangle may have negative width or height when a graphics view with text is rotated in certain angles. Make sure that the image width and height are positive, otherwise the context will be null and the following messages can be seen in test logs: : CGContextSetFontSize: invalid context 0x0 Change-Id: I10f83f6909035fb3c4ac456123cf1922eaea7c73 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index d989de0abb..d413711828 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -448,7 +448,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition br.y = QFixed::fromReal(br.y.toReal() * vscale); } - QImage im(qRound(br.width)+2, qRound(br.height)+2, QImage::Format_RGB32); + QImage im(qAbs(qRound(br.width))+2, qAbs(qRound(br.height))+2, QImage::Format_RGB32); im.fill(0); #ifndef Q_OS_IOS -- cgit v1.2.3