Add custom font for Quick Controls 2 in Android
-
@Advanced Add you custom fonts inside resource files and load them as:
- In QML using FontLoader load and assign them to each QML component's attached property
font.family
- Use QFont and apply it globally by setting it to
QGuiApplication
.
- In QML using FontLoader load and assign them to each QML component's attached property
-
If you consider using V-Play, you could also set the font app-wide from QML
import VPlayApps 1.0 import QtQuick 2.5 App { onInitTheme: { Theme.normalFont = arialFont } FontLoader { id: arialFont source: "fonts/Arial.ttf" // loaded from your assets folder } Page { AppText { text: "I'm in Arial" } } }
-
With Qt Quick Controls 2, you can specify a custom font in QML:
Qt Quick Controls 2 provides natural inheritance for fonts. Specifying a custom font at window level means that the font propagates to all child controls and popups in the window. And when specifying a custom font for a control/popup, the font propagates to its child controls.
-
With Qt Quick Controls 2, you can specify a custom font in QML:
Qt Quick Controls 2 provides natural inheritance for fonts. Specifying a custom font at window level means that the font propagates to all child controls and popups in the window. And when specifying a custom font for a control/popup, the font propagates to its child controls.