Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.15.2, 6.2.2
-
Windows 10 21H1
Description
See attached animations, taken with the attached sample project.
- 1080p-100pct-qt5.gif: Good anti-aliasing, poor kerning: "sit" has particularly big gaps
- 1080p-100pct-qt6.gif: Good anti-aliasing, poor kerning: "sit" has particularly big gaps
- 1080p-125pct-qt5.gif: Good anti-aliasing, good kerning
- 1080p-125pct-qt6.gif: Bad aliasing, good kerning
- 1080p-125pct-qt6-rounded.gif: Good anti-aliasing, good kerning
All of the animations were taken at 1080p resolution, with different variables:
- Qt version (Qt 5.15.2 or Qt 6.2.2)
- OS scaling (100% scaling or 125% scaling)
- Scale factor rounding policy (The last case has GuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Round) enabled; all others don't)
Summary
- 100% scaling produces worse kerning than 125% scaling in both Qt 5 and 6
- Qt 6 has bad aliasing at 125% scaling with default settings. Workaround: apply QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Round)
Further comments
The customer reports that only Windows seems to be affected, but it's noticeable on a variety of display hardware. Higher screen resolutions and higher DPIs make the problem less noticeable. The problem also affects QPDFWriter, not just on-screen paint devices (see attached Qt5.pdf and Qt6.pdf, produced using the attached QTBUG-100356_v2.zip)
Edit: The v2 project adds PDF printing code
Changing font size instead of scaling does produce better results, but the customer uses QPainter::scale() for complex use cases, such as exporting HTML (via QTextDocument) to a printer or a PDF file. Elements other than text (e.g. tables, images) all need to be scaled the same way, so simply changing the font size is not a solution.