Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Fontloader: Change font name for two different font styles
QtWS25 Last Chance

Fontloader: Change font name for two different font styles

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 290 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    maxwell31
    wrote on last edited by maxwell31
    #1

    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: {
                      console.log(fontawesome_solid.name)
                  }
              }
          }
    

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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved