shithub: freetype+ttf2subf

Download patch

ref: f2e121ab11d1c9deb460d844d94f1d9fe6074f35
parent: c87fec0299533fee9b20505a4955c7f2f5c5bed7
author: Werner Lemberg <[email protected]>
date: Thu Aug 10 08:56:50 EDT 2017

[base] Minor API improvement for default variation axis setting.

* src/base/ftmm.c (FT_Set_MM_Design_Coordinates,
FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates,
FT_Set_Var_Blend_Coordinates): Allow coords==NULL if num_coords==0.

* docs/CHANGES: Updated.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-08-10  Werner Lemberg  <[email protected]>
+
+	[base] Minor API improvement for default variation axis setting.
+
+	* src/base/ftmm.c (FT_Set_MM_Design_Coordinates,
+	FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates,
+	FT_Set_Var_Blend_Coordinates): Allow coords==NULL if num_coords==0.
+
+	* docs/CHANGES: Updated.
+
 2017-08-08  Werner Lemberg  <[email protected]>
 
 	[psnames] Really fix issue #49949.
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -9,7 +9,10 @@
     - Some severe  problems within the handling  of TrueType Variation
       Fonts were found and fixed.
 
+    - Function `FT_Set_Var_Design_Coordinates' didn't correctly handle
+      the case with less input coordinates than axes.
 
+
   II. MISCELLANEOUS
 
     - Using the  new function `FT_Get_Var_Axis_Flags',  an application
@@ -22,6 +25,14 @@
       changed (to be more precise, the amount of padding gets computed
       differently).  Applications  that use  the FreeType API  are not
       affected.
+
+    - To  reset all  design axis  values of  a variation  font to  its
+      default values you can now say
+
+        error = FT_Set_Var_Design_Coordinates( face, 0, NULL );
+
+      This  also works  with functions  `FT_Set_MM_Design_Coordinates'
+      and `FT_Set_MM_Blend_Coordinates'.
 
 
 ======================================================================
--- a/include/freetype/ftmm.h
+++ b/include/freetype/ftmm.h
@@ -322,6 +322,11 @@
   /* <Return>                                                              */
   /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
+  /* <Note>                                                                */
+  /*    To reset all axes to the default values, call the function with    */
+  /*    `num_coords' set to zero and `coords' set to NULL (new feature in  */
+  /*    FreeType version 2.8.1).                                           */
+  /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Set_MM_Design_Coordinates( FT_Face   face,
                                 FT_UInt   num_coords,
@@ -352,6 +357,11 @@
   /* <Return>                                                              */
   /*    FreeType error code.  0~means success.                             */
   /*                                                                       */
+  /* <Note>                                                                */
+  /*    To reset all axes to the default values, call the function with    */
+  /*    `num_coords' set to zero and `coords' set to NULL (new feature in  */
+  /*    FreeType version 2.8.1).                                           */
+  /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Set_Var_Design_Coordinates( FT_Face    face,
                                  FT_UInt    num_coords,
@@ -415,6 +425,11 @@
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0~means success.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    To reset all axes to the default values, call the function with    */
+  /*    `num_coords' set to zero and `coords' set to NULL (new feature in  */
+  /*    FreeType version 2.8.1).                                           */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Set_MM_Blend_Coordinates( FT_Face    face,
--- a/src/base/ftmm.c
+++ b/src/base/ftmm.c
@@ -158,7 +158,7 @@
 
     /* check of `face' delayed to `ft_face_get_mm_service' */
 
-    if ( !coords )
+    if ( num_coords && !coords )
       return FT_THROW( Invalid_Argument );
 
     error = ft_face_get_mm_service( face, &service );
@@ -194,7 +194,7 @@
 
     /* check of `face' delayed to `ft_face_get_mm_service' */
 
-    if ( !coords )
+    if ( num_coords && !coords )
       return FT_THROW( Invalid_Argument );
 
     error = ft_face_get_mm_service( face, &service_mm );
@@ -266,7 +266,7 @@
 
     /* check of `face' delayed to `ft_face_get_mm_service' */
 
-    if ( !coords )
+    if ( num_coords && !coords )
       return FT_THROW( Invalid_Argument );
 
     error = ft_face_get_mm_service( face, &service_mm );
@@ -313,7 +313,7 @@
 
     /* check of `face' delayed to `ft_face_get_mm_service' */
 
-    if ( !coords )
+    if ( num_coords && !coords )
       return FT_THROW( Invalid_Argument );
 
     error = ft_face_get_mm_service( face, &service_mm );