In change
1582407fc782c0befd0760633324dd5c206524a1, the Q_WS_MAC
code path which disabled drawing cached glyphs for any transform
was removed, as was the comment that scaling and rotation wasn't
supported by the Mac font engines. This obviously broke transformed
text on Mac, so we need to put it back.
I put it into the font engine itself where it belongs, and I kept
the somewhat confusing naming convention which is used in the
paint engine to minimize this patch. I'll clean up these function
names in a future commit.
Task-number: QTBUG-27362
Change-Id: I4fc6a503eedd4b1ebaf3ee659d948f997f433338
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
ensureRasterState();
QFontEngine *fontEngine = textItem->fontEngine();
- if (shouldDrawCachedGlyphs(fontEngine, state()->matrix)) {
+ if (!supportsTransformations(fontEngine)) {
drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions,
fontEngine);
} else if (state()->matrix.type() < QTransform::TxProject) {
*/
bool QRasterPaintEngine::supportsTransformations(QFontEngine *fontEngine, const QTransform &m) const
{
- if (m.type() >= QTransform::TxProject)
+ if (fontEngine->supportsTransformations(m))
return true;
return !shouldDrawCachedGlyphs(fontEngine, m);
return bb.xoff;
}
+bool QFontEngine::supportsTransformations(const QTransform &transform) const
+{
+ return (transform.type() >= QTransform::TxProject);
+}
void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags,
QVarLengthArray<glyph_t> &glyphs_out, QVarLengthArray<QFixedPoint> &positions)
return canRender(utf16, utf16len);
}
+ virtual bool supportsTransformations(const QTransform &transform) const;
+
virtual Type type() const = 0;
virtual int glyphCount() const;
return new QCoreTextFontEngine(cgFont, newFontDef);
}
+bool QCoreTextFontEngine::supportsTransformations(const QTransform &transform) const
+{
+ return transform.type() > QTransform::TxTranslate;
+}
+
QT_END_NAMESPACE
#endif// !defined(Q_WS_MAC) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
virtual qreal minLeftBearing() const;
virtual QFixed emSquareSize() const;
+ bool supportsTransformations(const QTransform &transform) const;
+
virtual QFontEngine *cloneWithSize(qreal pixelSize) const;
virtual int glyphMargin(QFontEngineGlyphCache::Type type) { Q_UNUSED(type); return 0; }