已安装的字体列表OS X / C [英] List of installed fonts OS X / C
本文介绍了已安装的字体列表OS X / C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图以编程方式获取C或Python中已安装字体的列表。我需要能够在OS X上做到这一点,有没有人知道如何?安装PyObjC的Python(这是如果是Mac OS X 10.5+,那么这段代码就可以不用安装任何东西了):
import Cocoa
manager = Cocoa.NSFontManager.sharedFontManager()
font_families = list(manager.availableFontFamilies())
< (基于htw的答案)
I'm trying to programatically get a list of installed fonts in C or Python. I need to be able to do this on OS X, does anyone know how?
解决方案
Python with PyObjC installed (which is the case for Mac OS X 10.5+, so this code will work without having to install anything):
import Cocoa
manager = Cocoa.NSFontManager.sharedFontManager()
font_families = list(manager.availableFontFamilies())
(based on htw's answer)
这篇关于已安装的字体列表OS X / C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文