font QML Basic Type

a font value with the properties of QFont. The font type refers to a font value with the properties of QFont.

The most commonly used properties are:

If both pointSize and a pixelSize are specified, pixelSize will be used.

The following properties are also available:

Example:

Text { font.family: "Helvetica"; font.pointSize: 13; font.bold: true }

When integrating with C++, note that any QFont value passed into QML from C++ is automatically converted into a font value, and vice-versa.

This basic type is provided by the QtQuick import.

Font weighting is classified on a scale from 0 to 99, where a weight of 0 is ultralight, and 99 is extremely black. The following values are supported:

Font.Thin0
Font.ExtraLight12
Font.Light25
Font.Normal50
Font.Medium57
Font.DemiBold63
Font.Bold75
Font.ExtraBold81
Font.Black87

Capitalization supports the following values:

Font.MixedCaseNo capitalization change is applied.
Font.AllUppercaseAlters the text to be rendered in all uppercase type.
Font.AllLowercaseAlters the text to be rendered in all lowercase type.
Font.SmallCapsAlters the text to be rendered in small-caps type.
Font.CapitalizeAlters the text to be rendered with the first character of each word as an uppercase character.

Setting the hinting preference only has an effect when using the "NativeRendering" render type. The property supports the following values:

Font.PreferDefaultHinting - Use the default hinting level for the target platform.

Font.PreferNoHinting - If possible, render text without hinting the outlines of the glyphs.

Font.PreferVerticalHinting - If possible, render text with no horizontal hinting, but align glyphs to the pixel grid in the vertical direction.

Font.PreferFullHinting - If possible, render text with hinting in both horizontal and vertical directions.

See also QML Basic Types.

© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.