aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util/qquickglobal.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2016-03-02 16:37:40 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2016-03-15 08:54:16 +0000
commit17d435fd8b2ed3a8ac6f93d17d0e78cd61bd7851 (patch)
tree545828632c0ed5bed996a338ee2291ee85b668a1 /src/quick/util/qquickglobal.cpp
parentfe7c2cbab3a8967b7f19f2aae8f5152ab23bf43d (diff)
Add property for setting hinting preference on fonts
As screen density is rapidly increasing and user interfaces are moving more and more towards using unhinted text as default, we have to make it possible to select the hint level from Qt Quick as well. While this is already partially covered by the unhinted QtRendering render type, it is still interesting to be able to tweak the native rendering accordingly, since this is a more precise rasterization. QtRendering also doesn't support medium hinting. [ChangeLog][Text] Added "hintingPreference" property to Text, TextEdit and TextInput. Change-Id: Ib99dbea24aba082481629deddde88c04cdeb8cdb Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/quick/util/qquickglobal.cpp')
-rw-r--r--src/quick/util/qquickglobal.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp
index ef54917434..4ad6fdd854 100644
--- a/src/quick/util/qquickglobal.cpp
+++ b/src/quick/util/qquickglobal.cpp
@@ -301,6 +301,7 @@ public:
QV4::ScopedValue vundl(scope, obj->get((s = v4->newString(QStringLiteral("underline")))));
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")))));
// pull out the values, set ok to true if at least one valid field is given.
if (vbold->isBoolean()) {
@@ -351,6 +352,10 @@ public:
retn.setWordSpacing(vwspac->asDouble());
if (ok) *ok = true;
}
+ if (vhint->isInt32()) {
+ retn.setHintingPreference(static_cast<QFont::HintingPreference>(vhint->integerValue()));
+ if (ok) *ok = true;
+ }
return retn;
}