Correct handling of font weights bolder than bold.
A couple of places were checking for a font weight equal to QFont::Bold rather than a weight that is greater or equal to this. This sometimes results in QFont::Black being rendered with a lighter weight than QFont::Bold even though it should if anything be heavier. Change-Id: I5aa73a84ea2718783bbac93a031d87b2ad90012c Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
parent
c371680a86
commit
93cd08bfcc
@ -693,7 +693,7 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
|
|||||||
FT_Set_Transform(face, &matrix, 0);
|
FT_Set_Transform(face, &matrix, 0);
|
||||||
freetype->matrix = matrix;
|
freetype->matrix = matrix;
|
||||||
// fake bold
|
// fake bold
|
||||||
if ((fontDef.weight == QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face))
|
if ((fontDef.weight >= QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face))
|
||||||
embolden = true;
|
embolden = true;
|
||||||
// underline metrics
|
// underline metrics
|
||||||
line_thickness = QFixed::fromFixed(FT_MulFix(face->underline_thickness, face->size->metrics.y_scale));
|
line_thickness = QFixed::fromFixed(FT_MulFix(face->underline_thickness, face->size->metrics.y_scale));
|
||||||
@ -1165,7 +1165,7 @@ int QFontEngineFT::synthesized() const
|
|||||||
int s = 0;
|
int s = 0;
|
||||||
if ((fontDef.style != QFont::StyleNormal) && !(freetype->face->style_flags & FT_STYLE_FLAG_ITALIC))
|
if ((fontDef.style != QFont::StyleNormal) && !(freetype->face->style_flags & FT_STYLE_FLAG_ITALIC))
|
||||||
s = SynthesizedItalic;
|
s = SynthesizedItalic;
|
||||||
if ((fontDef.weight == QFont::Bold) && !(freetype->face->style_flags & FT_STYLE_FLAG_BOLD))
|
if ((fontDef.weight >= QFont::Bold) && !(freetype->face->style_flags & FT_STYLE_FLAG_BOLD))
|
||||||
s |= SynthesizedBold;
|
s |= SynthesizedBold;
|
||||||
if (fontDef.stretch != 100 && FT_IS_SCALABLE(freetype->face))
|
if (fontDef.stretch != 100 && FT_IS_SCALABLE(freetype->face))
|
||||||
s |= SynthesizedStretch;
|
s |= SynthesizedStretch;
|
||||||
|
Loading…
Reference in New Issue
Block a user