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

Incorrect bounding rect calculations on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 6.2.2, 6.2.3, 6.3.0 Alpha
    • GUI: Font handling
    • None
    • Windows 10
    • Windows

      Qt calculates bounding rects incorrectly for a number of fonts that come preinstalled with Windows. This severely breaks my application when the user selects those fonts.

      Here's what happens in the attached screenshot:

      1. For each font, the bounding rect is calculated using QFontMetricsF::boundingRect(const QString &text)
      2. The bounding rect is drawn
      3. The baseline of the text is drawn (by definition of the bounding rect, this is the line at y=0)
      4. The text is drawn

      The first font shows how it should be: the text is tucked properly into the bounding rect and the baseline is at the correct position.

      For all other fonts in the example, the text does not align with the bounding rect and/or the baseline.

        1. drawText overload.png
          62 kB
          Niklas Wenzel
        2. drawText overload + FreeType.png
          61 kB
          Niklas Wenzel
        3. Original screenshot.png
          65 kB
          Niklas Wenzel
        4. qtbug-100304.cpp
          3 kB
          Niklas Wenzel
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            esabraha Eskil Abrahamsen Blomfeldt
            nikwen Niklas Wenzel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes