Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QML Application and Font Awesome



  • Hi,

    I developed my qt qml application with qt 5.12.8 in linux and I use some icons from font awesome. In the linux application all icons are displayed correctly. But if I compile the same application under windows (with the same qt version) some icons from font awesome are changed.
    Do you know what I can do that all font awesome icons are displayed correctly in linux and windows?

    Thank you for your help.
    BR
    martin



  • Under Windows Qt uses another font engine, so You might try to force using freetype - the same as under Linux.
    Put qt.conf file with that content:

    [Platforms]
    WindowsArguments = fontengine=freetype
    

    next to your app executable.

    It does a trick for me.

    For Mac Os one has to compile Qt with freetype support first.



  • Under Windows Qt uses another font engine, so You might try to force using freetype - the same as under Linux.
    Put qt.conf file with that content:

    [Platforms]
    WindowsArguments = fontengine=freetype
    

    next to your app executable.

    It does a trick for me.

    For Mac Os one has to compile Qt with freetype support first.



  • Hi @msauer75 ,
    I think you should download file ttf of awesome font, then add it into your project as a resource file.
    For me, It worked well with platforms (linux, ios, android,...). This is my initilization:

        property alias fontAwesome: fontAwesomeLoadder.name
    
        FontLoader {
            id: fontAwesomeLoadder
            source: "qrc:/assets/fa-solid-900.ttf"
        }
    

    I put it in Style.qml.
    Then when I want to use, simply use the fontAwesome
    This is example:

                Text {
                    id: textIcon
                    anchors.centerIn: parent
                    font {
                        family: Style.fontAwesome
                        pixelSize: 40
                    }
                    text: "\uf11b"
                    color: "#eeeeee"
                    verticalAlignment: Text.AlignVCenter
                    horizontalAlignment: Text.AlignHCenter
                 }
    


  • @SeeLook

    Thank you. That works

    BR
    martin


Log in to reply