mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -04:00
Remove unused FT_Get_Name_Index
This commit is contained in:
parent
2d494f79f0
commit
e87d1a0f82
@ -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(
|
FT_DEFINE_SERVICE_GLYPHDICTREC(
|
||||||
cff_service_glyph_dict,
|
cff_service_glyph_dict,
|
||||||
|
|
||||||
(FT_GlyphDict_GetNameFunc) cff_get_glyph_name, /* get_name */
|
(FT_GlyphDict_GetNameFunc) cff_get_glyph_name /* get_name */
|
||||||
(FT_GlyphDict_NameIndexFunc)cff_get_name_index /* name_index */
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -3352,27 +3352,6 @@ FT_BEGIN_HEADER
|
|||||||
FT_Parameter* properties );
|
FT_Parameter* properties );
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Function> */
|
|
||||||
/* FT_Get_Name_Index */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* Return the glyph index of a given glyph name. */
|
|
||||||
/* */
|
|
||||||
/* <Input> */
|
|
||||||
/* face :: A handle to the source face object. */
|
|
||||||
/* */
|
|
||||||
/* glyph_name :: The glyph name. */
|
|
||||||
/* */
|
|
||||||
/* <Return> */
|
|
||||||
/* The glyph index. 0~means `undefined character code'. */
|
|
||||||
/* */
|
|
||||||
FT_EXPORT( FT_UInt )
|
|
||||||
FT_Get_Name_Index( FT_Face face,
|
|
||||||
FT_String* glyph_name );
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
*
|
*
|
||||||
* @macro:
|
* @macro:
|
||||||
|
@ -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 */
|
/* documentation is in freetype.h */
|
||||||
|
|
||||||
FT_EXPORT_DEF( FT_Error )
|
FT_EXPORT_DEF( FT_Error )
|
||||||
|
@ -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(
|
FT_DEFINE_SERVICE_GLYPHDICTREC(
|
||||||
sfnt_service_glyph_dict,
|
sfnt_service_glyph_dict,
|
||||||
|
|
||||||
(FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name, /* get_name */
|
(FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name /* get_name */
|
||||||
(FT_GlyphDict_NameIndexFunc)sfnt_get_name_index /* name_index */
|
|
||||||
)
|
)
|
||||||
|
|
||||||
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
|
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
|
||||||
|
@ -40,24 +40,18 @@ FT_BEGIN_HEADER
|
|||||||
FT_Pointer buffer,
|
FT_Pointer buffer,
|
||||||
FT_UInt buffer_max );
|
FT_UInt buffer_max );
|
||||||
|
|
||||||
typedef FT_UInt
|
|
||||||
(*FT_GlyphDict_NameIndexFunc)( FT_Face face,
|
|
||||||
FT_String* glyph_name );
|
|
||||||
|
|
||||||
|
|
||||||
FT_DEFINE_SERVICE( GlyphDict )
|
FT_DEFINE_SERVICE( GlyphDict )
|
||||||
{
|
{
|
||||||
FT_GlyphDict_GetNameFunc get_name;
|
FT_GlyphDict_GetNameFunc get_name;
|
||||||
FT_GlyphDict_NameIndexFunc name_index; /* optional */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \
|
#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \
|
||||||
get_name_, \
|
get_name_ ) \
|
||||||
name_index_ ) \
|
|
||||||
static const FT_Service_GlyphDictRec class_ = \
|
static const FT_Service_GlyphDictRec class_ = \
|
||||||
{ \
|
{ \
|
||||||
get_name_, name_index_ \
|
get_name_ \
|
||||||
};
|
};
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
@ -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 =
|
static const FT_Service_GlyphDictRec t1_service_glyph_dict =
|
||||||
{
|
{
|
||||||
(FT_GlyphDict_GetNameFunc) t1_get_glyph_name, /* get_name */
|
(FT_GlyphDict_GetNameFunc) t1_get_glyph_name /* get_name */
|
||||||
(FT_GlyphDict_NameIndexFunc)t1_get_name_index /* name_index */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user