如何从CGFont或CTFont对象获取NSFont对象? [英] How do I get an NSFont object from a CGFont or CTFont object?

查看:64
本文介绍了如何从CGFont或CTFont对象获取NSFont对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理仅从Resource加载TTF的问题。 此问题帮助我回答了第1部分。但是现在我需要CGFont或CTFont的NSFont。

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.

这是仅适用于Mac的应用程序。

This is for a Mac only application.

推荐答案

如何从CGFont获取NSFont



使用 CTFontCreateWithGraphicsFont

什么都不做。您已经有一个。 NSFont和CTFont是免费的桥接,因此CTFont是NSFont,反之亦然。

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

这篇关于如何从CGFont或CTFont对象获取NSFont对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆