Fix transformed text on Mac OS X
In change 1582407fc7
, 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>
This commit is contained in:
parent
3f936e9094
commit
96f17a061a
@ -2992,7 +2992,7 @@ void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
|
||||
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) {
|
||||
@ -3291,7 +3291,7 @@ bool QRasterPaintEngine::supportsTransformations(QFontEngine *fontEngine) const
|
||||
*/
|
||||
bool QRasterPaintEngine::supportsTransformations(QFontEngine *fontEngine, const QTransform &m) const
|
||||
{
|
||||
if (m.type() >= QTransform::TxProject)
|
||||
if (fontEngine->supportsTransformations(m))
|
||||
return true;
|
||||
|
||||
return !shouldDrawCachedGlyphs(fontEngine, m);
|
||||
|
@ -268,6 +268,10 @@ QFixed QFontEngine::averageCharWidth() const
|
||||
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)
|
||||
|
@ -241,6 +241,8 @@ public:
|
||||
return canRender(utf16, utf16len);
|
||||
}
|
||||
|
||||
virtual bool supportsTransformations(const QTransform &transform) const;
|
||||
|
||||
virtual Type type() const = 0;
|
||||
|
||||
virtual int glyphCount() const;
|
||||
|
@ -600,6 +600,11 @@ QFontEngine *QCoreTextFontEngine::cloneWithSize(qreal pixelSize) 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)
|
||||
|
@ -103,6 +103,8 @@ public:
|
||||
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; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user