我正在一个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应用程序根本没有对该目录的读取权限。
谢谢!