From 52743057d4f462c3a8edfc9597f3ad6194d5a357 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 23 Aug 2021 12:22:14 +0200 Subject: [PATCH] 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. Fixes: QTBUG-94529 Change-Id: Id2c88f0a145776151be0399ee646f28b3bdf9072 Reviewed-by: Thomas Hartmann Reviewed-by: Lars Knoll (cherry picked from commit 1971250de5729386d2ac4ebb1b99c4b84d195a6a) Reviewed-by: Qt Cherry-pick Bot --- src/gui/text/qfontengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 2dbed7383fd..72f90ae53bd 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -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