Commit e23fe2adbcdbd7019a62a4775bcece1b22c76641

Werner Lemberg 2017-10-07T11:25:04

Add framework for setting named instance in MM service. * include/freetype/internal/services/svmm.h (FT_Set_Instance_Func): New function typedef. (MultiMasters): Add `set_instance' member. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * src/cff/cffdrivr.c (cff_service_multi_masters), src/truetype/ttdriver (tt_service_gx_multi_masters), src/type1/t1driver.c (t1_service_multi_masters): Updated.

diff --git a/ChangeLog b/ChangeLog
index 1ed0a4c..d3a96d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2017-10-07  Werner Lemberg  <wl@gnu.org>
 
+	Add framework for setting named instance in MM service.
+
+	* include/freetype/internal/services/svmm.h (FT_Set_Instance_Func):
+	New function typedef.
+	(MultiMasters): Add `set_instance' member.
+	(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.
+
+	* src/cff/cffdrivr.c (cff_service_multi_masters),
+	src/truetype/ttdriver (tt_service_gx_multi_masters),
+	src/type1/t1driver.c (t1_service_multi_masters): Updated.
+
+2017-10-07  Werner Lemberg  <wl@gnu.org>
+
 	[type1] Minor code shuffling.
 
 	* src/type1/t1load.c (T1_Set_MM_Blend): Make it a wrapper of...
diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h
index 1d51cd9..a934f94 100644
--- a/include/freetype/internal/services/svmm.h
+++ b/include/freetype/internal/services/svmm.h
@@ -64,6 +64,10 @@ FT_BEGIN_HEADER
                              FT_Fixed*  coords );
 
   typedef FT_Error
+  (*FT_Set_Instance_Func)( FT_Face  face,
+                           FT_UInt  instance_index );
+
+  typedef FT_Error
   (*FT_Get_MM_Blend_Func)( FT_Face   face,
                            FT_UInt   num_coords,
                            FT_Long*  coords );
@@ -88,6 +92,7 @@ FT_BEGIN_HEADER
     FT_Get_MM_Var_Func      get_mm_var;
     FT_Set_Var_Design_Func  set_var_design;
     FT_Get_Var_Design_Func  get_var_design;
+    FT_Set_Instance_Func    set_instance;
 
     /* for internal use; only needed for code sharing between modules */
     FT_Get_Var_Blend_Func   get_var_blend;
@@ -97,27 +102,29 @@ FT_BEGIN_HEADER
 
 #ifndef FT_CONFIG_OPTION_PIC
 
-#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_,           \
-                                           get_mm_,          \
-                                           set_mm_design_,   \
-                                           set_mm_blend_,    \
-                                           get_mm_blend_,    \
-                                           get_mm_var_,      \
-                                           set_var_design_,  \
-                                           get_var_design_,  \
-                                           get_var_blend_,   \
-                                           done_blend_     ) \
-  static const FT_Service_MultiMastersRec  class_ =          \
-  {                                                          \
-    get_mm_,                                                 \
-    set_mm_design_,                                          \
-    set_mm_blend_,                                           \
-    get_mm_blend_,                                           \
-    get_mm_var_,                                             \
-    set_var_design_,                                         \
-    get_var_design_,                                         \
-    get_var_blend_,                                          \
-    done_blend_                                              \
+#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_,          \
+                                           get_mm_,         \
+                                           set_mm_design_,  \
+                                           set_mm_blend_,   \
+                                           get_mm_blend_,   \
+                                           get_mm_var_,     \
+                                           set_var_design_, \
+                                           get_var_design_, \
+                                           set_instance_,   \
+                                           get_var_blend_,  \
+                                           done_blend_ )    \
+  static const FT_Service_MultiMastersRec  class_ =         \
+  {                                                         \
+    get_mm_,                                                \
+    set_mm_design_,                                         \
+    set_mm_blend_,                                          \
+    get_mm_blend_,                                          \
+    get_mm_var_,                                            \
+    set_var_design_,                                        \
+    get_var_design_,                                        \
+    set_instance_,                                          \
+    get_var_blend_,                                         \
+    done_blend_                                             \
   };
 
 #else /* FT_CONFIG_OPTION_PIC */
@@ -130,6 +137,7 @@ FT_BEGIN_HEADER
                                            get_mm_var_,          \
                                            set_var_design_,      \
                                            get_var_design_,      \
+                                           set_instance_,        \
                                            get_var_blend_,       \
                                            done_blend_ )         \
   void                                                           \
@@ -142,6 +150,7 @@ FT_BEGIN_HEADER
     clazz->get_mm_var     = get_mm_var_;                         \
     clazz->set_var_design = set_var_design_;                     \
     clazz->get_var_design = get_var_design_;                     \
+    clazz->set_instance   = set_instance_;                       \
     clazz->get_var_blend  = get_var_blend_;                      \
     clazz->done_blend     = done_blend_;                         \
   }
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 906d315..3cecbc0 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -1119,6 +1119,7 @@
     (FT_Get_MM_Var_Func)    cff_get_mm_var,         /* get_mm_var     */
     (FT_Set_Var_Design_Func)cff_set_var_design,     /* set_var_design */
     (FT_Get_Var_Design_Func)cff_get_var_design,     /* get_var_design */
+    (FT_Set_Instance_Func)  NULL,                   /* set_instance   */
 
     (FT_Get_Var_Blend_Func) cff_get_var_blend,      /* get_var_blend  */
     (FT_Done_Blend_Func)    cff_done_blend          /* done_blend     */
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index a1653b2..22bb872 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -498,6 +498,7 @@
     (FT_Get_MM_Var_Func)    TT_Get_MM_Var,          /* get_mm_var     */
     (FT_Set_Var_Design_Func)TT_Set_Var_Design,      /* set_var_design */
     (FT_Get_Var_Design_Func)TT_Get_Var_Design,      /* get_var_design */
+    (FT_Set_Instance_Func)  NULL,                   /* set_instance   */
 
     (FT_Get_Var_Blend_Func) tt_get_var_blend,       /* get_var_blend  */
     (FT_Done_Blend_Func)    tt_done_blend           /* done_blend     */
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index 866a824..b319f56 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -126,6 +126,7 @@
     (FT_Get_MM_Var_Func)    T1_Get_MM_Var,         /* get_mm_var     */
     (FT_Set_Var_Design_Func)T1_Set_Var_Design,     /* set_var_design */
     (FT_Get_Var_Design_Func)T1_Get_Var_Design,     /* get_var_design */
+    (FT_Set_Instance_Func)  NULL,                  /* set_instance   */
 
     (FT_Get_Var_Blend_Func) NULL,                  /* get_var_blend  */
     (FT_Done_Blend_Func)    T1_Done_Blend          /* done_blend     */