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.

Fixes: QTBUG-105010
Change-Id: I108baed495048783b14afca6bd4c67dc83816c17
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
(cherry picked from commit 6fa2ce92af914d8fd6ab1fc32316b14bbae0bed0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2022-08-08 09:23:09 +02:00 committed by Qt Cherry-pick Bot
parent 2ebdf562b9
commit fed79f4802

View File

@ -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;