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

QFontEngineFT artificially emboldens fonts that are bold but don't have the Style Map set to Bold

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.5.0 Beta
    • GUI: Font handling
    • None

      Example: AlrightSans-Bold

      I verified that if we try to load AlrightSans with a weight of 81 or 75, our code will choose alrightsans-bold-v3.otf, and then set embolden to true due to these lines:

              if ((fontDef.weight >= QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face))
                  embolden = true;
      

      Likewise for a weight of 87, it will load alrightsans-ultra-v3.otf, and that one also is not set to bold, so it will be emboldened.

      Then I verified that if I open these two files in fontforge, go to Element | Font Info, then the OS/2 tab, and change Style Map from None to Bold, then re-generate the OTF file (File | Generate Fonts), face->style_flags will not be zero anymore, and this font will no longer be emboldened.

      This seems naive, because there is not just one bold font in this family of 6 fonts: there are instead ultra, black, bold, medium, regular, and thin. Qt is not doing a good job of choosing the right one according to weight: that's one problem. But this bug is about the fact that it emboldens the bold ones even more.

      The otf files are not attached because this is a commercial font, but just ask if you need a copy to test.

      But I don't understand of all the places that the weight can be specified in various font metadata tables (I found about 5 of them while poking around in FontForge), which ones freetype can look at, and which ones Qt should therefore be using in order to match up the requested weight with the right font file.

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

            esabraha Eskil Abrahamsen Blomfeldt
            srutledg Shawn Rutledge
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes