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

♀尐吖头ヾ 提交于 2019-12-18 16:32:27

问题


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 application.


回答1:


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.



来源:https://stackoverflow.com/questions/4942711/how-do-i-get-an-nsfont-object-from-a-cgfont-or-ctfont-object

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!