diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-06-29 11:19:17 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-06-29 11:19:17 +0200 |
commit | 3ffe4283b640825ebf03e2a5506a9d846cc88b11 (patch) | |
tree | 5c1f9ecc3ee1decaccff6d819927ee38b7f8b3cc /src/gui | |
parent | 57e0c157df0c2bb24a2dfbf72e02198e080ea9e1 (diff) |
Adapt font engines for Windows/QPA.
Export QFontEngineMulti and glyph_metrics_t.
Implement alphaMapForGlyph() for the multifont-engines
which is called in the QPA code paths (similar to
boundingBox()).
Acked-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qfontengine.cpp | 37 | ||||
-rw-r--r-- | src/gui/text/qfontengine_p.h | 6 | ||||
-rw-r--r-- | src/gui/text/qtextengine_p.h | 2 |
4 files changed, 41 insertions, 6 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index e9a3b7a16c..c93cb88135 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3045,7 +3045,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte ensurePen(); ensureState(); -#if defined (Q_OS_WIN) || defined(Q_WS_MAC) +#if defined (Q_WS_WIN) || defined(Q_WS_MAC) if (!supportsTransformations(ti.fontEngine)) { QVarLengthArray<QFixedPoint> positions; diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index dec09821d3..f068f396d8 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1674,11 +1674,42 @@ bool QFontEngineMulti::canRender(const QChar *string, int len) return allExist; } -QImage QFontEngineMulti::alphaMapForGlyph(glyph_t) +/* Implement alphaMapForGlyph() which is called by Lighthouse/Windows code. + * Ideally, that code should be fixed to correctly handle QFontEngineMulti. */ + +QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph) +{ + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaMapForGlyph(stripped(glyph)); +} + +QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) +{ + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition); +} + +QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, const QTransform &t) { - Q_ASSERT(false); - return QImage(); + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaMapForGlyph(stripped(glyph), t); } +QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) +{ + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition, t); +} + +QImage QFontEngineMulti::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPosition, int margin, const QTransform &t) +{ + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaRGBMapForGlyph(stripped(glyph), subPixelPosition, margin, t); +} QT_END_NAMESPACE diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index eee2bb6bac..6ae410cada 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -393,7 +393,7 @@ private: int _size; }; -class QFontEngineMulti : public QFontEngine +class Q_GUI_EXPORT QFontEngineMulti : public QFontEngine { public: explicit QFontEngineMulti(int engineCount); @@ -416,6 +416,10 @@ public: virtual QFixed xHeight() const; virtual QFixed averageCharWidth() const; virtual QImage alphaMapForGlyph(glyph_t); + virtual QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition); + virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t); + virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t); + virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, int margin, const QTransform &t); virtual QFixed lineThickness() const; virtual QFixed underlinePosition() const; diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 25ab1e4420..62a2e292c4 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -93,7 +93,7 @@ class QAbstractTextDocumentLayout; // * negative yoff means the following stuff is drawn higher up. // the characters bounding rect is given by QRect(x,y,width,height), its advance by // xoo and yoff -struct glyph_metrics_t +struct Q_GUI_EXPORT glyph_metrics_t { inline glyph_metrics_t() : x(100000), y(100000) {} |