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

QPrinter::PdfFormat causes some fonts to be doubly-scaled in high DPI mode?

    XMLWordPrintable

    Details

      Description

      Steps to reproduce

      1. Set your display scaling to 200%
      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 100% and repeat steps #2 - #6.

      Note: 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. two-fonts.html
          0.3 kB
        3. wrong.png
          wrong.png
          7 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            johnlayt John Layt
            Reporter:
            skoh-qt Sze Howe Koh
            Votes:
            13 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes