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

Regression: QFontMetrics*::height() doens't make much sense (FreeType)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • None
    • 5.12.3
    • GUI: Text handling
    • None

    Description

      The QFontMetrics*::height() function returns ascent() + descent(), which one would think will be more or less a height of a font. The problem is that at least on Linux with FreeType engine, descent() is negative, so ascent() + descent() doesn't mean much, and it's far from being height of the font.

      I'm not sure what are origins of the change, but I'm pretty sure height() worked correctly before (in Qt 5.11 perhaps?), so that font.pixelSize() was more or less equal to QFontMetrics (font).height(). Unfortunately I can't downgrade my system now to check this without breaking all dependencies.

      The fix would be to define height() as ascent() - descent(), or… perhaps to make sure that descent() returns positive numbers (since it's defined as distance after all).

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            mcv Michał Gawron
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes