QML Basic Type: font

The most commonly used properties are:

  • string font.family
  • bool font.bold
  • bool font.italic
  • bool font.underline
  • real font.pointSize
  • int font.pixelSize

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

The following properties are also available:

  • enumeration font.weight
  • bool font.overline
  • bool font.strikeout
  • enumeration font.capitalization
  • real font.letterSpacing
  • real font.wordSpacing

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.Light25
Font.Normal50
Font.DemiBold63
Font.Bold75
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.

See also QML Basic Types.