Adapt font engines for Windows/QPA.
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>
Wed, 29 Jun 2011 09:19:17 +0000 (11:19 +0200)
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>
Wed, 29 Jun 2011 09:19:17 +0000 (11:19 +0200)
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>
src/gui/painting/qpaintengine_raster.cpp
src/gui/text/qfontengine.cpp
src/gui/text/qfontengine_p.h
src/gui/text/qtextengine_p.h

index e9a3b7a..c93cb88 100644 (file)
@@ -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;
index dec0982..f068f39 100644 (file)
@@ -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
index eee2bb6..6ae410c 100644 (file)
@@ -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;
index 25ab1e4..62a2e29 100644 (file)
@@ -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) {}