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

QFontDatabase don't show all available styles.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.4.0
    • 5.1.1, 5.2.1, 5.3.0, 5.3.1
    • GUI: Font handling
    • None
    • Windows 7 x64, Qt 4.8.6, Qt 5.1.1, Qt 5.2.1, Qt 5.3, qt-everywhere-opensource-src-5.3.1
    • 8456adf0eeb9df8dd5f0547d4ad5a81888295f03 (qtbase/5.4, 20.8.2014, 5.4.0), Revert 5b1da97b6b4a011f9ce5582869a7a957f6f1369c (qtbase/5.4, 22.1.2015, 5.4.2) , Std font db c88e354993f8db3da741b1492f7578e9e0fdb07f (qtbase/5.4, 3.2.2015, 5.4.2)

    Description

      On Windows list of available font styles in QFontDatabase don't shows all available styles.

      Code:

       QFontDatabase fonts;
       QString family = "Glametrix";
       QStringList styles = fonts.styles(family);
       qDebug() << family;
       qDebug() << styles;
      

      Qt 4.8.6 output:

      "Glametrix"
      ("Normal", "Bold", "Italic", "Bold Italic", "Light", "Light Italic")
      

      Later, this behavior looks like a broken.
      It was intended or is it a bug?

      Qt 5.3:

      "Glametrix"
      ("Normal", "Bold", "Italic", "Bold Italic")
      

      Source code in qwindowsfontdatabase.cpp enumerates only first font of many with same names.
      EnumFontFamiliesEx at MSDN:

      lfCharSet = DEFAULT_CHARSET
      lfFaceName = '\0'

      Enumerates all uniquely-named fonts within all character sets. If there are two fonts with the same name, only one is enumerated.

      This patch enumerates fonts with same name.
      Patched Qt 5.3.1:

      "Glametrix"
      ("Normal", "Bold", "Italic", "Bold Italic", "Light", "Light Italic")
      

      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
              riuson rius
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes