The FontLoader element allows fonts to be loaded by name or URL. More...
This element was introduced in Qt 4.7.
The FontLoader element 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 1.0 Column { FontLoader { id: fixedFont; name: "Courier" } FontLoader { id: webFont; source: "http://www.mysite.com/myfont.ttf" } Text { text: "Fixed-size font"; font.family: fixedFont.name } Text { text: "Fancy font"; font.family: webFont.name } }
See also Fonts example.
name : string |
This property holds the name of the font family. It is set automatically when a font is loaded using the url property.
Use this to set the font.family property of a Text item.
Example:
Item { width: 200; height: 50 FontLoader { id: webFont source: "http://www.mysite.com/myfont.ttf" } Text { text: "Fancy font" font.family: webFont.name } }
source : url |
The url of the font to load.
read-onlystatus : enumeration |
This property holds the status of font loading. It can be one of:
Use this status to provide an update or respond to the status change in some way. For example, you could:
State { name: 'loaded'; when: loader.status == FontLoader.Ready }
FontLoader { id: loader onStatusChanged: if (loader.status == FontLoader.Ready) console.log('Loaded') }
Text { text: loader.status == FontLoader.Ready ? 'Loaded' : 'Not loaded' }
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.