00177 {
00178 CFStringRef cf_fontName;
00179 ATSFontRef ats_font_id;
00180
00181
00182 *face_index = 0;
00183
00184 cf_fontName = CFStringCreateWithCString( NULL, fontName,
00185 kCFStringEncodingMacRoman );
00186 ats_font_id = ATSFontFindFromName( cf_fontName,
00187 kATSOptionFlagsUnRestrictedScope );
00188 CFRelease( cf_fontName );
00189
00190 if ( ats_font_id == 0 || ats_font_id == 0xFFFFFFFFUL )
00191 return FT_Err_Unknown_File_Format;
00192
00193 if ( noErr != FT_ATSFontGetFileReference( ats_font_id, ats_font_ref ) )
00194 return FT_Err_Unknown_File_Format;
00195
00196
00197
00198 {
00199 ATSFontRef id2 = ats_font_id - 1;
00200 FSRef ref2;
00201
00202
00203 while ( id2 > 0 )
00204 {
00205 if ( noErr != FT_ATSFontGetFileReference( id2, &ref2 ) )
00206 break;
00207 if ( noErr != FSCompareFSRefs( ats_font_ref, &ref2 ) )
00208 break;
00209
00210 id2 --;
00211 }
00212 *face_index = ats_font_id - ( id2 + 1 );
00213 }
00214
00215 return FT_Err_Ok;
00216 }