00797 {
00798 FT_Error error = FT_Err_Cannot_Open_Resource;
00799 ResFileRefNum res_ref;
00800 ResourceIndex res_index;
00801 Handle fond;
00802 short num_faces_in_res, num_faces_in_fond;
00803
00804
00805 if ( noErr != FT_FSPathMakeRes( pathname, &res_ref ) )
00806 return FT_Err_Cannot_Open_Resource;
00807
00808 UseResFile( res_ref );
00809 if ( ResError() )
00810 return FT_Err_Cannot_Open_Resource;
00811
00812 num_faces_in_res = 0;
00813 for ( res_index = 1; ; ++res_index )
00814 {
00815 fond = Get1IndResource( TTAG_FOND, res_index );
00816 if ( ResError() )
00817 break;
00818
00819 num_faces_in_fond = count_faces( fond, pathname );
00820 num_faces_in_res += num_faces_in_fond;
00821
00822 if ( 0 <= face_index && face_index < num_faces_in_fond && error )
00823 error = FT_New_Face_From_FOND( library, fond, face_index, aface );
00824
00825 face_index -= num_faces_in_fond;
00826 }
00827
00828 CloseResFile( res_ref );
00829 if ( FT_Err_Ok == error && NULL != aface && NULL != *aface )
00830 (*aface)->num_faces = num_faces_in_res;
00831 return error;
00832 }