开发者

How do I get an NSFont object from a CGFont or CTFont object?

开发者 https://www.devze.com 2023-02-09 04:46 出处:网络
I am dealing with loading a TTF from Resource only. This question helped me answer part 1. But now I need a NSFont from a CGFont or CTFont.

I am dealing with loading a TTF from Resource only. This question helped me answer part 1. But now I need a NSFont from a CGFont or CTFont.

This is for a Mac only app开发者_StackOverflow中文版lication.


How to get an NSFont from a CGFont

Use CTFontCreateWithGraphicsFont.

How to get an NSFont from a CTFont

Do nothing. You already have one. NSFont and CTFont are toll-free bridged, so a CTFont is an NSFont and vice versa.

0

精彩评论

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