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:


Text { "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.Thin 0
Font.ExtraLight 12
Font.Light 25
Font.Normal 50
Font.Medium 57
Font.DemiBold 63
Font.Bold 75
Font.ExtraBold 81
Font.Black 87

Capitalization supports the following values:

Font.MixedCase No capitalization change is applied.
Font.AllUppercase Alters the text to be rendered in all uppercase type.
Font.AllLowercase Alters the text to be rendered in all lowercase type.
Font.SmallCaps Alters the text to be rendered in small-caps type.
Font.Capitalize Alters 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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
create apps
create games
cross platform
native performance
3rd party services
game network
level editor
easiest to learn
biggest time saving
best support