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

Qt does not match charset when calling FontConfig to select font family

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.8.0
    • GUI: Font handling
    • None
    • Arch Linux x86-64 Cinnamon 3.2.8

      Fontconfig supports modify charset during font scan since 2010. This is helpful if you want to limit matching on some fonts to a modified charset, rather than the actual charset in the font file.

      I created the user configuration in the attachment to prefer Noto Sans CJK SC for sans-serif alias, only when the Unicode code point of the character is in the range of CJK code blocks, so that I can use Noto Sans CJK SC for CJK characters but Asana Math for non-CJK characters, such as Latin characters.

      This works correctly in GTK applications as shown in attachment, but in Qt applications both CJK characters and non-CJK characters are using Noto Sans CJK SC. Both GTK application and Qt application in screenshot used Sans or sans-serif as application font.

      From Qt source code:

      https://code.woboq.org/qt5/qtbase/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp.html#_ZNK19QFontconfigDatabase18fallbacksForFamilyERK7QStringN5QFont5StyleENS3_9StyleHintEN5QChar6ScriptE

      It looks like Qt does not add FcCharSet to FcPattern when calling Fontconfig to find a preferred font family. 

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

            esabraha Eskil Abrahamsen Blomfeldt
            mxj4 Yue Liu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes