Qt World Summit: Register Today!

Fontloader: Change font name for two different font styles

  • Hi,
    I try to use the FontAwesome icon fonts in a qml project. FontAwesome comes in the styles regular and solid. I downloaded the two corresponding .otf files from https://fontawesome.com/ and try to use them via fontloaders:

    FontLoader {id: fontawesome_solid; source: "qrc:/resource/fontawesome_solid.otf"}
    FontLoader {id: fontawesome_regular; source: "qrc:/resources/fontawesome_regular.otf"}

    The problem is, that the name of both of these two fonts is "Font Awesome 5 Free". Therefore, if I set font.style like this:

    Text {
              anchors {left: name.right; baseline: name.baseline}
              text: "\uF0DD"
              font.pixelSize: Style.fontSizeStandard
              textFormat: Text.RichText
              font.family: fontawesome_solid.name
              MouseArea {
                  anchors.fill: parent
                  onClicked: {

    I cannot use symbols in the _solid.otf font. How can I avoid this naming problem?

Log in to reply