diff options
Diffstat (limited to 'src/gui/text/qfontengine_p.h')
-rw-r--r-- | src/gui/text/qfontengine_p.h | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 6289afa9d0..af44eeab3f 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -29,13 +29,6 @@ class QFontEngineGlyphCache; struct QGlyphLayout; -#define MAKE_TAG(ch1, ch2, ch3, ch4) (\ - (((quint32)(ch1)) << 24) | \ - (((quint32)(ch2)) << 16) | \ - (((quint32)(ch3)) << 8) | \ - ((quint32)(ch4)) \ - ) - // ### this only used in getPointInOutline(), refactor it and then remove these magic numbers enum HB_Compat_Error { Err_Ok = 0x0000, @@ -127,11 +120,13 @@ public: virtual bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; struct FaceId { - FaceId() : index(0), encoding(0) {} + FaceId() : index(0), instanceIndex(-1), encoding(0) {} QByteArray filename; QByteArray uuid; int index; + int instanceIndex; int encoding; + QMap<QFont::Tag, float> variableAxes; }; virtual FaceId faceId() const { return FaceId(); } enum SynthesizedFlags { @@ -147,11 +142,13 @@ public: virtual bool supportsHorizontalSubPixelPositions() const { return false; } virtual bool supportsVerticalSubPixelPositions() const { return false; } virtual QFixedPoint subPixelPositionFor(const QFixedPoint &position) const; - QFixed subPixelPositionForX(const QFixed &x) const + QFixed subPixelPositionForX(QFixed x) const { return subPixelPositionFor(QFixedPoint(x, 0)).x; } + bool isColorFont() const { return glyphFormat == Format_ARGB; } + virtual QFixed emSquareSize() const { return ascent(); } /* returns 0 as glyph index for non existent glyphs */ @@ -189,7 +186,7 @@ public: virtual void removeGlyphFromCache(glyph_t); - virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) = 0; + virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); virtual glyph_metrics_t boundingBox(glyph_t glyph) = 0; virtual glyph_metrics_t boundingBox(glyph_t glyph, const QTransform &matrix); glyph_metrics_t tightBoundingBox(const QGlyphLayout &glyphs); @@ -277,8 +274,8 @@ public: explicit Holder(void *p, qt_destroy_func_t d) : ptr(p), destroy_func(d) {} ~Holder() { if (ptr && destroy_func) destroy_func(ptr); } Holder(Holder &&other) noexcept - : ptr(qExchange(other.ptr, nullptr)), - destroy_func(qExchange(other.destroy_func, nullptr)) + : ptr(std::exchange(other.ptr, nullptr)), + destroy_func(std::exchange(other.destroy_func, nullptr)) { } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(Holder) @@ -332,6 +329,7 @@ public: protected: explicit QFontEngine(Type type); + QFixed firstLeftBearing(const QGlyphLayout &glyphs); QFixed lastRightBearing(const QGlyphLayout &glyphs); QFixed calculatedCapHeight() const; @@ -369,13 +367,18 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFontEngine::ShaperFlags) inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId &f2) { - return f1.index == f2.index && f1.encoding == f2.encoding && f1.filename == f2.filename && f1.uuid == f2.uuid; + return f1.index == f2.index + && f1.encoding == f2.encoding + && f1.filename == f2.filename + && f1.uuid == f2.uuid + && f1.instanceIndex == f2.instanceIndex + && f1.variableAxes == f2.variableAxes; } inline size_t qHash(const QFontEngine::FaceId &f, size_t seed = 0) noexcept(noexcept(qHash(f.filename))) { - return qHashMulti(seed, f.filename, f.uuid, f.index, f.encoding); + return qHashMulti(seed, f.filename, f.uuid, f.index, f.instanceIndex, f.encoding, f.variableAxes.keys(), f.variableAxes.values()); } |