From 6fa2ce92af914d8fd6ab1fc32316b14bbae0bed0 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 8 Aug 2022 09:23:09 +0200 Subject: Freetype: Fix underline thickness for bitmap fonts For non-scalable fonts, we calculate the underline thickness based on the font size. To make the lines slightly thicker for bold fonts, we also multiply a fraction of the weight of the font into it. In Qt 6, however, the weight scale was multiplied by 10, but the formula was not updated, hence all underlines for bitmap fonts would be 10x too thick. Pick-to: 6.2 6.3 6.4 Fixes: QTBUG-105010 Change-Id: I108baed495048783b14afca6bd4c67dc83816c17 Reviewed-by: Jonas Karlsson --- src/gui/text/freetype/qfontengine_ft.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/freetype/qfontengine_ft.cpp b/src/gui/text/freetype/qfontengine_ft.cpp index a7892f95b6..07f5049ff6 100644 --- a/src/gui/text/freetype/qfontengine_ft.cpp +++ b/src/gui/text/freetype/qfontengine_ft.cpp @@ -799,7 +799,7 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format, } else { // ad hoc algorithm int score = fontDef.weight * fontDef.pixelSize; - line_thickness = score / 700; + line_thickness = score / 7000; // looks better with thicker line for small pointsizes if (line_thickness < 2 && score >= 1050) line_thickness = 2; -- cgit v1.2.3