Skip to content

Commit

Permalink
FreeType: allow falling back to synthesized bold if desired
Browse files Browse the repository at this point in the history
Some users still prefer the fake bold look even if in some cases it does
not look good. So add an environment variable -
QT_NO_SYNTHESIZED_BOLD_LIMIT - to allow that fallback to stay in place.

Change-Id: I8212c1fa36edb4730b187dc4a23ea45f94981154
Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
(cherry picked from commit fa53c62)
Reviewed-by: Tuomas Vaarala <[email protected]>
  • Loading branch information
AndyShawQt committed Jan 17, 2022
1 parent 90ad5ae commit 7d9329d
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,10 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
// fake bold
if ((fontDef.weight >= QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face) && !qEnvironmentVariableIsSet("QT_NO_SYNTHESIZED_BOLD")) {
if (const TT_OS2 *os2 = reinterpret_cast<const TT_OS2 *>(FT_Get_Sfnt_Table(face, ft_sfnt_os2))) {
if (os2->usWeightClass < 700 && fontDef.pixelSize < 64)
if (os2->usWeightClass < 700 &&
(fontDef.pixelSize < 64 || qEnvironmentVariableIsSet("QT_NO_SYNTHESIZED_BOLD_LIMIT"))) {
embolden = true;
}
}
}
// underline metrics
Expand Down

0 comments on commit 7d9329d

Please sign in to comment.