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

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

XMLWordPrintable

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

      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

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

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

              Created:
              Updated:

                There are no open Gerrit changes