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 속성을 사용하여 글꼴을 로드할 때 자동으로 설정됩니다.

이것은 FontLoaderfont 속성의 패밀리 속성과 동일합니다.

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' }

© 2025 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.