diff options
author | Eskil Abrahamsen Blomfeldt <[email protected]> | 2016-03-02 16:37:40 +0100 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <[email protected]> | 2016-03-15 08:54:16 +0000 |
commit | 17d435fd8b2ed3a8ac6f93d17d0e78cd61bd7851 (patch) | |
tree | 545828632c0ed5bed996a338ee2291ee85b668a1 /src/quick/items/qquicktextedit.cpp | |
parent | fe7c2cbab3a8967b7f19f2aae8f5152ab23bf43d (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 <[email protected]>
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/quick/items/qquicktextedit.cpp')
-rw-r--r-- | src/quick/items/qquicktextedit.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index a3ceb1344c..d2b719e8ef 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -323,6 +323,39 @@ QString QQuickTextEdit::text() const */ /*! + \qmlproperty enumeration QtQuick::TextEdit::font.hintingPreference + \since 5.8 + + Sets the preferred hinting on the text. This is a hint to the underlying text rendering system + to use a certain level of hinting, and has varying support across platforms. See the table in + the documentation for QFont::HintingPreference for more details. + + \note This property only has an effect when used together with render type TextEdit.NativeRendering. + + \list + \value Font.PreferDefaultHinting - Use the default hinting level for the target platform. + \value Font.PreferNoHinting - If possible, render text without hinting the outlines + of the glyphs. The text layout will be typographically accurate, using the same metrics + as are used e.g. when printing. + \value Font.PreferVerticalHinting - If possible, render text with no horizontal hinting, + but align glyphs to the pixel grid in the vertical direction. The text will appear + crisper on displays where the density is too low to give an accurate rendering + of the glyphs. But since the horizontal metrics of the glyphs are unhinted, the text's + layout will be scalable to higher density devices (such as printers) without impacting + details such as line breaks. + \value Font.PreferFullHinting - If possible, render text with hinting in both horizontal and + vertical directions. The text will be altered to optimize legibility on the target + device, but since the metrics will depend on the target size of the text, the positions + of glyphs, line breaks, and other typographical detail will not scale, meaning that a + text layout may look different on devices with different pixel densities. + \endlist + + \qml + TextEdit { text: "Hello"; renderType: TextEdit.NativeRendering; font.hintingPreference: Font.PreferVerticalHinting } + \endqml +*/ + +/*! \qmlproperty string QtQuick::TextEdit::text The text to display. If the text format is AutoText the text edit will |