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

QFontDatabase makes bad font weight choices for Alright Sans family

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.5.0 Beta
    • GUI: Font handling
    • None
    • Arch Linux, Qt latest 5.5 branch, configured with system freetype lib and fontconfig

    Description

      See screenshot: simple QML rendering of all 9 possible font weights, using the Alright Sans family of 6 OTF fonts, with Text.NativeRendering. (but it's the same with distance field rendering) Fonts are in this case being installed via QFontDatabase::addApplicationFont() rather than installed as system fonts.

      Also enabled some qdebugs in qfontdatabase.cpp and got this info about how it is choosing:

      [     0.542 D] main - available font styles: ("Black", "Bold", "Medium", "Regular", "Thin", "Ultra")
      [     0.613 D] match - QFontDatabase::match
        request:
          family: Alright Sans [-- any --], script: 2
          weight: 25, style: 0
          stretch: 100
          pixelSize: 17
          pitch: *
      [     0.613 D] bestFoundry -   REMARK: looking for best foundry for family 'Alright Sans' [1]
      [     0.613 D] bestFoundry -           looking for matching style in foundry 'unknown' 6
      [     0.613 D] bestStyle -           best style has distance 0x0
      [     0.614 D] bestFoundry -           found smoothly scalable font (17 pixels)
      [     0.614 D] bestFoundry -           found a match: score 0 best score so far ffffffff
      [     0.625 D] QFreetypeFace::getFace - filename "../alrightsans-regular-v3.otf"
      [     0.625 D] QFontEngineFT::init - "Alright Sans" weight 25 style_flags 0 pixelSize 17 embolden? false
      [     0.733 D] match - QFontDatabase::match
        request:
          family: Alright Sans [-- any --], script: 2
          weight: 87, style: 0
          stretch: 100
          pixelSize: 17
          pitch: *
      [     0.733 D] bestFoundry -   REMARK: looking for best foundry for family 'Alright Sans' [1]
      [     0.733 D] bestFoundry -           looking for matching style in foundry 'unknown' 6
      [     0.733 D] bestStyle -           best style has distance 0x0
      [     0.733 D] bestFoundry -           found smoothly scalable font (17 pixels)
      [     0.733 D] bestFoundry -           found a match: score 0 best score so far ffffffff
      [     0.736 D] QFreetypeFace::getFace - filename "../alrightsans-ultra-v3.otf"
      [     0.737 D] QFontEngineFT::init - "Alright Sans" weight 87 style_flags 2 pixelSize 17 embolden? false
      [     0.737 D] match - QFontDatabase::match
        request:
          family: Alright Sans [-- any --], script: 2
          weight: 81, style: 0
          stretch: 100
          pixelSize: 17
          pitch: *
      [     0.737 D] bestFoundry -   REMARK: looking for best foundry for family 'Alright Sans' [1]
      [     0.737 D] bestFoundry -           looking for matching style in foundry 'unknown' 6
      [     0.737 D] bestStyle -           best style has distance 0x6
      [     0.738 D] bestFoundry -           found smoothly scalable font (17 pixels)
      [     0.738 D] bestFoundry -           found a match: score 2000 best score so far ffffffff
      [     0.741 D] QFreetypeFace::getFace - filename "../alrightsans-bold-v3.otf"
      [     0.742 D] QFontEngineFT::init - "Alright Sans" weight 81 style_flags 2 pixelSize 17 embolden? false
      [     0.742 D] match - QFontDatabase::match
        request:
          family: Alright Sans [-- any --], script: 2
          weight: 75, style: 0
          stretch: 100
          pixelSize: 17
          pitch: *
      [     0.743 D] bestFoundry -   REMARK: looking for best foundry for family 'Alright Sans' [1]
      [     0.743 D] bestFoundry -           looking for matching style in foundry 'unknown' 6
      [     0.743 D] bestStyle -           best style has distance 0x0
      [     0.743 D] bestFoundry -           found smoothly scalable font (17 pixels)
      [     0.743 D] bestFoundry -           found a match: score 0 best score so far ffffffff
      [     0.746 D] QFreetypeFace::getFace - filename "../alrightsans-bold-v3.otf"
      [     0.746 D] QFontEngineFT::init - "Alright Sans" weight 75 style_flags 2 pixelSize 17 embolden? false
      [     0.747 D] match - QFontDatabase::match
        request:
          family: Alright Sans [-- any --], script: 2
          weight: 63, style: 0
          stretch: 100
          pixelSize: 17
          pitch: *
      [     0.747 D] bestFoundry -   REMARK: looking for best foundry for family 'Alright Sans' [1]
      [     0.747 D] bestFoundry -           looking for matching style in foundry 'unknown' 6
      [     0.747 D] bestStyle -           best style has distance 0xc
      [     0.747 D] bestFoundry -           found smoothly scalable font (17 pixels)
      [     0.747 D] bestFoundry -           found a match: score 2000 best score so far ffffffff
      [     0.751 D] QFreetypeFace::getFace - filename "../alrightsans-bold-v3.otf"
      [     0.751 D] QFontEngineFT::init - "Alright Sans" weight 63 style_flags 2 pixelSize 17 embolden? false
      [     0.752 D] match - QFontDatabase::match
        request:
          family: Alright Sans [-- any --], script: 2
          weight: 57, style: 0
          stretch: 100
          pixelSize: 17
          pitch: *
      [     0.752 D] bestFoundry -   REMARK: looking for best foundry for family 'Alright Sans' [1]
      [     0.752 D] bestFoundry -           looking for matching style in foundry 'unknown' 6
      [     0.752 D] bestStyle -           best style has distance 0x7
      [     0.752 D] bestFoundry -           found smoothly scalable font (17 pixels)
      [     0.752 D] bestFoundry -           found a match: score 2000 best score so far ffffffff
      [     0.756 D] QFreetypeFace::getFace - filename "../alrightsans-black-v3.otf"
      [     0.756 D] QFontEngineFT::init - "Alright Sans" weight 57 style_flags 0 pixelSize 17 embolden? false
      [     0.757 D] match - QFontDatabase::match
        request:
          family: Alright Sans [-- any --], script: 2
          weight: 50, style: 0
          stretch: 100
          pixelSize: 17
          pitch: *
      [     0.757 D] bestFoundry -   REMARK: looking for best foundry for family 'Alright Sans' [1]
      [     0.757 D] bestFoundry -           looking for matching style in foundry 'unknown' 6
      [     0.757 D] bestStyle -           best style has distance 0x0
      [     0.757 D] bestFoundry -           found smoothly scalable font (17 pixels)
      [     0.758 D] bestFoundry -           found a match: score 0 best score so far ffffffff
      [     0.762 D] QFreetypeFace::getFace - filename "../alrightsans-black-v3.otf"
      [     0.762 D] QFontEngineFT::init - "Alright Sans" weight 50 style_flags 0 pixelSize 17 embolden? false
      [     0.762 D] match - QFontDatabase::match
        request:
          family: Alright Sans [-- any --], script: 2
          weight: 12, style: 0
          stretch: 100
          pixelSize: 17
          pitch: *
      [     0.762 D] bestFoundry -   REMARK: looking for best foundry for family 'Alright Sans' [1]
      [     0.762 D] bestFoundry -           looking for matching style in foundry 'unknown' 6
      [     0.762 D] bestStyle -           best style has distance 0xd
      [     0.763 D] bestFoundry -           found smoothly scalable font (17 pixels)
      [     0.763 D] bestFoundry -           found a match: score 2000 best score so far ffffffff
      [     0.766 D] QFreetypeFace::getFace - filename "../alrightsans-regular-v3.otf"
      [     0.767 D] QFontEngineFT::init - "Alright Sans" weight 12 style_flags 0 pixelSize 17 embolden? false
      

      Attachments

        1. alright-sans-weight-choices-add-app-font.png
          alright-sans-weight-choices-add-app-font.png
          23 kB
        2. alright-sans-weight-choices-after-installation.png
          alright-sans-weight-choices-after-installation.png
          30 kB
        3. AlrightSans-WinQt55.png
          AlrightSans-WinQt55.png
          21 kB
        4. fixed.png
          fixed.png
          26 kB
        5. fontforge-settings.png
          fontforge-settings.png
          222 kB
        6. fonttest.tgz
          1.0 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
              srutledg Shawn Rutledge
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes