freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] ewaldhew-refactor-cf2 d3f25a0 5/8: Add cffload service


From: Hew Yih Shiuan Ewald
Subject: [freetype2] ewaldhew-refactor-cf2 d3f25a0 5/8: Add cffload service
Date: Mon, 5 Jun 2017 03:20:42 -0400 (EDT)

branch: ewaldhew-refactor-cf2
commit d3f25a041872f55358c78e1df0dadae37cee42d9
Author: Ewald Hew <address@hidden>
Commit: Ewald Hew <address@hidden>

    Add cffload service
---
 include/freetype/internal/ftserv.h           |  2 +-
 include/freetype/internal/services/svcfftl.h | 94 ++++++++++++++++++++++++++++
 src/cff/cffdrivr.c                           | 36 ++++++++---
 src/cff/cffload.h                            | 18 +++---
 src/cff/cffobjs.c                            |  7 ++-
 src/cff/cffparse.c                           | 21 ++++---
 src/cff/cffpic.h                             |  5 +-
 src/cff/cfftypes.h                           |  3 +
 src/psaux/cf2font.c                          | 17 ++---
 src/psaux/cf2font.h                          |  5 +-
 src/psaux/cf2ft.c                            | 15 ++++-
 src/psaux/cf2intrp.c                         | 20 +++---
 src/psaux/cffdecode.c                        | 25 +++++++-
 13 files changed, 213 insertions(+), 55 deletions(-)

diff --git a/include/freetype/internal/ftserv.h 
b/include/freetype/internal/ftserv.h
index 8a4477c..23f2878 100644
--- a/include/freetype/internal/ftserv.h
+++ b/include/freetype/internal/ftserv.h
@@ -1004,7 +1004,7 @@ FT_BEGIN_HEADER
 #define FT_SERVICE_WINFNT_H             <freetype/internal/services/svwinfnt.h>
 #define FT_SERVICE_FONT_FORMAT_H        <freetype/internal/services/svfntfmt.h>
 #define FT_SERVICE_TRUETYPE_GLYF_H      <freetype/internal/services/svttglyf.h>
-
+#define FT_SERVICE_CFF_TABLE_LOAD_H     <freetype/internal/services/svcfftl.h>
  /* */
 
 FT_END_HEADER
diff --git a/include/freetype/internal/services/svcfftl.h 
b/include/freetype/internal/services/svcfftl.h
new file mode 100644
index 0000000..6270bcf
--- /dev/null
+++ b/include/freetype/internal/services/svcfftl.h
@@ -0,0 +1,94 @@
+#ifndef SVCFFTL_H_
+#define SVCFFTL_H_
+
+#include FT_INTERNAL_SERVICE_H
+
+
+FT_BEGIN_HEADER
+
+
+#define FT_SERVICE_ID_CFF_LOAD  "cff-load"
+
+
+  typedef FT_UShort 
+  (*FT_Get_Standard_Encoding_Func)( FT_UInt  charcode );
+
+  typedef FT_Error
+  (*FT_Load_Private_Dict_Func)( CFF_Font     font,
+                                CFF_SubFont  subfont,
+                                FT_UInt      lenNDV,
+                                FT_Fixed*    NDV );
+
+  typedef FT_Byte
+  (*FT_FD_Select_Get_Func)( CFF_FDSelect  fdselect,
+                            FT_UInt       glyph_index );
+
+  typedef FT_Bool
+  (*FT_Blend_Check_Vector_Func)( CFF_Blend  blend,
+                                 FT_UInt    vsindex,
+                                 FT_UInt    lenNDV,
+                                 FT_Fixed*  NDV );
+
+  typedef FT_Error
+  (*FT_Blend_Build_Vector_Func)( CFF_Blend  blend,
+                                 FT_UInt    vsindex,
+                                 FT_UInt    lenNDV,
+                                 FT_Fixed*  NDV );
+
+
+  FT_DEFINE_SERVICE( CFFLoad )
+  {
+    FT_Get_Standard_Encoding_Func  get_standard_encoding;
+    FT_Load_Private_Dict_Func      load_private_dict;
+    FT_FD_Select_Get_Func          fd_select_get;
+    FT_Blend_Check_Vector_Func     blend_check_vector;
+    FT_Blend_Build_Vector_Func     blend_build_vector;
+  };
+
+
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_SERVICE_CFFLOADREC( class_,                  \
+                                      get_standard_encoding_,  \
+                                      load_private_dict_,      \
+                                      fd_select_get_,          \
+                                      blend_check_vector_,     \
+                                      blend_build_vector_ )    \
+  static const FT_Service_CFFLoadRec  class_ =                 \
+  {                                                            \
+    get_standard_encoding_,                                    \
+    load_private_dict_,                                        \
+    fd_select_get_,                                            \
+    blend_check_vector_,                                       \
+    blend_build_vector_                                        \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#define FT_DEFINE_SERVICE_CFFLOADREC( class_,                  \
+                                      get_standard_encoding_,  \
+                                      load_private_dict_,      \
+                                      fd_select_get_,          \
+                                      blend_check_vector_,     \
+                                      blend_build_vector_ )    \
+  void                                                         \
+  FT_Init_Class_ ## class_( FT_Service_CFFLoadRec*  clazz )    \
+  {                                                            \
+    clazz->get_standard_encoding = get_standard_encoding_;     \
+    clazz->load_private_dict     = load_private_dict_;         \
+    clazz->fd_select_get         = fd_select_get_;             \
+    clazz->blend_check_vector    = blend_check_vector_;        \
+    clazz->blend_build_vector    = blend_build_vector_;        \
+  }
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+
+
+FT_END_HEADER
+
+#endif
+
+
+/* END */
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 38bfc2c..689f229 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -25,6 +25,7 @@
 #include FT_SERVICE_POSTSCRIPT_INFO_H
 #include FT_SERVICE_POSTSCRIPT_NAME_H
 #include FT_SERVICE_TT_CMAP_H
+#include FT_SERVICE_CFF_TABLE_LOAD_H
 
 #include "cffdrivr.h"
 #include "cffgload.h"
@@ -1088,6 +1089,21 @@
 #endif
 
 
+  /*
+   *  CFFLOAD SERVICE
+   *
+   */
+
+  FT_DEFINE_SERVICE_CFFLOADREC(
+    cff_service_cff_load,
+
+    (FT_Get_Standard_Encoding_Func) cff_get_standard_encoding,
+    (FT_Load_Private_Dict_Func)     cff_load_private_dict,
+    (FT_FD_Select_Get_Func)         cff_fd_select_get,
+    (FT_Blend_Check_Vector_Func)    cff_blend_check_vector,
+    (FT_Blend_Build_Vector_Func)    cff_blend_build_vector
+  )
+
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
@@ -1102,7 +1118,7 @@
 
 #if !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES && \
      defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
-  FT_DEFINE_SERVICEDESCREC9(
+  FT_DEFINE_SERVICEDESCREC10(
     cff_services,
 
     FT_SERVICE_ID_FONT_FORMAT,          FT_FONT_FORMAT_CFF,
@@ -1113,10 +1129,11 @@
     FT_SERVICE_ID_GLYPH_DICT,           &CFF_SERVICE_GLYPH_DICT_GET,
     FT_SERVICE_ID_TT_CMAP,              &CFF_SERVICE_GET_CMAP_INFO_GET,
     FT_SERVICE_ID_CID,                  &CFF_SERVICE_CID_INFO_GET,
-    FT_SERVICE_ID_PROPERTIES,           &CFF_SERVICE_PROPERTIES_GET
+    FT_SERVICE_ID_PROPERTIES,           &CFF_SERVICE_PROPERTIES_GET,
+    FT_SERVICE_ID_CFF_LOAD,             &CFF_SERVICE_CFF_LOAD_GET
   )
 #elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES
-  FT_DEFINE_SERVICEDESCREC7(
+  FT_DEFINE_SERVICEDESCREC8(
     cff_services,
 
     FT_SERVICE_ID_FONT_FORMAT,          FT_FONT_FORMAT_CFF,
@@ -1125,10 +1142,11 @@
     FT_SERVICE_ID_GLYPH_DICT,           &CFF_SERVICE_GLYPH_DICT_GET,
     FT_SERVICE_ID_TT_CMAP,              &CFF_SERVICE_GET_CMAP_INFO_GET,
     FT_SERVICE_ID_CID,                  &CFF_SERVICE_CID_INFO_GET,
-    FT_SERVICE_ID_PROPERTIES,           &CFF_SERVICE_PROPERTIES_GET
+    FT_SERVICE_ID_PROPERTIES,           &CFF_SERVICE_PROPERTIES_GET,
+    FT_SERVICE_ID_CFF_LOAD,             &CFF_SERVICE_CFF_LOAD_GET
   )
 #elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
-  FT_DEFINE_SERVICEDESCREC8(
+  FT_DEFINE_SERVICEDESCREC9(
     cff_services,
 
     FT_SERVICE_ID_FONT_FORMAT,          FT_FONT_FORMAT_CFF,
@@ -1138,10 +1156,11 @@
     FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
     FT_SERVICE_ID_TT_CMAP,              &CFF_SERVICE_GET_CMAP_INFO_GET,
     FT_SERVICE_ID_CID,                  &CFF_SERVICE_CID_INFO_GET,
-    FT_SERVICE_ID_PROPERTIES,           &CFF_SERVICE_PROPERTIES_GET
+    FT_SERVICE_ID_PROPERTIES,           &CFF_SERVICE_PROPERTIES_GET,
+    FT_SERVICE_ID_CFF_LOAD,             &CFF_SERVICE_CFF_LOAD_GET
   )
 #else
-  FT_DEFINE_SERVICEDESCREC6(
+  FT_DEFINE_SERVICEDESCREC7(
     cff_services,
 
     FT_SERVICE_ID_FONT_FORMAT,          FT_FONT_FORMAT_CFF,
@@ -1149,7 +1168,8 @@
     FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
     FT_SERVICE_ID_TT_CMAP,              &CFF_SERVICE_GET_CMAP_INFO_GET,
     FT_SERVICE_ID_CID,                  &CFF_SERVICE_CID_INFO_GET,
-    FT_SERVICE_ID_PROPERTIES,           &CFF_SERVICE_PROPERTIES_GET
+    FT_SERVICE_ID_PROPERTIES,           &CFF_SERVICE_PROPERTIES_GET,
+    FT_SERVICE_ID_CFF_LOAD,             &CFF_SERVICE_CFF_LOAD_GET
   )
 #endif
 
diff --git a/src/cff/cffload.h b/src/cff/cffload.h
index b4b4456..e079cef 100644
--- a/src/cff/cffload.h
+++ b/src/cff/cffload.h
@@ -28,7 +28,7 @@
 
 FT_BEGIN_HEADER
 
-  //TODO(ewaldhew): !! used in psaux
+
   FT_LOCAL( FT_UShort )
   cff_get_standard_encoding( FT_UInt  charcode );
 
@@ -41,13 +41,12 @@ FT_BEGIN_HEADER
   cff_index_get_sid_string( CFF_Font  font,
                             FT_UInt   sid );
 
-  //!!
   FT_LOCAL( FT_Error )
   cff_index_access_element( CFF_Index  idx,
                             FT_UInt    element,
                             FT_Byte**  pbytes,
                             FT_ULong*  pbyte_len );
-  //!!
+
   FT_LOCAL( void )
   cff_index_forget_element( CFF_Index  idx,
                             FT_Byte**  pbytes );
@@ -61,7 +60,7 @@ FT_BEGIN_HEADER
   cff_charset_cid_to_gindex( CFF_Charset  charset,
                              FT_UInt      cid );
 
-  //!!
+
   FT_LOCAL( FT_UInt32 )
   cff_random( FT_UInt32  r );
 
@@ -77,29 +76,29 @@ FT_BEGIN_HEADER
   FT_LOCAL( void )
   cff_font_done( CFF_Font  font );
 
-  //!!
+
   FT_LOCAL( FT_Error )
   cff_load_private_dict( CFF_Font     font,
                          CFF_SubFont  subfont,
                          FT_UInt      lenNDV,
                          FT_Fixed*    NDV );
-  //!!
+
   FT_LOCAL( FT_Byte )
   cff_fd_select_get( CFF_FDSelect  fdselect,
                      FT_UInt       glyph_index );
-  //!!
+
   FT_LOCAL( FT_Bool )
   cff_blend_check_vector( CFF_Blend  blend,
                           FT_UInt    vsindex,
                           FT_UInt    lenNDV,
                           FT_Fixed*  NDV );
-  //!!
+
   FT_LOCAL( FT_Error )
   cff_blend_build_vector( CFF_Blend  blend,
                           FT_UInt    vsindex,
                           FT_UInt    lenNDV,
                           FT_Fixed*  NDV );
-  //!!
+
   FT_LOCAL( void )
   cff_blend_clear( CFF_SubFont  subFont );
 
@@ -109,7 +108,6 @@ FT_BEGIN_HEADER
                      FT_UInt      numBlends );
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-  //!!
   FT_LOCAL( FT_Error )
   cff_get_var_blend( CFF_Face     face,
                      FT_UInt     *num_coords,
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 7b660b0..bd1b33e 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -32,6 +32,7 @@
 #include FT_SERVICE_MULTIPLE_MASTERS_H
 #endif
 
+#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
 #include "cffobjs.h"
 #include "cffload.h"
 #include "cffcmap.h"
@@ -496,6 +497,7 @@
     FT_Service_PsCMaps  psnames;
     PSHinter_Service    pshinter;
     PSAux_Service       psaux;
+    FT_Service_CFFLoad  cffload;
     FT_Bool             pure_cff    = 1;
     FT_Bool             cff2        = 0;
     FT_Bool             sfnt_format = 0;
@@ -524,6 +526,9 @@
       error = FT_THROW( Missing_Module );
       goto Exit;
     }
+    face->psaux = psaux;
+
+    FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD );
 
     FT_TRACE2(( "CFF driver\n" ));
 
@@ -626,7 +631,7 @@
 
       cff->pshinter = pshinter;
       cff->psnames  = psnames;
-      cff->psaux    = psaux;
+      cff->cffload  = cffload;
 
       cffface->face_index = face_index & 0xFFFF;
 
diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c
index acf824a..0b5e048 100644
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -1389,14 +1389,19 @@
         cff_rec.top_font.font_dict.num_axes    = parser->num_axes;
         decoder.cff                            = &cff_rec;
 
-        /* TODO(ewaldhew): link this
-        PSAux_Service            psaux         = cff->psaux;
-        const CFF_Decoder_Funcs  decoder_funcs = psaux->cff_decoder_funcs;
-        */
-        error = decoder_funcs->parse_charstrings( &decoder,
-                                                  charstring_base,
-                                                  charstring_len,
-                                                  1 );
+        psaux = (PSAux_Service)FT_Get_Module_Interface(
+                  library, "psaux" );
+        if ( !psaux )
+        {
+          FT_ERROR(( "cff_parser_run: cannot access `psaux' module\n" ));
+          error = FT_THROW( Missing_Module );
+          goto Exit;
+        }
+        
+        error = psaux->cff_decoder_funcs->parse_charstrings( &decoder,
+                                                             charstring_base,
+                                                             charstring_len,
+                                                             1 );
 
         /* Now copy the stack data in the temporary decoder object,    */
         /* converting it back to charstring number representations     */
diff --git a/src/cff/cffpic.h b/src/cff/cffpic.h
index 5db39cd..a7e0197 100644
--- a/src/cff/cffpic.h
+++ b/src/cff/cffpic.h
@@ -22,7 +22,6 @@
 
 #include FT_INTERNAL_PIC_H
 
-
 #ifndef FT_CONFIG_OPTION_PIC
 
 #define CFF_SERVICE_PS_INFO_GET          cff_service_ps_info
@@ -34,6 +33,7 @@
 #define CFF_SERVICES_GET                 cff_services
 #define CFF_SERVICE_MULTI_MASTERS_GET    cff_service_multi_masters
 #define CFF_SERVICE_METRICS_VAR_GET      cff_service_metrics_variations
+#define CFF_SERVICE_CFF_LOAD_GET         cff_service_cff_load
 #define CFF_CMAP_ENCODING_CLASS_REC_GET  cff_cmap_encoding_class_rec
 #define CFF_CMAP_UNICODE_CLASS_REC_GET   cff_cmap_unicode_class_rec
 #define CFF_FIELD_HANDLERS_GET           cff_field_handlers
@@ -65,6 +65,7 @@ FT_BEGIN_HEADER
     FT_Service_PropertiesRec         cff_service_properties;
     FT_Service_MultiMastersRec       cff_service_multi_masters;
     FT_Service_MetricsVariationsRec  cff_service_metrics_variations;
+    FT_Service_CFFLoadRec            cff_service_cff_load;
     FT_CMap_ClassRec                 cff_cmap_encoding_class_rec;
     FT_CMap_ClassRec                 cff_cmap_unicode_class_rec;
 
@@ -92,6 +93,8 @@ FT_BEGIN_HEADER
           ( GET_PIC( library )->cff_service_multi_masters )
 #define CFF_SERVICE_METRICS_VAR_GET                              \
           ( GET_PIC( library )->cff_service_metrics_variations )
+#define CFF_SERVICE_CFF_LOAD_GET                       \
+          ( GET_PIC( library )->cff_service_cff_load )
 #define CFF_CMAP_ENCODING_CLASS_REC_GET                       \
           ( GET_PIC( library )->cff_cmap_encoding_class_rec )
 #define CFF_CMAP_UNICODE_CLASS_REC_GET                       \
diff --git a/src/cff/cfftypes.h b/src/cff/cfftypes.h
index 33b2d89..c2b9176 100644
--- a/src/cff/cfftypes.h
+++ b/src/cff/cfftypes.h
@@ -381,6 +381,9 @@ FT_BEGIN_HEADER
     /* interface to Postscript Names service */
     FT_Service_PsCMaps  psnames;
 
+    /* interface to CFFLoad service */
+    const void*  cffload;
+
     /* since version 2.3.0 */
     PS_FontInfoRec*  font_info;   /* font info dictionary */
 
diff --git a/src/psaux/cf2font.c b/src/psaux/cf2font.c
index c81f938..faa3e3f 100644
--- a/src/psaux/cf2font.c
+++ b/src/psaux/cf2font.c
@@ -260,6 +260,7 @@
     CF2_UInt   lenNormalizedV = 0;
     FT_Fixed*  normalizedV    = NULL;
 
+    FT_Service_CFFLoad  cffload = (FT_Service_CFFLoad)font->cffload;
 
     /* clear previous error */
     font->error = FT_Err_Ok;
@@ -287,16 +288,16 @@
       if ( font->error )
         return;
 
-      if ( cff_blend_check_vector( &subFont->blend,
-                                   subFont->private_dict.vsindex,
-                                   lenNormalizedV,
-                                   normalizedV ) )
+      if ( cffload->blend_check_vector( &subFont->blend,
+                                        subFont->private_dict.vsindex,
+                                        lenNormalizedV,
+                                        normalizedV ) )
       {
         /* blend has changed, reparse */
-        cff_load_private_dict( decoder->cff,
-                               subFont,
-                               lenNormalizedV,
-                               normalizedV );
+        cffload->load_private_dict( decoder->cff,
+                                    subFont,
+                                    lenNormalizedV,
+                                    normalizedV );
         needExtraSetup = TRUE;
       }
 #endif
diff --git a/src/psaux/cf2font.h b/src/psaux/cf2font.h
index 34faddd..94a31ca 100644
--- a/src/psaux/cf2font.h
+++ b/src/psaux/cf2font.h
@@ -40,9 +40,10 @@
 #define CF2FONT_H_
 
 
+#include FT_SERVICE_CFF_TABLE_LOAD_H
+
 #include "cf2ft.h"
 #include "cf2blues.h"
-//#include "cffload.h" //TODO(ewaldhew): link
 
 
 FT_BEGIN_HEADER
@@ -111,6 +112,8 @@ FT_BEGIN_HEADER
                                            /* counterclockwise winding */
 
     CF2_BluesRec  blues;                         /* computed zone data */
+
+    FT_Service_CFFLoad  cffload;                  /* Pointer to cff functions 
*/
   };
 
 
diff --git a/src/psaux/cf2ft.c b/src/psaux/cf2ft.c
index 7b7f72b..a040215 100644
--- a/src/psaux/cf2ft.c
+++ b/src/psaux/cf2ft.c
@@ -42,6 +42,12 @@
 #include "cf2font.h"
 #include "cf2error.h"
 
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+#include FT_MULTIPLE_MASTERS_H
+#include FT_SERVICE_MULTIPLE_MASTERS_H
+#endif
+
+#include FT_SERVICE_CFF_TABLE_LOAD_H
 
 #define CF2_MAX_SIZE  cf2_intToFixed( 2000 )    /* max ppem */
 
@@ -326,6 +332,7 @@
       font = (CF2_Font)decoder->cff->cf2_instance.data;
 
       font->memory = memory;
+      font->cffload = (FT_Service_CFFLoad)decoder->cff->cffload;
 
       /* initialize a client outline, to be shared by each glyph rendered */
       cf2_outline_init( &font->outline, font->memory, &font->error );
@@ -456,10 +463,12 @@
                            CF2_UInt     *len,
                            FT_Fixed*    *vec )
   {
-    FT_ASSERT( decoder && decoder->builder.face );
+    TT_Face  face = decoder->builder.face;
+    FT_Service_MultiMasters  mm = (FT_Service_MultiMasters)face->mm;
+    FT_ASSERT( decoder && face );
     FT_ASSERT( vec && len );
-
-    return cff_get_var_blend( decoder->builder.face, len, NULL, vec, NULL );
+    
+    return mm->get_var_blend( FT_FACE( face ), len, NULL, vec, NULL );
   }
 #endif
 
diff --git a/src/psaux/cf2intrp.c b/src/psaux/cf2intrp.c
index 6bbfe75..64edd37 100644
--- a/src/psaux/cf2intrp.c
+++ b/src/psaux/cf2intrp.c
@@ -38,6 +38,7 @@
 
 #include "cf2ft.h"
 #include FT_INTERNAL_DEBUG_H
+#include FT_SERVICE_CFF_TABLE_LOAD_H
 
 #include "cf2glue.h"
 #include "cf2font.h"
@@ -47,9 +48,6 @@
 
 #include "cf2error.h"
 
-//TODO(ewaldhew): link
-//#include "cffload.h"
-
 
   /*************************************************************************/
   /*                                                                       */
@@ -693,15 +691,15 @@
           }
 
           /* check cached blend vector */
-          if ( cff_blend_check_vector( &font->blend,
-                                       font->vsindex,
-                                       font->lenNDV,
-                                       font->NDV ) )
+          if ( font->cffload->blend_check_vector( &font->blend,
+                                                  font->vsindex,
+                                                  font->lenNDV,
+                                                  font->NDV ) )
           {
-            lastError = cff_blend_build_vector( &font->blend,
-                                                font->vsindex,
-                                                font->lenNDV,
-                                                font->NDV );
+            lastError = font->cffload->blend_build_vector( &font->blend,
+                                                           font->vsindex,
+                                                           font->lenNDV,
+                                                           font->NDV );
             if ( lastError )
               goto exit;
           }
diff --git a/src/psaux/cffdecode.c b/src/psaux/cffdecode.c
index c28279e..854d651 100644
--- a/src/psaux/cffdecode.c
+++ b/src/psaux/cffdecode.c
@@ -1,6 +1,8 @@
 
 
 #include <ft2build.h>
+#include FT_INTERNAL_SERVICE_H
+#include FT_SERVICE_CFF_TABLE_LOAD_H
 
 #include "cffdecode.h"
 #include "psobjs.h"
@@ -390,7 +392,7 @@
   {
     FT_UInt    n;
     FT_UShort  glyph_sid;
-
+    FT_Service_CFFLoad  cffload;
 
     /* CID-keyed fonts don't have glyph names */
     if ( !cff->charset.sids )
@@ -400,8 +402,24 @@
     if ( charcode < 0 || charcode > 255 )
       return -1;
 
+#if 0
+    /* retrieve cffload from list of current modules */
+    FT_Service_CFFLoad  cffload;
+    {
+      FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD );
+      if ( !cffload )
+      {
+        FT_ERROR(( "cff_lookup_glyph_by_stdcharcode:"
+                   " the `cffload' module is not available\n" ));
+        return FT_THROW( Unimplemented_Feature );
+      }
+    }
+#endif
+
+    cffload = (FT_Service_CFFLoad)cff->cffload;
+    
     /* Get code to SID mapping from `cff_standard_encoding'. */
-    glyph_sid = cff_get_standard_encoding( (FT_UInt)charcode );
+    glyph_sid = cffload->get_standard_encoding( (FT_UInt)charcode );
 
     for ( n = 0; n < cff->num_glyphs; n++ )
     {
@@ -2267,11 +2285,12 @@
     CFF_SubFont   sub     = &cff->top_font;
     FT_Error      error   = FT_Err_Ok;
 
+    FT_Service_CFFLoad  cffload = (FT_Service_CFFLoad)cff->cffload;
 
     /* manage CID fonts */
     if ( cff->num_subfonts )
     {
-      FT_Byte  fd_index = cff_fd_select_get( &cff->fd_select, glyph_index );
+      FT_Byte  fd_index = cffload->fd_select_get( &cff->fd_select, glyph_index 
);
 
 
       if ( fd_index >= cff->num_subfonts )



reply via email to

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