Freetype font engine: Restrict bold depending on OS2 weight class.
Limit setting bold to weights <=750. Task-number: QTBUG-48922 Change-Id: Id38b636698e58b0686dda9711ee1b3426a3b45b9 Reviewed-by: Gunnar Roth <gunnar.roth@gmx.net> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
This commit is contained in:
parent
de7d2eb2ad
commit
d508c6697b
@ -717,8 +717,12 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
|
||||
FT_Set_Transform(face, &matrix, 0);
|
||||
freetype->matrix = matrix;
|
||||
// fake bold
|
||||
if ((fontDef.weight >= QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face))
|
||||
embolden = true;
|
||||
if ((fontDef.weight >= QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face)) {
|
||||
if (const TT_OS2 *os2 = reinterpret_cast<const TT_OS2 *>(FT_Get_Sfnt_Table(face, ft_sfnt_os2))) {
|
||||
if (os2->usWeightClass < 750)
|
||||
embolden = true;
|
||||
}
|
||||
}
|
||||
// underline metrics
|
||||
line_thickness = QFixed::fromFixed(FT_MulFix(face->underline_thickness, face->size->metrics.y_scale));
|
||||
underline_position = QFixed::fromFixed(-FT_MulFix(face->underline_position, face->size->metrics.y_scale));
|
||||
|
Loading…
x
Reference in New Issue
Block a user