summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoger Maclean <rmaclean@qnx.com>2013-10-21 14:18:59 -0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-22 03:54:40 +0200
commit93cd08bfcc3b5b83196b6dabf859d5301cc90c98 (patch)
tree7469e61dfe0c875114b10322ca0de5fb94675ca8
parentc371680a86933a42964fcb36266806d5d69c6b86 (diff)
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>
-rw-r--r--src/gui/text/qfontengine_ft.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 328931e1eb..6e14fc23c6 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -693,7 +693,7 @@ 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))
+ if ((fontDef.weight >= QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face))
embolden = true;
// underline metrics
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;
if ((fontDef.style != QFont::StyleNormal) && !(freetype->face->style_flags & FT_STYLE_FLAG_ITALIC))
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;
if (fontDef.stretch != 100 && FT_IS_SCALABLE(freetype->face))
s |= SynthesizedStretch;