Font layout on iPhone?

I am using the FreeType2 library in an iPhone project, and I'm trying to just download 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 */ 

This error does not seem to be found for the file. Is / System / Library / Fonts not a font layout? Or iPhone applications simply do not have read access to this directory at all.

Thanks!

+4
source share
2 answers

To find the fonts installed on your device, download the font manifest (plist):

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

After you analyze it, you will find the entry for your font:

 Helvetica = "/System/Library/Fonts/Cache/Helvetica.ttf"; 
+3
source

They are either located in /System/Library/Fonts/ , or /System/Library/Fonts/Cache . However, I suspect that you may not have the required permissions to access these directories.

+2
source

Source: https://habr.com/ru/post/1305702/


All Articles