FT_EXPORT_DEF( FT_Error ) FT_New_Face( FT_Library library, const char* pathname, FT_Long face_index, FT_Face *aface ) { FT_Open_Args args; FSSpec spec; OSType file_type; /* test for valid `library' and `aface' delayed to FT_Open_Face() */ if ( !pathname ) return FT_Err_Invalid_Argument; if ( file_spec_from_path( pathname, &spec ) ) return FT_Err_Invalid_Argument; file_type = get_file_type( &spec ); if ( file_type == 'FFIL' || file_type == 'tfil' ) return FT_New_Face_From_Suitcase( library, &spec, face_index, aface ); else if ( file_type == 'LWFN' ) return FT_New_Face_From_LWFN( library, &spec, face_index, aface ); else { args.flags = ft_open_pathname; args.pathname = (char*)pathname; return FT_Open_Face( library, &args, face_index, aface ); } }
FT_New_Face( FT_Library library, const char* pathname, FT_Long face_index, FT_Face *aface ) { FT_Open_Args args; FSSpec spec; OSType file_type; /* test for valid `library' and `aface' delayed to FT_Open_Face() */ if ( !pathname ) return FT_Err_Invalid_Argument; if ( file_spec_from_path( pathname, &spec ) ) return FT_Err_Invalid_Argument; /* Regardless of type, don't try to use the resource fork if it is */ /* empty. Some TTF fonts have type `FFIL', for example, but they */ /* only have data forks. */ if ( ResourceForkSize( &spec ) != 0 ) { file_type = get_file_type( &spec ); if ( file_type == 'FFIL' || file_type == 'tfil' ) return FT_New_Face_From_Suitcase( library, &spec, face_index, aface ); if ( file_type == 'LWFN' ) return FT_New_Face_From_LWFN( library, &spec, face_index, aface ); } #if TARGET_API_MAC_CARBON if ( is_dfont( &spec ) ) return FT_New_Face_From_dfont( library, &spec, face_index, aface ); #endif /* let it fall through to normal loader (.ttf, .otf, etc.) */ args.flags = ft_open_pathname; args.pathname = (char*)pathname; return FT_Open_Face( library, &args, face_index, aface ); }