Fix default line thickness for fonts

When we are unable to get the line thickness from a font, we
fall back to calculating this based on pixel size and weight.
But the font weight scale has changed in Qt 6, causing the
calculated font weight to be 10x as thick as it should.

This happened e.g. for Titillium Web, but only when using 100%
UI scaling, because the GDI engine was unable to get the correct
line thickness from the font, whereas the DirectWrite engine
succeeded.

[ChangeLog][Windows] Fixes an issue where underlines and other
decorations would be too thick for some fonts.

Pick-to: 6.1 6.2
Fixes: QTBUG-94529
Change-Id: Id2c88f0a145776151be0399ee646f28b3bdf9072
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
bb10
Eskil Abrahamsen Blomfeldt 2021-08-23 12:22:14 +02:00
parent ec497d5e65
commit 1971250de5
1 changed files with 1 additions and 1 deletions

View File

@ -180,7 +180,7 @@ QFontEngine::~QFontEngine()
QFixed QFontEngine::lineThickness() const
{
// ad hoc algorithm
int score = fontDef.weight * fontDef.pixelSize;
int score = fontDef.weight * fontDef.pixelSize / 10;
int lw = score / 700;
// looks better with thicker line for small pointsizes