CoreText: Add support for providing scaled glyphs to the glyph-cache
Useful for not having to fall back to QPainterPath drawing when using the raster engine with a retina screen (which has a 2x scale). Change-Id: I0a9f754d31b0ecd8e8daf7a01331d19716bab680 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>bb10
parent
d147285d64
commit
1161a8a629
|
|
@ -508,7 +508,15 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
|
|||
|
||||
QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition)
|
||||
{
|
||||
QImage im = imageForGlyph(glyph, subPixelPosition, false, QTransform());
|
||||
return alphaMapForGlyph(glyph, subPixelPosition, QTransform());
|
||||
}
|
||||
|
||||
QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &x)
|
||||
{
|
||||
if (x.type() > QTransform::TxScale)
|
||||
return QFontEngine::alphaMapForGlyph(glyph, subPixelPosition, x);
|
||||
|
||||
QImage im = imageForGlyph(glyph, subPixelPosition, false, x);
|
||||
|
||||
QImage indexed(im.width(), im.height(), QImage::Format_Indexed8);
|
||||
QVector<QRgb> colors(256);
|
||||
|
|
@ -602,7 +610,7 @@ QFontEngine *QCoreTextFontEngine::cloneWithSize(qreal pixelSize) const
|
|||
|
||||
bool QCoreTextFontEngine::supportsTransformation(const QTransform &transform) const
|
||||
{
|
||||
return transform.type() <= QTransform::TxTranslate;
|
||||
return transform.type() <= QTransform::TxScale;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ public:
|
|||
virtual bool getSfntTableData(uint /*tag*/, uchar * /*buffer*/, uint * /*length*/) const;
|
||||
virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics);
|
||||
virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition);
|
||||
virtual QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t);
|
||||
virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
|
||||
virtual qreal minRightBearing() const;
|
||||
virtual qreal minLeftBearing() const;
|
||||
|
|
|
|||
Loading…
Reference in New Issue