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

QFontMetricsF::boundingRect.width() different between Qt 9.5.2 and 5.15.1

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.9.2, 5.15
    • Fix Version/s: None
    • Component/s: GUI: Font handling
    • Labels:
      None
    • Platform/s:
      Windows

      Description

      Hello,

      I'm moving application from Qt 5.9.2 to 5.15.1 and while doing so noticed that fonts look different in 5.15.1.

      After testing noticed that fonts in 5.15.1 have different width and height in comparison to 5.9.2

      Doing some debugging I see that width is different, here is comparison:

      simple test code:

       

          const QString text;
          QFontMetricsF(painter.font()).boundingRect(text).width();
      

      ommited bunch of {{qDebug}}s that output this:

       

       

      qDebug 5.9.2 5.15.1
      QT_VERSION 329986 5.9.2 vs 1900 331521 5.15.1 vs: 1928
      painter hints QFlags<QPainter::RenderHint>(TextAntialiasing) QFlags<QPainter::RenderHint>(TextAntialiasing)
      painter font QFont( "Monospaced,12,-1,2,75,0,0,0,0,0" ) QFont(Monospaced,12,-1,2,75,0,0,0,0,0)
      textSize QSizeF(204, 23) QSizeF(221, 20)
      QFontMetricsF averageCharWidth 12 13
      QFontMetricsF capHeight 11.8281 20
      QFontMetricsF descent 6 4
      QFontMetricsF fontDpi NA 120
      QFontMetricsF height 23 20
      QFontMetricsF width 204 221
      QFontMetricsF horizontalAdvance NA 221
      QFontMetricsF leading 0 0
      QFontMetricsF lineSpacing 23 20
      QFontMetricsF lineWidth 2 2
      QFontMetricsF overlinePos 18 17

      What I'm interested in is from where this change in size comes from ?

      Seen this old bug: https://bugreports.qt.io/browse/QTBUG-74828 and the answer there is that changes comes from change in HARFBUZZ version. Did this lib was updated between version 5.9 -> 5.15 also ? I tried setting QT_HARFBUZZ=old for both Qt 5.9 and 5.15 but results were same as without that env. variable (width still differed).

       

      Thanks in advance for reply.

      Best regards

        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:
            lugru Łukasz Grużewski
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes