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

QPrinter::PdfFormat causes some fonts to be doubly-scaled when using DirectWrite font engine

    XMLWordPrintable

Details

    • 3158068209 (qt/qtbase/dev) 3158068209 (qt/tqtc-qtbase/dev) 9ac433b40a (qt/qtbase/6.4) 5f6bc72cd5 (qt/tqtc-qtbase/6.2) 9ac433b40a (qt/tqtc-qtbase/6.4) 9ac433b40a (qt/tqtc-qtbase/6.4.1)

    Description

      Steps to reproduce

      1. Set your display scaling to 100%
      2. Open the "Text Edit" example (https://doc.qt.io/qt-6/qtwidgets-richtext-textedit-example.html) and load the attached HTML document.
      3. Visually inspect the text in the QTextEdit on screen.
      4. Click "File" > "Print..." and select "Microsoft Print to PDF". Print the PDF document and visually inspect it in a PDF viewer.
      5. Click "File" > "Export PDF...". Print the PDF document and visually inspect it in a PDF viewer.
      6. Close the example application.
      7. Set your display scaling to 200% (OR, run the application with -platform windows:fontengine=directwrite) and repeat steps #2 - #6.

      Notes:

      • Step #1 forces the use of the GDI font engine; Step #7 forces the use of the DirectWrite font engine
      • Step #4 causes QPrinter to invoke the OS' PDF printer; Step #5 causes QPrinter to invoke Qt's internal PDF printer.

       

      Outcomes

      • Correct outcome (correct.png): The "SITKA" text is a bit smaller than the "ARIAL" text. The "SITKA" text has good kerning.
      • Wrong outcome (wrong.png): The "SITKA" text is a bit bigger than the "ARIAL" text. The "SITKA" text has bad kerning – the letters touch each other.

       

      Scaling Text Source Outcome
      100% QTextEdit Correct
      100% Microsoft PDF printer Correct
      100% Qt PDF printer Correct
      200% QTextEdit Correct
      200% Microsoft PDF printer Correct
      200% Qt PDF printer WRONG

       

      Notes

      • Most fonts aren't affected by this issue. Some, like Sitka Text, are.
      • Qt 5.15 also displays this issue if  `QGuiApplication::setAttribute(Qt::AA_EnaableHighDpiScaling);` is set.

      Attachments

        1. correct.png
          correct.png
          6 kB
        2. wrong.png
          wrong.png
          7 kB
        3. two-fonts.html
          0.3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            skoh-qt Sze Howe Koh
            Votes:
            13 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes