shithub: freetype+ttf2subf

Download patch

ref: ff2714feca7e31b4ced901ad1eebc655dc64b67f
parent: 52371001d098686fdb227b40c5cf28198f32129f
author: Tom Kacvinsky <[email protected]>
date: Wed Aug 8 06:58:08 EDT 2001

Added function FT_Get_Name_Index, used to return a glyph index for a
given glyph name only if the driver supports glyph names.

git/fs: mount .git/fs: mount/attach disallowed
--- 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,