shithub: freetype+ttf2subf

Download patch

ref: 8b174b4b9690de3149bdeb41d3bff93ad896960c
parent: 27bdb36cbe02f6c62e09ec973c791e6565f9d38b
author: Werner Lemberg <[email protected]>
date: Sun Dec 11 04:16:52 EST 2016

[truetype, type1] Add `get_var_blend' to MM service.

For internal use; we want to share code between the forthcoming CFF2
support and TrueType.

* include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func):
New typedef.
(MultiMasters): Add `get_var_blend'.
(FT_Service_MultiMasters): Updated.

* src/truetype/ttgxvar.c (tt_get_var_blend): New function.
* src/truetype/ttgxvar.h: Updated.

* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
* src/type1/t1driver.c (t1_service_multi_masters): Updated.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 2016-12-10  Werner Lemberg  <[email protected]>
 
+	[truetype, type1] Add `get_var_blend' to MM service.
+
+	For internal use; we want to share code between the forthcoming CFF2
+	support and TrueType.
+
+	* include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func):
+	New typedef.
+	(MultiMasters): Add `get_var_blend'.
+	(FT_Service_MultiMasters): Updated.
+
+	* src/truetype/ttgxvar.c (tt_get_var_blend): New function.
+	* src/truetype/ttgxvar.h: Updated.
+
+	* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
+	* src/type1/t1driver.c (t1_service_multi_masters): Updated.
+
+2016-12-10  Werner Lemberg  <[email protected]>
+
 	[truetype, type1] Add `done_blend' to MM service.
 
 	For internal use; we want to share code between the forthcoming CFF2
--- a/include/freetype/internal/services/svmm.h
+++ b/include/freetype/internal/services/svmm.h
@@ -68,6 +68,11 @@
                            FT_UInt   num_coords,
                            FT_Long*  coords );
 
+  typedef FT_Error
+  (*FT_Get_Var_Blend_Func)( FT_Face     face,
+                            FT_UInt    *num_coords,
+                            FT_Fixed*  *coords );
+
   typedef void
   (*FT_Done_Blend_Func)( FT_Face );
 
@@ -83,6 +88,7 @@
     FT_Get_Var_Design_Func  get_var_design;
 
     /* for internal use; only needed for code sharing between modules */
+    FT_Get_Var_Blend_Func   get_var_blend;
     FT_Done_Blend_Func      done_blend;
   };
 
@@ -97,6 +103,7 @@
                                            get_mm_var_,      \
                                            set_var_design_,  \
                                            get_var_design_,  \
+                                           get_var_blend_,   \
                                            done_blend_     ) \
   static const FT_Service_MultiMastersRec  class_ =          \
   {                                                          \
@@ -107,6 +114,7 @@
     get_mm_var_,                                             \
     set_var_design_,                                         \
     get_var_design_,                                         \
+    get_var_blend_,                                          \
     done_blend_                                              \
   };
 
@@ -120,6 +128,7 @@
                                            get_mm_var_,          \
                                            set_var_design_,      \
                                            get_var_design_,      \
+                                           get_var_blend_,       \
                                            done_blend_ )         \
   void                                                           \
   FT_Init_Class_ ## class_( FT_Service_MultiMastersRec*  clazz ) \
@@ -131,6 +140,7 @@
     clazz->get_mm_var     = get_mm_var_;                         \
     clazz->set_var_design = set_var_design_;                     \
     clazz->get_var_design = get_var_design_;                     \
+    clazz->get_var_blend  = get_var_blend_;                      \
     clazz->done_blend     = done_blend_;                         \
   }
 
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -475,6 +475,7 @@
     (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_Get_Var_Blend_Func) tt_get_var_blend,       /* get_var_blend  */
     (FT_Done_Blend_Func)    tt_done_blend           /* done_blend     */
   )
 #endif
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -2236,6 +2236,39 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
+  /*    tt_get_var_blend                                                   */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    An internal version of `TT_Get_MM_Blend' that just returns         */
+  /*    pointers instead of copying data, without any initialization of    */
+  /*    the MM machinery in case it isn't loaded yet.                      */
+  /*                                                                       */
+  FT_LOCAL_DEF( FT_Error )
+  tt_get_var_blend( TT_Face     face,
+                    FT_UInt    *num_coords,
+                    FT_Fixed*  *coords )
+  {
+    FT_Error  error = FT_Err_Ok;
+
+
+    if ( face->blend )
+    {
+      *num_coords = face->blend->num_axis;
+      *coords     = face->blend->normalizedcoords;
+    }
+    else
+    {
+      *num_coords = 0;
+      *coords     = NULL;
+    }
+
+    return FT_Err_Ok;
+  }
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
   /*    tt_done_blend                                                      */
   /*                                                                       */
   /* <Description>                                                         */
--- a/src/truetype/ttgxvar.h
+++ b/src/truetype/ttgxvar.h
@@ -179,6 +179,11 @@
                               FT_UInt      n_points );
 
 
+  FT_LOCAL( FT_Error )
+  tt_get_var_blend( TT_Face     face,
+                    FT_UInt    *num_coords,
+                    FT_Fixed*  *coords );
+
   FT_LOCAL( void )
   tt_done_blend( TT_Face  face );
 
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -127,6 +127,7 @@
     (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_Get_Var_Blend_Func) NULL,                  /* get_var_blend  */
     (FT_Done_Blend_Func)    T1_Done_Blend          /* done_blend     */
   };
 #endif