Add custom font for Quick Controls 2 in Android



  • Dear Guys
    Is it possible to add custom font in Qt Quick Controls 2 Android Application like font face?
    In android it's possible to add custom font
    Thanks


  • Moderators

    @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.


  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.