From e87d1a0f8246e4435019719d7502c52c14da3036 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 16 Apr 2020 13:10:39 +1000 Subject: [PATCH] Remove unused FT_Get_Name_Index --- src/freetype/cffdrivr.c | 67 +---------------------------------------- src/freetype/freetype.h | 21 ------------- src/freetype/ftobjs.c | 28 ----------------- src/freetype/sfdriver.c | 37 +---------------------- src/freetype/svgldict.h | 10 ++---- src/freetype/t1driver.c | 23 +------------- 6 files changed, 5 insertions(+), 181 deletions(-) diff --git a/src/freetype/cffdrivr.c b/src/freetype/cffdrivr.c index eb8e7863a..dbe1cf88d 100644 --- a/src/freetype/cffdrivr.c +++ b/src/freetype/cffdrivr.c @@ -313,75 +313,10 @@ } - static FT_UInt - cff_get_name_index( CFF_Face face, - FT_String* glyph_name ) - { - CFF_Font cff; - CFF_Charset charset; - FT_Service_PsCMaps psnames; - FT_String* name; - FT_UShort sid; - FT_UInt i; - - - cff = (CFF_FontRec *)face->extra.data; - charset = &cff->charset; - - /* CFF2 table does not have glyph names; */ - /* we need to use `post' table method */ - if ( cff->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->name_index ) - return service->name_index( FT_FACE( face ), glyph_name ); - else - { - FT_ERROR(( "cff_get_name_index:" - " cannot get glyph index from a CFF2 font\n" - " " - " without the `PSNames' module\n" )); - return 0; - } - } - - FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); - if ( !psnames ) - return 0; - - for ( i = 0; i < cff->num_glyphs; i++ ) - { - sid = charset->sids[i]; - - if ( sid > 390 ) - name = cff_index_get_string( cff, sid - 391 ); - else - name = (FT_String *)psnames->adobe_std_strings( sid ); - - if ( !name ) - continue; - - if ( !ft_strcmp( glyph_name, name ) ) - return i; - } - - return 0; - } - - FT_DEFINE_SERVICE_GLYPHDICTREC( cff_service_glyph_dict, - (FT_GlyphDict_GetNameFunc) cff_get_glyph_name, /* get_name */ - (FT_GlyphDict_NameIndexFunc)cff_get_name_index /* name_index */ + (FT_GlyphDict_GetNameFunc) cff_get_glyph_name /* get_name */ ) diff --git a/src/freetype/freetype.h b/src/freetype/freetype.h index f20820779..239c6f995 100644 --- a/src/freetype/freetype.h +++ b/src/freetype/freetype.h @@ -3352,27 +3352,6 @@ FT_BEGIN_HEADER FT_Parameter* properties ); - /*************************************************************************/ - /* */ - /* */ - /* FT_Get_Name_Index */ - /* */ - /* */ - /* Return the glyph index of a given glyph name. */ - /* */ - /* */ - /* face :: A handle to the source face object. */ - /* */ - /* glyph_name :: The glyph name. */ - /* */ - /* */ - /* The glyph index. 0~means `undefined character code'. */ - /* */ - FT_EXPORT( FT_UInt ) - FT_Get_Name_Index( FT_Face face, - FT_String* glyph_name ); - - /************************************************************************* * * @macro: diff --git a/src/freetype/ftobjs.c b/src/freetype/ftobjs.c index 5157310d1..2d9fcde39 100644 --- a/src/freetype/ftobjs.c +++ b/src/freetype/ftobjs.c @@ -2801,34 +2801,6 @@ } - /* documentation is in freetype.h */ - - FT_EXPORT_DEF( FT_UInt ) - FT_Get_Name_Index( FT_Face face, - FT_String* glyph_name ) - { - FT_UInt result = 0; - - - if ( face && - FT_HAS_GLYPH_NAMES( face ) && - glyph_name ) - { - FT_Service_GlyphDict service; - - - FT_FACE_LOOKUP_SERVICE( face, - service, - GLYPH_DICT ); - - if ( service && service->name_index ) - result = service->name_index( face, glyph_name ); - } - - return result; - } - - /* documentation is in freetype.h */ FT_EXPORT_DEF( FT_Error ) diff --git a/src/freetype/sfdriver.c b/src/freetype/sfdriver.c index 177c61e4b..119c822b9 100644 --- a/src/freetype/sfdriver.c +++ b/src/freetype/sfdriver.c @@ -169,45 +169,10 @@ } - static FT_UInt - sfnt_get_name_index( FT_Face face, - FT_String* glyph_name ) - { - TT_Face ttface = (TT_Face)face; - - FT_UInt i, max_gid = FT_UINT_MAX; - - - if ( face->num_glyphs < 0 ) - return 0; - else if ( (FT_ULong)face->num_glyphs < FT_UINT_MAX ) - max_gid = (FT_UInt)face->num_glyphs; - else - FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08x\n", - FT_UINT_MAX, face->num_glyphs )); - - for ( i = 0; i < max_gid; i++ ) - { - FT_String* gname; - FT_Error error = tt_face_get_ps_name( ttface, i, &gname ); - - - if ( error ) - continue; - - if ( !ft_strcmp( glyph_name, gname ) ) - return i; - } - - return 0; - } - - FT_DEFINE_SERVICE_GLYPHDICTREC( sfnt_service_glyph_dict, - (FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name, /* get_name */ - (FT_GlyphDict_NameIndexFunc)sfnt_get_name_index /* name_index */ + (FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name /* get_name */ ) #endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ diff --git a/src/freetype/svgldict.h b/src/freetype/svgldict.h index d401a4382..190c96b10 100644 --- a/src/freetype/svgldict.h +++ b/src/freetype/svgldict.h @@ -40,24 +40,18 @@ FT_BEGIN_HEADER FT_Pointer buffer, FT_UInt buffer_max ); - typedef FT_UInt - (*FT_GlyphDict_NameIndexFunc)( FT_Face face, - FT_String* glyph_name ); - FT_DEFINE_SERVICE( GlyphDict ) { FT_GlyphDict_GetNameFunc get_name; - FT_GlyphDict_NameIndexFunc name_index; /* optional */ }; #define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \ - get_name_, \ - name_index_ ) \ + get_name_ ) \ static const FT_Service_GlyphDictRec class_ = \ { \ - get_name_, name_index_ \ + get_name_ \ }; /* */ diff --git a/src/freetype/t1driver.c b/src/freetype/t1driver.c index 21ea08251..2b175fb62 100644 --- a/src/freetype/t1driver.c +++ b/src/freetype/t1driver.c @@ -62,30 +62,9 @@ } - static FT_UInt - t1_get_name_index( T1_Face face, - FT_String* glyph_name ) - { - FT_Int i; - - - for ( i = 0; i < face->type1.num_glyphs; i++ ) - { - FT_String* gname = face->type1.glyph_names[i]; - - - if ( !ft_strcmp( glyph_name, gname ) ) - return (FT_UInt)i; - } - - return 0; - } - - static const FT_Service_GlyphDictRec t1_service_glyph_dict = { - (FT_GlyphDict_GetNameFunc) t1_get_glyph_name, /* get_name */ - (FT_GlyphDict_NameIndexFunc)t1_get_name_index /* name_index */ + (FT_GlyphDict_GetNameFunc) t1_get_glyph_name /* get_name */ };