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

QFontMetrics::height() is not ascent() + descent() like stated

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.12.2
    • GUI: Font handling
    • None
    • Linux/X11

    Description

      Documentation for Qt 5.12.2 states that QFontMetrics::height() is not ascent() + descent() however this is not the case:

      int letterHeight = QFontMetrics(mpHost->mDisplayFont).height();
      int capHeight = QFontMetrics(mpHost->mDisplayFont).capHeight();
      int ascent = QFontMetrics(mpHost->mDisplayFont).capHeight();
      int descent = QFontMetrics(mpHost->mDisplayFont).capHeight();
      int ownLetterHeight = ascent+descent;
      qDebug() << "letterHeight:" << letterHeight << "ownLetterHeight:"<<ownLetterHeight<< "capHeight:" << capHeight << "ascent:" << ascent <<"descent:"<<descent;

      // letterHeight: 51 ownLetterHeight: 62 capHeight: 31 ascent: 31 descent: 31

      Using Bistream Vera Sans Mono with font height 12.

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            vadi Vadim Peretokin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes