aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextinput.cpp
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2023-07-04 11:19:14 +0000
committerTopi Reinio <topi.reinio@qt.io>2023-07-05 10:34:11 +0000
commitb3671742acacafc92481f8468cadfd26ebf4ffbc (patch)
treeb7242a71fe436e945234bacbfe249ec24ffeaea6 /src/quick/items/qquicktextinput.cpp
parentb4bd53084873082710ee2e6d6a02409d0bf1ce71 (diff)
Doc: Fix documentation for font.features QML property
Add a link to font.features property to the 'font' QML value type reference. The property documentation is duplicated for multiple QML types; keep only a single instance in qquicktext.cpp, add snippet markers and \include the same documentation for the rest of the types. Fix code snippets to use \qml, \endqml commands. Fix \sa link to QFont::setFeature(). Pick-to: 6.6 Change-Id: Ieafd7691ab859a3ae509080e0ee24b3d00f276f9 Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io> Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Diffstat (limited to 'src/quick/items/qquicktextinput.cpp')
-rw-r--r--src/quick/items/qquicktextinput.cpp60
1 files changed, 1 insertions, 59 deletions
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 9d846981d2..0a63a21add 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -380,65 +380,7 @@ QString QQuickTextInputPrivate::realText() const
\qmlproperty object QtQuick::TextInput::font.features
\since 6.6
- Applies integer values to specific OpenType features when shaping the text based on the contents
- in \a features. This provides advanced access to the font shaping process, and can be used
- to support font features that are otherwise not covered in the API.
-
- The font features are represented by a map from four-letter tags to integer values. This integer
- value passed along with the tag in most cases represents a boolean value: A zero value means the
- feature is disabled, and a non-zero value means it is enabled. For certain font features,
- however, it may have other intepretations. For example, when applied to the \c salt feature, the
- value is an index that specifies the stylistic alternative to use.
-
- For example, the \c frac font feature will convert diagonal fractions separated with a slash
- (such as \c 1/2) with a different representation. Typically this will involve baking the full
- fraction into a single character width (such as \c ½).
-
- If a font supports the \c frac feature, then it can be enabled in the shaper as in the following
- code:
-
- {code}
- TextInput {
- text: "One divided by two is 1/2"
- font.family: "MyFractionFont"
- font.features: { "frac": 1 }
- }
- {code}
-
- Multiple features can be assigned values in the same mapping. For instance, if we would like
- to also disable kerning for the font, we can explicitly disable this as follows:
-
- {code}
- TextInput {
- text: "One divided by two is 1/2"
- font.family: "MyFractionFont"
- font.features: { "frac": 1, "kern": 0 }
- }
- {code}
-
- You can also collect the font properties in an object:
-
- {code}
- TextInput {
- text: "One divided by two is 1/2"
- font: {
- family: "MyFractionFont"
- features: { "frac": 1, "kern": 0 }
- }
- }
- {code}
-
- \note By default, Qt will enable and disable certain font features based on other font
- properties. In particular, the \c kern feature will be enabled/disabled depending on the
- \l font.kerning property of the QFont. In addition, all ligature features (\c liga, \c clig,
- \c dlig, \c hlig) will be disabled if a \l font.letterSpacing is set, but only for writing
- systems where the use of ligature is cosmetic. For writing systems where ligatures are required,
- the features will remain in their default state. The values set using \c font.features will
- override the default behavior. If, for instance, \c{"kern"} is set to 1, then kerning will
- always be enabled, egardless of whether the \l font.kerning property is set to false. Similarly,
- if it is set to 0, then it will always be disabled.
-
- \sa QFont::setFeatures()
+ \include qquicktext.cpp qml-font-features
*/
QFont QQuickTextInput::font() const
{