static FT_Error t1_get_glyph_name( T1_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max ) { FT_STRCPYN( buffer, face->type1.glyph_names[glyph_index], buffer_max ); return FT_Err_Ok; }
static FT_Error sfnt_get_glyph_name( TT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max ) { FT_String* gname; FT_Error error; error = tt_face_get_ps_name( face, glyph_index, &gname ); if ( !error ) FT_STRCPYN( buffer, gname, buffer_max ); return error; }
static FT_Error cff_get_glyph_name( CFF_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max ) { CFF_Font font = (CFF_Font)face->extra.data; FT_Memory memory = FT_FACE_MEMORY( face ); FT_String* gname; FT_UShort sid; FT_Service_PsCMaps psnames; FT_Error error; FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); if ( !psnames ) { FT_ERROR(( "cff_get_glyph_name:" )); FT_ERROR(( " cannot get glyph name from CFF & CEF fonts\n" )); FT_ERROR(( " " )); FT_ERROR(( " without the `PSNames' module\n" )); error = CFF_Err_Unknown_File_Format; goto Exit; } /* first, locate the sid in the charset table */ sid = font->charset.sids[glyph_index]; /* now, lookup the name itself */ gname = cff_index_get_sid_string( &font->string_index, sid, psnames ); if ( gname ) FT_STRCPYN( buffer, gname, buffer_max ); FT_FREE( gname ); error = CFF_Err_Ok; Exit: return error; }
static FT_Error cff_get_glyph_name( CFF_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max ) { CFF_Font font = (CFF_Font)face->extra.data; FT_String* gname; FT_UShort sid; FT_Error error; if ( !font->psnames ) { FT_ERROR(( "cff_get_glyph_name:" " cannot get glyph name from CFF & CEF fonts\n" " " " without the `PSNames' module\n" )); error = CFF_Err_Unknown_File_Format; goto Exit; } /* first, locate the sid in the charset table */ sid = font->charset.sids[glyph_index]; /* now, lookup the name itself */ gname = cff_index_get_sid_string( font, sid ); if ( gname ) FT_STRCPYN( buffer, gname, buffer_max ); error = CFF_Err_Ok; Exit: return error; }
static FT_Error cff_get_glyph_name( CFF_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max ) { CFF_Font font = (CFF_Font)face->extra.data; FT_String* gname; FT_UShort sid; FT_Error error; /* CFF2 table does not have glyph names; */ /* we need to use `post' table method */ if ( font->version_major == 2 ) { FT_Library library = FT_FACE_LIBRARY( face ); FT_Module sfnt_module = FT_Get_Module( library, "sfnt" ); FT_Service_GlyphDict service = (FT_Service_GlyphDict)ft_module_get_service( sfnt_module, FT_SERVICE_ID_GLYPH_DICT, 0 ); if ( service && service->get_name ) return service->get_name( FT_FACE( face ), glyph_index, buffer, buffer_max ); else { FT_ERROR(( "cff_get_glyph_name:" " cannot get glyph name from a CFF2 font\n" " " " without the `psnames' module\n" )); error = FT_THROW( Missing_Module ); goto Exit; } } if ( !font->psnames ) { FT_ERROR(( "cff_get_glyph_name:" " cannot get glyph name from CFF & CEF fonts\n" " " " without the `psnames' module\n" )); error = FT_THROW( Missing_Module ); goto Exit; } /* first, locate the sid in the charset table */ sid = font->charset.sids[glyph_index]; /* now, lookup the name itself */ gname = cff_index_get_sid_string( font, sid ); if ( gname ) FT_STRCPYN( buffer, gname, buffer_max ); error = FT_Err_Ok; Exit: return error; }