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

Reg->6.8.3: macOS: QFontDatabase::styles does not return all styles in family

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P1: Critical P1: Critical
    • None
    • 6.8.3
    • GUI: Font handling
    • None
    • macOS

      The attached zip file nepomuk.zip contains a font family with six weights:

      Regular
      Bold
      Italic
      Bold Italic
      SC
      Bold SC

      "SC" is the regular weight of the font, but small caps; "Bold SC" is the bold weight of the font, but small caps. Regular and SC both define the same weight class (Regular/400), width class (Normal), slope class (Plain); however, the style names are different ("Regular" vs "SC"). Similarly, for "Bold" and "Bold SC", they share the same weight class, width class, slope class, and have different style names.

      QFontDatabase::styles on macOS only returns four entries: it omits "Regular" and "Bold". This means that the regular, non-small caps styles of the font are not available, and cannot be chosen in a Qt application.

      The attached zip file style-lister-src.zip contains a trivial console application that can be used to reproduce the problem. Once it's built, provide the font family name ("Nepomuk") as an argument to the application, and it will list the QFontDatabase styles versus the Core Text styles.

      My understanding is that internally QFontDatabase is merging fonts based on their common properties, and perhaps because it's encountering "SC" and "Bold SC" after "Regular" and "Bold", these styles end up replacing the wanted styles?

      This seems to have worked OK in versions of Qt up to 6.8.1, but we've recently started using 6.8.3 and it appears the behaviour has changed.

        1. style-lister-src.zip
          4 kB
        2. nepomuk.zip
          270 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            esabraha Eskil Abrahamsen Blomfeldt
            danielspreadbury Daniel Spreadbury
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes