iphone - 字体在 iPhone 上的位置?

标签 iphone fonts filesystems freetype2

我正在 iPhone 项目中使用 FreeType2 库,并且如果可能的话,我尝试简单地从系统加载 TTF 文件。

FT_Library  library;
FT_Face face;
int error;


error = FT_Init_FreeType( &library );

if ( error == 0 )
     printf("Initialized FreeType2\r\n");   /* Prints */

error = FT_New_Face(library, "/System/Library/Fonts/Helvetica.ttf", 0, &face);

if ( error ==  FT_Err_Cannot_Open_Resource )
    printf("Font not found\r\n");         /* Prints */

该错误似乎是因为找不到文件。/System/Library/Fonts 不是字体的位置吗?或者,iPhone 应用程序根本没有对该目录的任何读取访问权限吗?

谢谢!

最佳答案

要查找设备上安装的字体,请加载字体 list (plist):

NSDictionary *cgFonts = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/Fonts/CGFontCache.plist"];

解析后,您将找到适合您的字体的条目:

Helvetica = "/System/Library/Fonts/Cache/Helvetica.ttf";

关于iphone - 字体在 iPhone 上的位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2556874/

相关文章:

iphone - NSXMLParser 问题 : don't get all data?

iphone - 如何更改导航工具栏的颜色

iphone - 如何更改 slider 缩略图?

android - 如何更改选项卡 View 上的字体?

fonts - 如何使 Arch Linux 上的 Snap Store 字体显示为文本而不是空矩形?

html - 如何将下载的字体作为背景?

actionscript-3 - 有没有办法用adobe air生成快捷方式文件?

Heroku 临时文件系统和临时文件

iphone - 如何查看 iPhone 应用程序的启动时间?

file - Hadoop连接文件以递归方式维护目录结构