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

Problem with two fontloader in singleton



  • Hi,

    I want to use two different fonts in my QML project. In my singleton I defined the two fontloaders:

        readonly property FontLoader fontAwesomeSolid: FontLoader {
            source: "qrc:/assets/fa-solid-900.otf"
        }
        readonly property FontLoader fontAwesomeRegular: FontLoader {
                source: "qrc:/assets/fa-regular-400.otf"
        }
    
        readonly property string regular: fontAwesomeRegular.name
        readonly property string solid: fontAwesomeSolid.name
    

    The system will only use the fonts from fa-regular-400.otf. So the icons are wrong.

    In my navigation bar I want to use icons from fa-solid-900.otf:

            Row {
                Text {
                    id: textIcon
                    width: Style.widthNavigationButtonIcon
                    height: Style.heightNavigationButtonIcon
                    font {
                        family: Style.solid
                        pixelSize: Style.pixelSizeNavigationBarIcon
                    }
                    color: Style.colourNavigationBarFont
                    text: "\uf11a"
                    verticalAlignment: Text.AlignVCenter
                    horizontalAlignment: Text.AlignHCenter
                }
                Text {
                    id: textDescription
                    width: Style.widthNavigationButtonDescription
                    height: Style.heightNavigationButtonDescription
                    color: Style.colourNavigationBarFont
                    text: "SET ME!!"
                    verticalAlignment: Text.AlignVCenter
                    font.pixelSize: Style.pixelSizeNavigationBarText
                }
            }
    

    But It will only use the icons from fa-regular-400.otf.
    What have I to do that I can use more than one custom fonts?

    Thank you for your help.
    BR
    martin



  • Ok. I found the problem. The solution is here: https://github.com/FortAwesome/Font-Awesome/issues/12787

    BR
    martin


Log in to reply