summaryrefslogtreecommitdiffstats
path: root/examples/declarative/fonts/fonts.qml
blob: c981e51e7d476323a7f528cfd42ee00f918c4b87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import Qt 4.6

Rect {
    property string myText: "Lorem ipsum dolor sit amet, consectetur adipisicing elit"

    width: 800; height: 600
    color: Palette.base

    Palette { id: Palette; colorGroup: "Active" }

    FontLoader { id: FixedFont; name: "Courier" }

    FontLoader { id: LocalFont; source: "fonts/Fontin-Bold.ttf" }
    /* A font by Jos Buivenga (exljbris) -> www.exljbris.nl */

    FontLoader { id: WebFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" }
    FontLoader { id: WebFont2; source: "http://wrong.address.org" }

    VerticalLayout {
        anchors.fill: parent
        anchors.leftMargin: 10; anchors.rightMargin: 10
        Text {
            text: myText
            color: Palette.windowText
            width: parent.width; elide: "ElideRight"
            font.family: "Times"
            font.size: 32
        }
        Text {
            text: myText
            color: Palette.windowText
            width: parent.width; elide: "ElideRight"
            font.family: FixedFont.name
            font.size: 32
        }
        Text {
            text: myText
            color: Palette.windowText
            width: parent.width; elide: "ElideRight"
            font.family: LocalFont.name
            font.size: 32
        }
        Text {
            text: {
                if (WebFont.status == 1) myText
                else if (WebFont.status == 2) "Loading..."
                else if (WebFont.status == 3) "Error loading font"
            }
            color: Palette.windowText
            width: parent.width; elide: "ElideRight"
            font.family: WebFont.name
            font.size: 32
        }
        Text {
            text: {
                if (WebFont2.status == 1) myText
                else if (WebFont2.status == 2) "Loading..."
                else if (WebFont2.status == 3) "Error loading font"
            }
            color: Palette.windowText
            width: parent.width; elide: "ElideRight"
            font.family: WebFont2.name
            font.size: 32
        }
    }
}