diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2009-07-31 02:49:59 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2009-07-31 02:49:59 (GMT) |
commit | bf5f7f6db51ef1ddc3fb002d12bfb597c0a748f8 (patch) | |
tree | fef5f48bed9b57247482f42d8fba2472c953eac2 /examples/declarative/fonts | |
parent | 07eabb28228b06a9c9c9730f84fe06faf68119a6 (diff) | |
download | Qt-bf5f7f6db51ef1ddc3fb002d12bfb597c0a748f8.zip Qt-bf5f7f6db51ef1ddc3fb002d12bfb597c0a748f8.tar.gz Qt-bf5f7f6db51ef1ddc3fb002d12bfb597c0a748f8.tar.bz2 |
Add an example using FontFamily.
Diffstat (limited to 'examples/declarative/fonts')
-rw-r--r-- | examples/declarative/fonts/fonts.qml | 66 | ||||
-rw-r--r-- | examples/declarative/fonts/fonts/Fontin-Bold.ttf | bin | 0 -> 30916 bytes |
2 files changed, 66 insertions, 0 deletions
diff --git a/examples/declarative/fonts/fonts.qml b/examples/declarative/fonts/fonts.qml new file mode 100644 index 0000000..eb8cfef --- /dev/null +++ b/examples/declarative/fonts/fonts.qml @@ -0,0 +1,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" } + + FontFamily { id: FixedFont; name: "Courier" } + + FontFamily { id: LocalFont; source: "fonts/Fontin-Bold.ttf" } + /* A font by Jos Buivenga (exljbris) -> www.exljbris.nl */ + + FontFamily { id: WebFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" } + FontFamily { 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 + } + } +} diff --git a/examples/declarative/fonts/fonts/Fontin-Bold.ttf b/examples/declarative/fonts/fonts/Fontin-Bold.ttf Binary files differnew file mode 100644 index 0000000..f6a33b0 --- /dev/null +++ b/examples/declarative/fonts/fonts/Fontin-Bold.ttf |