diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index a123c147a25db3e3acf4eb2c6b1e656011570bf2..66a4a43cbae08a230ec83cb007ed5dbe95b06037 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3078,7 +3078,8 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); drawCachedGlyphs(glyphs.size(), glyphs.constData(), positions.constData(), ti.fontEngine); - } else if (matrix.type() < QTransform::TxProject) { + } else if (matrix.type() < QTransform::TxProject + && ti.fontEngine->supportsTransformation(matrix)) { bool invertible; QTransform invMat = matrix.inverted(&invertible); if (!invertible) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index e42b70427caa7288bc29481d9f8e3435f07d41ac..d950c4e45f342a1dec17c7ed2d97149c9d9ca699 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5727,17 +5727,20 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText staticText_d->needsRelayout = true; } - // If we don't have an extended paint engine, or if the painter is projected, - // we go through standard code path - if (d->extended == 0 || !d->state->matrix.isAffine()) { - staticText_d->paintText(topLeftPosition, this); - return; - } - QFontEngine *fe = staticText_d->font.d->engineForScript(QChar::Script_Common); if (fe->type() == QFontEngine::Multi) fe = static_cast<QFontEngineMulti *>(fe)->engine(0); + // If we don't have an extended paint engine, if the painter is projected, + // or if the font engine does not support the matrix, we go through standard + // code path + if (d->extended == 0 + || !d->state->matrix.isAffine() + || !fe->supportsTransformation(d->state->matrix)) { + staticText_d->paintText(topLeftPosition, this); + return; + } + bool engineRequiresPretransform = d->extended->requiresPretransformedGlyphPositions(fe, d->state->matrix); if (staticText_d->untransformedCoordinates && engineRequiresPretransform) { // The coordinates are untransformed, and the engine can't deal with that diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 5757bcad4ea398ed8f650fad62d29d5be99b6ed0..a410708cebcef11262cee83f70468200115a0b9b 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -1412,5 +1412,11 @@ void QWindowsMultiFontEngine::loadEngine(int at) // TODO: increase cost in QFontCache for the font engine loaded here } +bool QWindowsFontEngine::supportsTransformation(const QTransform &transform) const +{ + // Support all transformations for ttf files, and translations for raster fonts + return ttf || transform.type() <= QTransform::TxTranslate; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h index 2bf6ead503e10596b7f143e52e21c9515f7604a9..9e92a8fbff603beee8ea3ff3355494682074afc8 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.h +++ b/src/plugins/platforms/windows/qwindowsfontengine.h @@ -123,6 +123,7 @@ public: virtual QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform); virtual QFontEngine *cloneWithSize(qreal pixelSize) const; + virtual bool supportsTransformation(const QTransform &transform) const; #ifndef Q_CC_MINGW virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0);