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

REG 6.8.2->6.8.3: wrong font selected after setting hinting preference

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.8.3
    • GUI: Font handling
    • None
    • Windows 10, FreeType or GDI font engine
    • Windows

    Description

      Selecting the "Noto Sans" font by its name and then setting its hinting preference to 'QFont::PreferFullHinting' results in a different weight of the font.
       
      This only seems to happen if the font has a substitute and the font engine is either FreeType or GDI (not the native engine).
      This problem was not present in Qt 6.8.2, but appears in Qt 6.8.3.
       
      To reproduce the problem, execute the attached code under Qt 6.8.3 (Windows 10, after changing the path constant in the code to where the attached fonts are stored).
      Attached is a screenshot that shows the second line using a condensed font, although the font name is the same as for the first line.
      The only difference is that the second line executed the 'QFont::setHintingPreference(QFont::PreferFullHinting)' method.
       
      Some observations:
        - the problem was not present in Qt 6.8.2.

      • the problem disappears if the 'native' font engine is used.
      • the problem disappears if the "Noto Sans CJK JP" font is not set as a substitute for "Noto Sans".
      • the problem disappears if the 'QFont::setHintingPreference(QFont::PreferFullHinting)' method is not called on the second font.
          - the incorrect font looks like the "Noto Sans Condensed" font (which I have installed on my system, but is not explicitly added as the "Noto Sans" and "Noto Sans CJK JP" fonts are).
         
        This might be related to QTBUG-131902. However, the used "Noto Sans" and "Noto Sans CJK JP" fonts are the correct ones per Eskil Abrahamsen Blomfeldt's comment in the QTBUG-131902 bug report.
         
        Attached screenshots:
         - using Qt 6.8.2 and FreeType font engine (correct)
         - using Qt 6.8.3 and FreeType font engine (incorrect, same result with GDI font engine)
         - using Qt 6.8.3 and native   font engine (correct)
         

      Attachments

        1. Qt6.8.3_Native.png
          Qt6.8.3_Native.png
          69 kB
        2. Qt6.8.3_FreeType.png
          Qt6.8.3_FreeType.png
          63 kB
        3. Qt6.8.2_FreeType.png
          Qt6.8.2_FreeType.png
          66 kB
        4. NotoSans-Regular.ttf
          614 kB
        5. NotoSans-Condensed.ttf
          440 kB
        6. NotoSansCJK-Regular.ttc
          18.58 MB
        7. FontSelectionIncorrect.cpp
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            ev E Visser
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes