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

Font selection via styleName broken on Windows

    XMLWordPrintable

Details

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

    Description

      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++).

      Attachments

        1. qtbug-101436.zip
          2 kB
          Niklas Wenzel
        2. screenshot.png
          15 kB
          Niklas Wenzel

        Issue Links

          For Gerrit Dashboard: QTBUG-101436
          # Subject Branch Project Status CR V

          Activity

            People

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

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change