How to use roboto thin font in qml

前端 未结 3 1395
遇见更好的自我
遇见更好的自我 2021-01-15 15:46

I am trying to use robot thin font in QML in Linux.I have install bold,thin and light fonts on ubuntu. Other programs like openoffice shows me only roboto. How do i get to u

3条回答
  •  天涯浪人
    2021-01-15 16:29

    AlexB's answer is correct, and has cost me too long struggling why it didn't work.

    For those wondering why their Roboto-Light font looks like Roboto-Bold, heres how to fix it:

    FontLoader
    {
       id: robotoLight
       source: "../fonts/Roboto/Roboto-Light.ttf"
    }
    
    Text
    {
       text: "This text is Roboto-Light"
       font.family: robotoLight.name
       font.weight: Font.Light   // this is necessary or else it'll look like Roboto-Bold
    }
    

提交回复
热议问题