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

The order fonts are loaded in, can artificially reduce their style variants

    XMLWordPrintable

Details

    • Windows
    • 7a9230404 (dev), f7e2d9f59 (6.5)

    Description

      On Windows 10 with the Free Type font engine, if I load the stock system font "Arabic Transparent" before I load the stock system font "Arial", then "Arial" fonts will always be in italic (QFontInfo::styleName() returns "Italic" or "Narrow")

      If I load the fonts in the opposite order, everything is fine:

      #include <QtWidgets/QtWidgets>
      
      // NOTE: fontengine=freetype
      int main(int argc, char *argv[]) {
        QApplication a(argc, argv);
      
      #if 0
        // No Bug - Works Fine
        qDebug() << QFontInfo(QFont("Arial")).styleName();    // prints "Regular"
        qDebug() << QFontInfo(QFont("Arabic Transparent")).styleName();
      #else
        // Bug - Now All Arial Fonts Are Italic/Narrow
        qDebug() << QFontInfo(QFont("Arabic Transparent")).styleName();
        qDebug() << QFontInfo(QFont("Arial")).styleName();  // prints "Italic"
      #endif
      
        return 0;
      } 

       

      I can see the bug occurring while loading the "Arabic Transparent" font, in the following callstack, where it loads only "Arial Italic" for the "Arial" font family and sets the  Arial's QFontFamily populated to true.

       

      EnumFontFamilesEx for "Arabic Transparent"

      [(Arabic Transparent, Bold Italic)]
      [(Arial, Italic)]
      [(Arabic Transparent, Bold)]
      [(Arabic Transparent, Italic)]
      [(Arabic Transparent, Regular)]

       

      Callstack

      Qt5Guid.dll!qt_registerFont(const QString & familyName, const QString & stylename, const QString & foundryname, int weight, QFont::Style style, int stretch, bool antialiased, bool scalable, int pixelSize, bool fixedPitch, const QSupportedWritingSystems & writingSystems, void * handle)
      Qt5Guid.dll!QPlatformFontDatabase::registerFont(const QString & familyname, const QString & stylename, const QString & foundryname, QFont::Weight weight, QFont::Style style, QFont::Stretch stretch, bool antialiased, bool scalable, int pixelSize, bool fixedPitch, const QSupportedWritingSystems & writingSystems, void * usrPtr)
      qwindowsd.dll!addFontToDatabase(QString familyName, QString styleName, const QString & fullName, const tagLOGFONTW & logFont, const tagTEXTMETRICW * textmetric, const tagFONTSIGNATURE * signature, int type)
      qwindowsd.dll!storeFont(const tagLOGFONTW * logFont, const tagTEXTMETRICW * textmetric, unsigned long type, __int64 lparam)
      gdi32full.dll!EnumFontsInternalW()
      gdi32full.dll!EnumFontFamiliesExW()
      qwindowsd.dll!QWindowsFontDatabaseFT::populateFamily(const QString & familyName)
      Qt5Guid.dll!QtFontFamily::ensurePopulated()
      Qt5Guid.dll!match(int script, const QFontDef & request, const QString & family_name, const QString & foundry_name, QtFontDesc * desc, const QList<int> & blacklistedFamilies, unsigned int * resultingScore)
      Qt5Guid.dll!QFontDatabase::findFont(const QFontDef & request, int script, bool preferScriptOverFamily)
      Qt5Guid.dll!QFontDatabase::load(const QFontPrivate * d, int script)
      Qt5Guid.dll!QFontPrivate::engineForScript(int script) 

      Attachments

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

        Activity

          People

            manordheim Mårten Nordheim
            miz Chris Mizerak
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes