开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜