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>
This commit is contained in:
parent
57e0c157df
commit
3ffe4283b6
@ -3045,7 +3045,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
|
|||||||
ensurePen();
|
ensurePen();
|
||||||
ensureState();
|
ensureState();
|
||||||
|
|
||||||
#if defined (Q_OS_WIN) || defined(Q_WS_MAC)
|
#if defined (Q_WS_WIN) || defined(Q_WS_MAC)
|
||||||
|
|
||||||
if (!supportsTransformations(ti.fontEngine)) {
|
if (!supportsTransformations(ti.fontEngine)) {
|
||||||
QVarLengthArray<QFixedPoint> positions;
|
QVarLengthArray<QFixedPoint> positions;
|
||||||
|
@ -1674,11 +1674,42 @@ bool QFontEngineMulti::canRender(const QChar *string, int len)
|
|||||||
return allExist;
|
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)
|
||||||
{
|
{
|
||||||
Q_ASSERT(false);
|
const int which = highByte(glyph);
|
||||||
return QImage();
|
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)
|
||||||
|
{
|
||||||
|
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
|
QT_END_NAMESPACE
|
||||||
|
@ -393,7 +393,7 @@ private:
|
|||||||
int _size;
|
int _size;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QFontEngineMulti : public QFontEngine
|
class Q_GUI_EXPORT QFontEngineMulti : public QFontEngine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit QFontEngineMulti(int engineCount);
|
explicit QFontEngineMulti(int engineCount);
|
||||||
@ -416,6 +416,10 @@ public:
|
|||||||
virtual QFixed xHeight() const;
|
virtual QFixed xHeight() const;
|
||||||
virtual QFixed averageCharWidth() const;
|
virtual QFixed averageCharWidth() const;
|
||||||
virtual QImage alphaMapForGlyph(glyph_t);
|
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 lineThickness() const;
|
||||||
virtual QFixed underlinePosition() const;
|
virtual QFixed underlinePosition() const;
|
||||||
|
@ -93,7 +93,7 @@ class QAbstractTextDocumentLayout;
|
|||||||
// * negative yoff means the following stuff is drawn higher up.
|
// * 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
|
// the characters bounding rect is given by QRect(x,y,width,height), its advance by
|
||||||
// xoo and yoff
|
// xoo and yoff
|
||||||
struct glyph_metrics_t
|
struct Q_GUI_EXPORT glyph_metrics_t
|
||||||
{
|
{
|
||||||
inline glyph_metrics_t()
|
inline glyph_metrics_t()
|
||||||
: x(100000), y(100000) {}
|
: x(100000), y(100000) {}
|
||||||
|
Loading…
Reference in New Issue
Block a user