Andreas
Andreas

Reputation: 636

How to change the font family

I use Qt 5.3.

I've tried to set the QApplication::setFont() and also the font.family property of the QML component:

import QtQuick 2.3
import QtQuick.Controls 1.2

ApplicationWindow {
    id: mainWindow
    visible: true
    width: 640
    height: 480

    Text {
        font.pointSize: 24;
        color: Qt.rgba(0.2,0.2,0.2,1);
        font.family: "Courier";
        text: qsTr("MyText");
    }
}

But, nothing seems to work. The only thing that happens on using setFont() is that the font size scale.

Upvotes: 1

Views: 6895

Answers (1)

phyatt
phyatt

Reputation: 19112

For Android Jelly Bean, with Qt, listing Font Families returned:

console.log(Qt.fontFamilies())

Android Emoji
AndroidClock
AndroidClock-Large
Clockopia
Droid Arabic Naskh
Droid Naskh Shift Alt
Droid Sans Armenian
Droid Sans Ethiopic
Droid Sans Fallback
Droid Sans Georgian
Droid Sans Hebrew
Droid Sans Mono
Droid Serif
MotoyaLMaru
NanumGothic
Noto Sans
Noto Sans Bengali
Noto Sans Bengali UI
Noto Sans Devanagari
Noto Sans Devanagari UI
Noto Sans Kannada
Noto Sans Kannada UI
Noto Sans Lao
Noto Sans Lao UI
Noto Sans Malayalam
Noto Sans Malayalam UI
Noto Sans Symbols
Noto Sans Tamil
Noto Sans Tamil UI
Noto Sans Telugu
Noto Sans Telugu UI
Noto Sans Thai
Noto Sans Thai UI
Padauk Book
Roboto
Roboto Condensed

The recommended one for "Fixed" is Helvetica.

The best monospace solution, I think is: Droid Sans Mono.

Upvotes: 7

Related Questions