字体在 iPhone 上的位置?
我正在 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 应用程序根本没有对该目录的任何读取访问权限吗?
谢谢!
I'm using the FreeType2 library in an iPhone project, and I'm trying to simply load a TTF file from the system, if possible.
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 */
That error seems to be for file not found. Is /System/Library/Fonts not the location of the fonts? Or, do iPhone apps simply not have any read access at all to that directory.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要查找设备上安装的字体,请加载字体清单(plist):
解析它后,您将找到您的字体的条目:
To find the fonts installed on your device, load the font manifest (a plist):
Once you parse it, you'll find the entry for your font:
它们位于
/System/Library/Fonts/
或/System/Library/Fonts/Cache
中。但是,我怀疑您可能没有访问这些目录所需的权限。They're either in
/System/Library/Fonts/
or/System/Library/Fonts/Cache
. However, I suspect that you may not have the required permissions to access those directories.