How do I find the plain version of a font in Core Text?
I'm using CTFontCreateCopyWithSymbolicTraits
to create a CTFontRef
with an italic version (k开发者_如何学JAVACTFontItalicTrait
). Is there a way of taking the same italic font and using CTFontCreateCopyWithSymbolicTraits
to set it back to the plain version again?
Thanks!
Specify the trait you want to remove in the mask, and 0 for the value, like this:
CTFontRef normalFont
= CTFontCreateCopyWithSymbolicTraits(italicFont, // italic font
0, // keep size
NULL, // keep matrix
0, // value = 0
kCTFontItalicTrait); // mask = italic
精彩评论