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. What does font.bold actually do? Use a different font or change rendering?
Forum Update on Monday, May 27th 2025

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

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 500 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 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?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      maxwell31
      wrote on last edited by
      #2

      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?
      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