[Qt-qml] FontLoader memory consumption

Cornelius Hald hald at icandy.de
Fri Oct 22 11:44:13 CEST 2010


Hi,

I want to include custom fonts within my QML application. Currently I'm
doing it like this:

# PrimaryText.qml
Text {
    FontLoader { id: myfont; source: "../fonts/myfont.ttf"}
    font.family: myfont.name
    font.pixelSize: 26
}

Everywhere I need this font, I'm using 'PrimaryText' instead of 'Text'.

The problem with this approach seems to be that the font is loaded into
memory for each use of the 'PrimaryText' component.

Is this my design? Is there a better way to solve this use-case?

Thanks!
Conny





More information about the Qt-qml mailing list