summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine_coretext.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qfontengine_coretext.mm')
-rw-r--r--src/gui/text/qfontengine_coretext.mm7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm
index 24bd750e80..737edc3a8c 100644
--- a/src/gui/text/qfontengine_coretext.mm
+++ b/src/gui/text/qfontengine_coretext.mm
@@ -100,7 +100,12 @@ QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(const QCFString &name, const
QCFType<CTFontDescriptorRef> descriptor = CTFontDescriptorCreateWithNameAndSize(name, fontDef.pixelSize);
QCFType<CTFontRef> baseFont = CTFontCreateWithFontDescriptor(descriptor, fontDef.pixelSize, &transform);
- ctfont = CTFontCreateCopyWithSymbolicTraits(baseFont, fontDef.pixelSize, &transform, symbolicTraits, symbolicTraits);
+ ctfont = NULL;
+ // There is a side effect in Core Text: if we apply 0 as symbolic traits to a font in normal weight,
+ // we will get the light version of that font (while the way supposed to work doesn't:
+ // setting kCTFontWeightTrait to some value between -1.0 to 0.0 has no effect on font selection)
+ if (fontDef.weight != QFont::Normal || symbolicTraits)
+ ctfont = CTFontCreateCopyWithSymbolicTraits(baseFont, fontDef.pixelSize, &transform, symbolicTraits, symbolicTraits);
// CTFontCreateCopyWithSymbolicTraits returns NULL if we ask for a trait that does
// not exist for the given font. (for example italic)