diff options
Diffstat (limited to 'src/gui/text/qfont_p.h')
-rw-r--r-- | src/gui/text/qfont_p.h | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 3596322fae..b674e71103 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -55,6 +55,7 @@ struct QFontDef QString styleName; QStringList fallBackFamilies; + QMap<QFont::Tag, float> variableAxisValues; qreal pointSize; qreal pixelSize; @@ -85,6 +86,7 @@ struct QFontDef && families == other.families && styleName == other.styleName && hintingPreference == other.hintingPreference + && variableAxisValues == other.variableAxisValues ; } inline bool operator<(const QFontDef &other) const @@ -103,6 +105,22 @@ struct QFontDef if (ignorePitch != other.ignorePitch) return ignorePitch < other.ignorePitch; if (fixedPitch != other.fixedPitch) return fixedPitch < other.fixedPitch; + if (variableAxisValues != other.variableAxisValues) { + if (variableAxisValues.size() != other.variableAxisValues.size()) + return variableAxisValues.size() < other.variableAxisValues.size(); + + { + auto it = variableAxisValues.constBegin(); + auto jt = other.variableAxisValues.constBegin(); + for (; it != variableAxisValues.constEnd(); ++it, ++jt) { + if (it.key() != jt.key()) + return jt.key() < it.key(); + if (it.value() != jt.value()) + return jt.value() < it.value(); + } + } + } + return false; } }; @@ -120,7 +138,9 @@ inline size_t qHash(const QFontDef &fd, size_t seed = 0) noexcept fd.fixedPitch, fd.families, fd.styleName, - fd.hintingPreference); + fd.hintingPreference, + fd.variableAxisValues.keys(), + fd.variableAxisValues.values()); } class QFontEngineData @@ -164,7 +184,7 @@ public: QFixed letterSpacing; QFixed wordSpacing; - QHash<quint32, quint32> features; + QHash<QFont::Tag, quint32> features; mutable QFontPrivate *scFont; QFont smallCapsFont() const { return QFont(smallCapsFontPrivate()); } @@ -179,8 +199,12 @@ public: static void detachButKeepEngineData(QFont *font); - void setFeature(quint32 tag, quint32 value); - void unsetFeature(quint32 tag); + void setFeature(QFont::Tag tag, quint32 value); + void unsetFeature(QFont::Tag tag); + + void setVariableAxis(QFont::Tag tag, float value); + void unsetVariableAxis(QFont::Tag tag); + bool hasVariableAxis(QFont::Tag tag, float value) const; private: QFontPrivate &operator=(const QFontPrivate &) { return *this; } |