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 <jonas.karlsson@qt.io>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2022-08-08 09:23:09 +02:00
parent 5a76837a7f
commit 6fa2ce92af

View File

@ -799,7 +799,7 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
} else { } else {
// ad hoc algorithm // ad hoc algorithm
int score = fontDef.weight * fontDef.pixelSize; int score = fontDef.weight * fontDef.pixelSize;
line_thickness = score / 700; line_thickness = score / 7000;
// looks better with thicker line for small pointsizes // looks better with thicker line for small pointsizes
if (line_thickness < 2 && score >= 1050) if (line_thickness < 2 && score >= 1050)
line_thickness = 2; line_thickness = 2;