FontLoader的说明
FontLoader可以通过名字、本地路径、网络url路径三种方式加载字体。
//通过名字,加载系统安装的字体
FontLoader {
id: fixedFont; name: "Courier" }
//加载本地的一个字体文件
FontLoader {
id: localFont; source: "content/fonts/tarzeau_ocr_a.ttf" }
//加载网络url路径上的字体
FontLoader {
id: webFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" }
举例:
import QtQuick 2.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 }
}
使用的时候,只需要
font.family: webFont.name
通过font.family来指定就可以。
FontLoader 的几种状态
FontLoader.Null - 没有指定字体
FontLoader.Ready - 字体已经被加载
FontLoader

最低0.47元/天 解锁文章
857

被折叠的 条评论
为什么被折叠?



