freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] OpenType-1.8 8dba630 1/5: [cff] Add glyph name support for C


From: Dave Arnold
Subject: [freetype2] OpenType-1.8 8dba630 1/5: [cff] Add glyph name support for CFF2 using post table
Date: Tue, 22 Nov 2016 02:08:38 +0000 (UTC)

branch: OpenType-1.8
commit 8dba6305da9d9bf3e985d67d3103afefc2fb97eb
Author: Dave Arnold <address@hidden>
Commit: Dave Arnold <address@hidden>

    [cff] Add glyph name support for CFF2 using post table
    
    Temporarily make sfnt_get_glyph_name() extern
    Need to replace this with service interface.
---
 src/cff/cffdrivr.c  |   26 +++++++++++++++++++++-----
 src/sfnt/sfdriver.c |    4 ++--
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index b03dacb..4a2d7d9 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -38,6 +38,17 @@
 #include "../truetype/ttgxvar.h"
 #endif
 
+/* TODO use services interface to link to these functions (in sfdriver.c) */
+  FT_EXPORT( FT_Error )
+  sfnt_get_glyph_name( TT_Face     face,
+                       FT_UInt     glyph_index,
+                       FT_Pointer  buffer,
+                       FT_UInt     buffer_max );
+  FT_EXPORT( FT_UInt )
+  sfnt_get_name_index( TT_Face     face,
+                       FT_String*  glyph_name );
+
+
 #include "cfferrs.h"
 #include "cffpic.h"
 
@@ -297,12 +308,11 @@
     FT_Error    error;
 
 
-    /* TODO: for testing: cff2 does not have glyph names */
-    /* will need to use post table method */
+    /* CFF2 table does not have glyph names */
+    /* we need to use post table method */
     if ( font->version_major == 2 )
     {
-      FT_STRCPYN( buffer, "noname", buffer_max );
-      return FT_Err_Ok;
+      return sfnt_get_glyph_name( face, glyph_index, buffer, buffer_max );
     }
 
     if ( !font->psnames )
@@ -342,10 +352,16 @@
     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 )
+    {
+      return sfnt_get_name_index( face, glyph_name );
+    }
+
     FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
     if ( !psnames )
       return 0;
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index 47e8967..bc806d2 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -151,7 +151,7 @@
    *
    */
 
-  static FT_Error
+  FT_EXPORT_DEF( FT_Error )
   sfnt_get_glyph_name( TT_Face     face,
                        FT_UInt     glyph_index,
                        FT_Pointer  buffer,
@@ -169,7 +169,7 @@
   }
 
 
-  static FT_UInt
+  FT_EXPORT_DEF( FT_UInt )
   sfnt_get_name_index( TT_Face     face,
                        FT_String*  glyph_name )
   {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]