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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.12.7
    • Fix Version/s: None
    • Component/s: GUI: Font handling
    • Labels:
      None
    • Platform/s:
      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

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

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes