I'm using 2 font families with DTCoreText. One of them (DINPro) works fine and will show bold text as well, but the other (Charter ITC) won't show bold text.
So if I style the font like this, it stays regular:
It's the second version of this font family I've tried it with, but with no luck.
I checked the font to see if it was a registered bold like below and it was:
CTFontRef font = CTFontCreateWithName((CFStringRef)@"CharterITC-Bold", 10, NULL);
CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(font);
BOOL isItalic = ((traits & kCTFontItalicTrait) == kCTFontItalicTrait);
BOOL isBold = ((traits & kCTFontBoldTrait) == kCTFontBoldTrait);
NSLog(@"Italic: %i Bold: %i", isItalic, isBold);
Here are the fonts - http://ge.tt/2NMjlKb - if you need them to replicate the issue.
I can't find where to put them though?
Can't find any examples in the example app.
I inspected these fonts and replicated your issue. The root cause is that the regular font face CharterITC-Regu also has the bold trait set. This is a mistake in the font, IMHO.
I recommend any way that you register your custom fonts in the global override table. This way DTCoreTextFontDescriptor can do a quick lookup of the face name from the combination of family, bold and italic flags instead of having to search font tables.
Add this at the launch of your app:
[DTCoreTextFontDescriptor setOverrideFontName:@"CharterITC-Bold" forFontFamily:@"Charter ITC" bold:YES italic:NO];
[DTCoreTextFontDescriptor setOverrideFontName:@"CharterITC-BoldItal" forFontFamily:@"Charter ITC" bold:YES italic:YES];
With this setup the following test came out correctly.
I explained all this in more detail in a blog post
Thanks for checking.
I ended up using Fontographer for Mac to change the font trait set (regular font was set to medium). Thanks for he tip anyway!
You should still use the overrides for performance