Mil*_*les 13
安装了PyObjC的Python(适用于Mac OS X 10.5+的情况,因此这段代码无需安装任何东西即可运行):
import Cocoa
manager = Cocoa.NSFontManager.sharedFontManager()
font_families = list(manager.availableFontFamilies())
Run Code Online (Sandbox Code Playgroud)
(根据htw的回答)
为什么不使用终端?
系统字体:
ls -R /System/Library/Fonts | grep ttf
Run Code Online (Sandbox Code Playgroud)
用户字体:
ls -R ~/Library/Fonts | grep ttf
Run Code Online (Sandbox Code Playgroud)
Mac OS X默认字体:
ls -R /Library/Fonts | grep ttf
Run Code Online (Sandbox Code Playgroud)
如果您需要在C程序中运行它:
void main()
{
printf("System fonts: ");
execl("/bin/ls","ls -R /System/Library/Fonts | grep ttf", "-l",0);
printf("Mac OS X Default fonts: ");
execl("/bin/ls","ls -R /Library/Fonts | grep ttf", "-l",0);
printf("User fonts: ");
execl("/bin/ls","ls -R ~/Library/Fonts | grep ttf", "-l",0);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3841 次 |
| 最近记录: |