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

QFontMetrics::averageCharWidth() returns incorrect values for OpenType bitmap fonts

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12.7
    • GUI: Font handling
    • None
    • Linux/X11

    Description

      As per summary, `averageCharWidth()`  returns obviously incorrects widths for OpenType bitmap (OTB) font: the value is much larger than the expected one, for example 605 for a 5 pixel-wide font. This can cause all sort of problems for programs that use metrics to size widgets and is how I came upon this.

      Before reporting the bug I have tested multiple fonts, some generated with fontforge and other with different tools (like mkfonttosfnt), and all show the same issue, so it's very unlikely to be an incorrect value in the font itself.

       

      To try to reproduce the issue here's an OTB font: cozette.otb

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            rnhmjoj rn hmjoj
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes