Don't set kCTFontSymbolicTrait.
This allows for requesting 'bold' and 'italic' but these requests are redundant with the 'weight' and 'slant' requests also being made. It appears that on macOS 14 and iOS 12 that setting kCTFontSymbolicTrait, particularly without setting any bits, leads to strange behavior. Since the information in kCTFontSymbolicTrait is better provided by other traits, simply remove the code which sets it and add a comment explaining why. Bug: skia:8432 Change-Id: I795c9adf4a52d828d3e92bc4af0966102f9b6cc1 Reviewed-on: https://skia-review.googlesource.com/158443 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
c90d7ae2a4
commit
9f9c2ea428
@ -812,18 +812,8 @@ static SkUniqueCFRef<CTFontDescriptorRef> create_descriptor(const char familyNam
|
||||
}
|
||||
|
||||
// CTFontTraits (symbolic)
|
||||
CTFontSymbolicTraits ctFontTraits = 0;
|
||||
if (style.weight() >= SkFontStyle::kBold_Weight) {
|
||||
ctFontTraits |= kCTFontBoldTrait;
|
||||
}
|
||||
if (style.slant() != SkFontStyle::kUpright_Slant) {
|
||||
ctFontTraits |= kCTFontItalicTrait;
|
||||
}
|
||||
SkUniqueCFRef<CFNumberRef> cfFontTraits(
|
||||
CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &ctFontTraits));
|
||||
if (cfFontTraits) {
|
||||
CFDictionaryAddValue(cfTraits.get(), kCTFontSymbolicTrait, cfFontTraits.get());
|
||||
}
|
||||
// macOS 14 and iOS 12 seem to behave badly when kCTFontSymbolicTrait is set.
|
||||
|
||||
// CTFontTraits (weight)
|
||||
CGFloat ctWeight = fontstyle_to_ct_weight(style.weight());
|
||||
SkUniqueCFRef<CFNumberRef> cfFontWeight(
|
||||
|
Loading…
Reference in New Issue
Block a user