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

Qt doesn't use FontSubstitutes from windows registry

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12.5
    • None
    • windows7x64 mingw64-7.3 Qt5.12.5

    Description

      I have used Process Monitor to trace access to Registry.
      [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]
      Qt makes substitution to "MS Shell Dlg 2" already somewhere inside
      for all "non-standard fonts" i.e. not Arial, Times New Roman etc
      and tries to find substitution for "MS Shell Dlg 2".
      For standard fonts it does everything right.

      For example I want to ask for "Arial Greek" and expect to get "Arial".

      Code

      #include <QGuiApplication>
      #include <QFontInfo>
      #include <QDebug>
      
      QString family(QString name) {
          auto font = QFont(name);
          font.setStyleHint(QFont::System);
          QFontInfo info(font);
          return info.family();
      }
      
      int main(int argc, char *argv[])
      {
          QGuiApplication a(argc, argv);
          qDebug() << family("Helv");
          qDebug() << family("Unknown");
          qDebug() << family("Arial");
          qDebug() << family("Arial Greek");
          qDebug() << family("Arial Undefined");
          qDebug() << family("Times New Roman");
      
          return 0;
      }
      

      Output:

      19:03:59: Starting C:\report\font_sub\debug\font_sub.exe ...
      "MS Shell Dlg 2"
      "MS Shell Dlg 2"
      "Arial"
      "MS Shell Dlg 2"
      "MS Shell Dlg 2"
      "Times New Roman"
      19:03:59: C:/report/font_sub/debug/font_sub.exe exited with code 0
      

      windows 7 x64 mingw64 7.3 Qt 5.12.5

      Attachments

        1. process_monitor_access_log.png
          process_monitor_access_log.png
          54 kB
        2. callstack_non_standard.CSV
          3 kB
        3. callstack_arial.CSV
          3 kB
        4. callstack_times.CSV
          3 kB
        5. my_FontSubstitutes.reg
          2 kB

        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
              andrew.smeltzov Andrew Smeltzov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes