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

FreeType font backend fails to select font style when a single font file contains multiple font faces

    XMLWordPrintable

Details

    • macOS
    • af875e88f4 (qt/qtbase/dev) 68c17c6fec (qt/qtbase/6.3) 714bb09d55 (qt/qtbase/6.2) 714bb09d55 (qt/tqtc-qtbase/6.2) 68c17c6fec (qt/tqtc-qtbase/6.3) af875e88f4 (qt/tqtc-qtbase/dev)

    Description

      When a single font file contains multiple font faces (e.g. Regular, Light, Medium, etc.), the FreeType font backend fails to select them on macOS.

      For example when requesting the “Light” variant of the macOS system font “Avenir” (/System/Library/Fonts/Avenir.ttc), Qt renders the “Book” variant instead of the “Light” variant.

      Reproduction (run with argument -platform cocoa:fontengine=freetype):

      #include <QGuiApplication>
      #include <QFont>
      #include <QFontInfo>
      #include <QDebug>
      
      
      int main(int argc, char *argv[])
      {
          QGuiApplication app(argc, argv);
      
          QFont font("Avenir");
          font.setStyleName("Light");
          font.setPixelSize(12);
      
          QFontInfo info(font);
          qDebug() << info.family() << info.styleName();
      }
      

      Actual output:

      qt.qpa.fonts: Populating font family aliases took 92 ms. Replace uses of missing font family "Avenir" with one that exists to avoid this cost. 
      "Avenir" "Book"
      

      Expected output:

      "Avenir" "Light"
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes