Added function FT_Get_Name_Index, used to return a glyph index for a given glyph name only if the driver supports glyph names.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index e443f7e..c7454a5 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1837,6 +1837,37 @@
/* 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 ) )
+ {
+ /* now, lookup for glyph name */
+ FT_Driver driver = face->driver;
+ FT_Module_Class* clazz = FT_MODULE_CLASS( driver );
+
+
+ if ( clazz->get_interface )
+ {
+ FT_Name_Index_Requester requester;
+
+
+ requester = (FT_Name_Index_Requester)clazz->get_interface(
+ FT_MODULE( driver ), "name_index" );
+ if ( requester )
+ result = requester( face, glyph_name );
+ }
+ }
+
+ return result;
+ }
+
+ /* documentation is in freetype.h */
+
FT_EXPORT_DEF( FT_Error )
FT_Get_Glyph_Name( FT_Face face,
FT_UInt glyph_index,