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. Font won't load
Qt 6.11 is out! See what's new in the release blog

Font won't load

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 260 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.
  • J Offline
    J Offline
    Jay_emissary
    wrote on last edited by
    #1

    Hello, I found a font from googlefonts and imported it to my qt project through the resources property in CMAKE

    54c90f26-5dc8-412e-98cb-3faf4b91e1ed-image.png

    I'm not sure if it's required, but I added it anyway just in case. When I apply the font to the font loader

    FontLoader{
     id: montserrat
     source: "Fonts/Montserrat-VariableFont_wght.ttf"
    
    }
    

    then try to use and apply weight to it through this code

                                    Text{
                                        anchors.centerIn: parent
                                        color: ColorProperties.textColor
                                        font.pixelSize: Math.round(btn2.height/3)
                                        text: montserrat.status == montserrat.Ready ? 'Loaded' : 'Not loaded'
                                        font.family: montserrat.name
                                        font.weight: Font.ExtraBold
                                    }
    
    

    The text appears as "Not loaded" but the font family does seem to be altered. The only problem I have is that the font ignores the ExtraBold property. Can I get some assistance in figuring out what went wrong?

    Thanks

    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