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

Qt::AA_Use96Dpi is not respected by QWindowsFontDatabase::defaultVerticalDPI()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 5.12.0
    • GUI: Font handling
    • None
    • Windows

    Description

      While trying to run tst_QStaticText locally on windows I get a lot of failing tests (drawToPoint, scaledPainter, transformationChanged and others).
      After some investigation I found out that QStaticText is using 120dpi for the font but QPainter::drawText() on a QPixmap is using 96dpi. The 96dpi are coming from Qt::AA_Use96Dpi which will be inside QTEST_MAIN macro. This attribute is correctly honored by QStyleHelper::dpi()/dpiScaled() and qt_defaultDpiX()/qt_defaultDpiY() but not for QWindowsFontDatabase::defaultVerticalDPI() which then causes the tests to fail.

      Looks like the CI is also using 96dpi - otherwise those tests must fail there too.

      Now there are two options

      • fix QWindowsFontDatabase::defaultVerticalDPI()
      • remove Qt::AA_Use96Dpi in Qt6

      I'm for the latter but don't know if this attribute is used elsewhere outside the unittests.
      See also https://codereview.qt-project.org/c/qt/qtbase/+/256847

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            chehrlic Christian Ehrlicher
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes