FontLoader QML Type
URL을 통해 글꼴을 불러올 수 있습니다. 더 보기...
| Import Statement: | import QtQuick |
속성
상세 설명
FontLoader 유형은 URL을 통해 글꼴을 불러오는 데 사용됩니다.
status 는 글꼴이 로드된 시점을 나타내며, 원격 소스에서 로드된 글꼴의 경우 유용합니다.
예:
import QtQuick 2.0
Column {
FontLoader { id: webFont; source: "http://www.mysite.com/myfont.ttf" }
Text { text: "Fancy font"; font: webFont.font }
}Qt Quick 예제 - 텍스트 글꼴도 참조하십시오 .
속성 설명
font : font [read-only, since 6.0]
이 속성은 로드된 글꼴에 대한 기본 쿼리를 저장합니다.
글꼴 이름을 명확히 구분하기 위해 글꼴 계열명 이외의 다른 속성이 필요한 경우, 이 속성을 사용하여 글꼴을 선택할 수 있습니다. 개별 속성을 사용하여 글꼴을 지정할 수 있습니다:
Item {
width: 200; height: 50
FontLoader {
id: webFont
source: "http://www.mysite.com/myfont.ttf"
}
Text {
text: "Fancy font"
font.family: webFont.font.family
font.weight: webFont.font.weight
font.styleName: webFont.font.styleName
font.pixelSize: 24
}
}아니면 전체 글꼴 쿼리를 직접 설정할 수도 있습니다:
Item {
width: 200; height: 50
FontLoader {
id: webFont
source: "http://www.mysite.com/myfont.ttf"
}
Text {
text: "Fancy font"
font: webFont.font
}
}이 경우 기본 폰트 쿼리가 수정 없이 그대로 사용됩니다(예를 들어, 폰트 크기는 시스템 기본값이 됩니다).
이 속성은 Qt 6.0에서 도입되었습니다.
name : string [read-only]
이 속성은 글꼴 패밀리의 이름을 저장합니다. 이 속성은 source 속성을 사용하여 글꼴을 불러올 때 자동으로 설정됩니다.
이는 FontLoader 의 font 속성에 있는 family 속성과 동일합니다.
이 속성을 사용하여 Text 항목의 font.family 속성을 설정할 수 있습니다.
예시:
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
로드할 글꼴의 URL입니다.
status : enumeration [read-only]
이 속성은 글꼴 로딩 상태를 나타냅니다. 다음 중 하나일 수 있습니다:
| 상수 | 설명 |
|---|---|
FontLoader.Null | 글꼴이 설정되지 않음 |
FontLoader.Ready | 글꼴이 로드되었습니다 |
FontLoader.Loading | 현재 글꼴이 로드 중입니다 |
FontLoader.Error | 글꼴을 불러오는 동안 오류가 발생했습니다 |
이 상태를 사용하여 최신 정보를 제공하거나 상태 변경에 대해 어떤 방식으로든 대응하십시오. 예를 들어, 다음과 같은 조치를 취할 수 있습니다:
- 상태 변경을 트리거합니다:
State { name: 'loaded'; when: loader.status == FontLoader.Ready } onStatusChanged신호 핸들러를 구현합니다:FontLoader { id: loader onStatusChanged: if (loader.status == FontLoader.Ready) console.log('Loaded') }- 상태 값에 바인딩하기:
Text { text: loader.status == FontLoader.Ready ? 'Loaded' : 'Not loaded' }
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.