Definition at line 477 of file ttpost.c.
Referenced by FT_DEFINE_SERVICE_SFNT_TABLEREC().
{
FT_Error error;
TT_Post_Names names;
FT_Fixed format;
#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
FT_Service_PsCMaps psnames;
#endif
if ( !face )
return SFNT_Err_Invalid_Face_Handle;
if ( idx >= (FT_UInt)face->max_profile.numGlyphs )
return SFNT_Err_Invalid_Glyph_Index;
#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
psnames = (FT_Service_PsCMaps)face->psnames;
if ( !psnames )
return SFNT_Err_Unimplemented_Feature;
#endif
names = &face->postscript_names;
*PSname = MAC_NAME( 0 );
format = face->postscript.FormatType;
if ( format == 0x00010000L )
{
if ( idx < 258 )
*PSname = MAC_NAME( idx );
}
else if ( format == 0x00020000L )
{
TT_Post_20 table = &names->names.format_20;
if ( !names->loaded )
{
error = load_post_names( face );
if ( error )
goto End;
}
if ( idx < (FT_UInt)table->num_glyphs )
{
FT_UShort name_index = table->glyph_indices[idx];
if ( name_index < 258 )
*PSname = MAC_NAME( name_index );
else
*PSname = (FT_String*)table->glyph_names[name_index - 258];
}
}
else if ( format == 0x00028000L )
{
TT_Post_25 table = &names->names.format_25;
if ( !names->loaded )
{
error = load_post_names( face );
if ( error )
goto End;
}
if ( idx < (FT_UInt)table->num_glyphs )
{
idx += table->offsets[idx];
*PSname = MAC_NAME( idx );
}
}
End:
return SFNT_Err_Ok;
}