Allows fonts to be loaded by name or URL. More...

Import Statement: import QtQuick 2.11


Detailed Description

The FontLoader type is used to load fonts by name or URL.

The status indicates when the font has been loaded, which is useful for fonts loaded from remote sources.

For example:

import QtQuick 2.0

Column {
    FontLoader { id: fixedFont; name: "Courier" }
    FontLoader { id: webFont; source: "" }

    Text { text: "Fixed-size font"; }
    Text { text: "Fancy font"; }

See also Qt Quick Examples - Text Fonts.

Property Documentation

name : string

This property holds the name of the font family. It is set automatically when a font is loaded using the source property.

Use this to set the property of a Text item.


Item {
    width: 200; height: 50

    FontLoader {
        id: webFont
        source: ""
    Text {
        text: "Fancy font"

source : url

The URL of the font to load.

status : enumeration

This property holds the status of font loading. It can be one of:

  • FontLoader.Null - no font has been set
  • FontLoader.Ready - the font has been loaded
  • FontLoader.Loading - the font is currently being loaded
  • FontLoader.Error - an error occurred while loading the font

Use this status to provide an update or respond to the status change in some way. For example, you could:

  • Trigger a state change:
    State { name: 'loaded'; when: loader.status == FontLoader.Ready }
  • Implement an onStatusChanged signal handler:
    FontLoader {
        id: loader
        onStatusChanged: if (loader.status == FontLoader.Ready) console.log('Loaded')
  • Bind to the status value:
    Text { text: loader.status == FontLoader.Ready ? 'Loaded' : 'Not loaded' }

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