diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2017-06-30 10:07:29 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2017-06-30 11:01:52 +0000 |
commit | 441e0b41bf5b700cdaa3b0ba2393c487ed4b9de5 (patch) | |
tree | e30dc7a61e334f9641776a70f9efdc7822f6f8e9 /src/quick/util | |
parent | 2969c92c82e67beb592542cb34a3cbd65ed2fb16 (diff) |
Expose "kerning" property for fonts
For text where the content is known, it can be handy to be able
to disable the kerning feature in OpenType to improve performance.
[ChangeLog][Qt Quick][Text] Added "kerning" property to the font
type to support disabling kerning on text.
Task-number: QTBUG-56728
Change-Id: I2e447587a066a7e12c5d38967e0845eaad021014
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/quick/util')
-rw-r--r-- | src/quick/util/qquickglobal.cpp | 5 | ||||
-rw-r--r-- | src/quick/util/qquickvaluetypes.cpp | 10 | ||||
-rw-r--r-- | src/quick/util/qquickvaluetypes_p.h | 4 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index 1d2f3de1df..6df23cdff5 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -302,6 +302,7 @@ public: QV4::ScopedValue vweight(scope, obj->get((s = v4->newString(QStringLiteral("weight"))))); QV4::ScopedValue vwspac(scope, obj->get((s = v4->newString(QStringLiteral("wordSpacing"))))); QV4::ScopedValue vhint(scope, obj->get((s = v4->newString(QStringLiteral("hintingPreference"))))); + QV4::ScopedValue vkerning(scope, obj->get((s = v4->newString(QStringLiteral("kerning"))))); // pull out the values, set ok to true if at least one valid field is given. if (vbold->isBoolean()) { @@ -356,6 +357,10 @@ public: retn.setHintingPreference(static_cast<QFont::HintingPreference>(vhint->integerValue())); if (ok) *ok = true; } + if (vkerning->isBoolean()) { + retn.setKerning(vkerning->booleanValue()); + if (ok) *ok = true; + } return retn; } diff --git a/src/quick/util/qquickvaluetypes.cpp b/src/quick/util/qquickvaluetypes.cpp index 4d34c6d661..bc4a72b6ea 100644 --- a/src/quick/util/qquickvaluetypes.cpp +++ b/src/quick/util/qquickvaluetypes.cpp @@ -757,6 +757,16 @@ void QQuickFontValueType::setHintingPreference(QQuickFontValueType::HintingPrefe v.setHintingPreference(QFont::HintingPreference(hintingPreference)); } +bool QQuickFontValueType::kerning() const +{ + return v.kerning(); +} + +void QQuickFontValueType::setKerning(bool b) +{ + v.setKerning(b); +} + QT_END_NAMESPACE #include "moc_qquickvaluetypes_p.cpp" diff --git a/src/quick/util/qquickvaluetypes_p.h b/src/quick/util/qquickvaluetypes_p.h index 4a1598ec5c..a3f35a84ec 100644 --- a/src/quick/util/qquickvaluetypes_p.h +++ b/src/quick/util/qquickvaluetypes_p.h @@ -323,6 +323,7 @@ class QQuickFontValueType Q_PROPERTY(qreal letterSpacing READ letterSpacing WRITE setLetterSpacing FINAL) Q_PROPERTY(qreal wordSpacing READ wordSpacing WRITE setWordSpacing FINAL) Q_PROPERTY(HintingPreference hintingPreference READ hintingPreference WRITE setHintingPreference FINAL) + Q_PROPERTY(bool kerning READ kerning WRITE setKerning FINAL) public: enum FontWeight { Thin = QFont::Thin, @@ -393,6 +394,9 @@ public: HintingPreference hintingPreference() const; void setHintingPreference(HintingPreference); + + bool kerning() const; + void setKerning(bool b); }; QT_END_NAMESPACE |