Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-101436

Font selection via styleName broken on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.2.3, 6.3.0 Beta2, 6.4.0
    • GUI: Font handling
    • None
    • Windows 10, MinGW Qt build
    • Windows

      Font selection via QFont::setStyleName() is broken on Windows.

      QFontDatabase::styles("Arial") includes "Bold" as a valid style name. Yet, when requesting font family "Arial" with styleName "Bold", Qt renders "Arial" in the "Regular" style (= font weight 400).

      Reproduction

      import QtQuick
      import QtQuick.Window
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Font Style Selection Broken")
      
          Text {
              text: "Arial Bold"
              anchors.centerIn: parent
      
              font {
                  pixelSize: 72
                  family: "Arial"
                  styleName: "Bold"
              }
          }
      }
      

      More extensive example with more debug output attached (QML and plain C++).

        1. qtbug-101436.zip
          2 kB
          Niklas Wenzel
        2. screenshot.png
          15 kB
          Niklas Wenzel
        For Gerrit Dashboard: QTBUG-101436
        # Subject Branch Project Status CR V

            esabraha Eskil Abrahamsen Blomfeldt
            nikwen Niklas Wenzel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There is 1 open Gerrit change