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

What does font.bold actually do? Use a different font or change rendering?



  • Hi,

    I am writing a QML application for desktop use. I want it to use the Roboto font by google. It comes as several ttf files, each file for a different style (medium, light, italic, bold...).

    If I then have a Text like this:

    FontLoader {id: mytest; source:"qrc:/../../fonts/roboto/Roboto-Regular.ttf"}
         Text {
           id: text254
           width: 404
           height: 60
           text: qsTr("Sample Text")
           font.family: mytest.name
           font.bold: true
    

    What would font.bold do? I guess it would transform Roboto-Regular to look bold instead of using Roboto-bold.ttf. Is there a way I can use font.family so that font.bold would choose Roboto-bold.ttf?



  • So as far as I see, this will not work with a FontLoader. What is the situation, if the font is installed? Then there are several ttf files, e.g. Roboto-Regular.ttf, Roboto-Bold.ttf, Roboto-Italic.ttf. If I use

      ```
    

    Text {
    id: text254
    width: 404
    height: 60
    text: qsTr("Test")
    font.family: "Roboto"
    font.bold: true

    Will the displayed text use "Roboto-Bold.ttf" or widen the Roboto-Regular?

Log in to reply