freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 0c7fb43 4/8: [sfnt] Add `get_name_id' service.


From: Werner LEMBERG
Subject: [freetype2] master 0c7fb43 4/8: [sfnt] Add `get_name_id' service.
Date: Mon, 6 Mar 2017 14:47:01 -0500 (EST)

branch: master
commit 0c7fb43d050056a216b94aa4e079cf5d20c140e6
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [sfnt] Add `get_name_id' service.
    
    * include/freetype/internal/sfnt.h (TT_Get_Name_ID_Func): New
    typedef.
    (SFNT_Interface): Add `get_name_id' field.
    (FT_DEFINE_SFNT_INTERFACE): Updated.
    
    * src/sfnt/sfdriver.c (search_name_id): Rename to...
    (sfnt_get_name_id): ... this.
    (sfnt_get_ps_name, sfnt_interface): Udpated.
---
 ChangeLog                        | 13 +++++++++++++
 include/freetype/internal/sfnt.h | 40 ++++++++++++++++++++++++++++++++++++++--
 src/sfnt/sfdriver.c              | 15 ++++++++-------
 3 files changed, 59 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index af5b343..4915436 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2017-03-04  Werner Lemberg  <address@hidden>
 
+       [sfnt] Add `get_name_id' service.
+
+       * include/freetype/internal/sfnt.h (TT_Get_Name_ID_Func): New
+       typedef.
+       (SFNT_Interface): Add `get_name_id' field.
+       (FT_DEFINE_SFNT_INTERFACE): Updated.
+
+       * src/sfnt/sfdriver.c (search_name_id): Rename to...
+       (sfnt_get_name_id): ... this.
+       (sfnt_get_ps_name, sfnt_interface): Udpated.
+
+2017-03-04  Werner Lemberg  <address@hidden>
+
        [truetype] Make `TT_Set_MM_Blend' set named instance index.
 
        * src/truetype/ttgxvar.h (GX_Blend): New array
diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h
index 348b5a9..b8667a0 100644
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -458,6 +458,37 @@ FT_BEGIN_HEADER
   /*************************************************************************/
   /*                                                                       */
   /* <FuncType>                                                            */
+  /*    TT_Get_Name_ID_Func                                                */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Search whether an ENGLISH version for a given name ID is in the    */
+  /*    `name' table.                                                      */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    face     :: A handle to the source face object.                    */
+  /*                                                                       */
+  /*    nameid   :: The name id of the name record to return.              */
+  /*                                                                       */
+  /* <Out>                                                                 */
+  /*    win      :: If non-negative, an index into the `name' table with   */
+  /*                the corresponding (3,1) or (3,0) Windows entry.        */
+  /*                                                                       */
+  /*    apple    :: If non-negative, an index into the `name' table with   */
+  /*                the corresponding (1,0) Apple entry.                   */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    1 if there is either a win or apple entry (or both), 0 otheriwse.  */
+  /*                                                                       */
+  typedef FT_Bool
+  (*TT_Get_Name_ID_Func)( TT_Face    face,
+                          FT_UShort  nameid,
+                          FT_Int    *win,
+                          FT_Int    *apple );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <FuncType>                                                            */
   /*    TT_Load_Table_Func                                                 */
   /*                                                                       */
   /* <Description>                                                         */
@@ -588,6 +619,7 @@ FT_BEGIN_HEADER
     TT_Get_Metrics_Func          get_metrics;
 
     TT_Get_Name_Func             get_name;
+    TT_Get_Name_ID_Func          get_name_id;
 
   } SFNT_Interface;
 
@@ -628,7 +660,8 @@ FT_BEGIN_HEADER
           set_sbit_strike_,              \
           load_strike_metrics_,          \
           get_metrics_,                  \
-          get_name_ )                    \
+          get_name_,                     \
+          get_name_id_ )                 \
   static const SFNT_Interface  class_ =  \
   {                                      \
     goto_table_,                         \
@@ -661,6 +694,7 @@ FT_BEGIN_HEADER
     load_strike_metrics_,                \
     get_metrics_,                        \
     get_name_,                           \
+    get_name_id_                         \
   };
 
 #else /* FT_CONFIG_OPTION_PIC */
@@ -699,7 +733,8 @@ FT_BEGIN_HEADER
           set_sbit_strike_,                             \
           load_strike_metrics_,                         \
           get_metrics_,                                 \
-          get_name_ )                                   \
+          get_name_,                                    \
+          get_name_id_ )                                \
   void                                                  \
   FT_Init_Class_ ## class_( FT_Library       library,   \
                             SFNT_Interface*  clazz )    \
@@ -736,6 +771,7 @@ FT_BEGIN_HEADER
     clazz->load_strike_metrics = load_strike_metrics_;  \
     clazz->get_metrics         = get_metrics_;          \
     clazz->get_name            = get_name_;             \
+    clazz->get_name_id         = get_name_id_;          \
   }
 
 #endif /* FT_CONFIG_OPTION_PIC */
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index 274ef80..f132669 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -381,11 +381,11 @@
   }
 
 
-  static int
-  search_name_id( TT_Face  face,
-                  FT_Int   id,
-                  FT_Int  *win,
-                  FT_Int  *apple )
+  static FT_Bool
+  sfnt_get_name_id( TT_Face    face,
+                    FT_UShort  id,
+                    FT_Int    *win,
+                    FT_Int    *apple )
   {
     FT_Int  n;
 
@@ -424,7 +424,7 @@
 
     /* scan the name table to see whether we have a Postscript name here, */
     /* either in Macintosh or Windows platform encodings                  */
-    found = search_name_id( face, 6, &win, &apple );
+    found = sfnt_get_name_id( face, 6, &win, &apple );
 
     if ( found )
     {
@@ -646,7 +646,8 @@
 
     tt_face_get_metrics,    /* TT_Get_Metrics_Func     get_metrics     */
 
-    tt_face_get_name        /* TT_Get_Name_Func        get_name        */
+    tt_face_get_name,       /* TT_Get_Name_Func        get_name        */
+    sfnt_get_name_id        /* TT_Get_Name_ID_Func     get_name_id     */
   )
 
 



reply via email to

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