When rendering hinted text on Windows with DirectWrite, the goal was to keep the rendering and metrics as close to GDI as possible, minimizing the impact of changing the default font backend. Therefore, the DWRITE_RENDERING_MODE_GDI_CLASSIC was always preferred when hinting was on. However, DWRITE_RENDERING_MODE_GDI_CLASSIC only applies antialiasing in the horizontal direction, but GDI applies vertical antialiasing as well. The result is that text will look more aliased with DirectWrite than it did with GDI, which arguably looks ugly especially at large sizes and can be perceived as a regression. Microsoft documentation recommends using symmetric antialiasing when the pixel size exceeds 16, so this patch enables DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC for fonts larger than 16px regardless of whether hinting is on. It's worth noting that for fonts with heavy hinting, such as Times New Roman, the rendering using DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC is different from GDI, although more similar to Freetype. However, the impact of not having vertical antialiasing is worse and as native apps are moving towards using DirectWrite, the GDI rendering is not going to be the definition of a "native" look anymore. A second thing to note in this patch is that we always pass in false for the useGdiNatural argument in GetGdiCompatibleGlyphMetrics(). According to the documentation, we should be passing in true for text rendered with CLEARTYPE_NATURAL_QUALITY. However, doing this causes wider kerning in certain cases. Since the tighter kerning matches the layouts we get in native apps, as well as when using Freetype, I've chosen to pass false for now, to be consistent. This change also adds a manual test which can be used to switch between DirectWrite, GDI and Freetype rendering on Windows, so that it's easy to compare. [ChangeLog][Windows] Improved hinted text rendering at font sizes larger than 16px. Pick-to: 6.8 Fixes: QTBUG-131946 Change-Id: Iebbe5c7affe7df6266ade6b161c31bde3d2caa84 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 407a98d94fb05780f30e77463fb2bd535041a044) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
…
Description
Languages
C++
84.3%
HTML
4.9%
C
3.9%
CMake
3.6%
Objective-C++
2%
Other
0.8%