[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
diff --git a/ChangeLog b/ChangeLog
index c512808..7fc94e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-08-10 Werner Lemberg <wl@gnu.org>
+
+ [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 <wl@gnu.org>
[psnames] Really fix issue #49949.
diff --git a/docs/CHANGES b/docs/CHANGES
index 6c99f4e..592f6a4 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -9,6 +9,9 @@ CHANGES BETWEEN 2.8 and 2.8.1
- 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
@@ -23,6 +26,14 @@ CHANGES BETWEEN 2.8 and 2.8.1
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'.
+
======================================================================
diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h
index b4c5941..80ac98d 100644
--- a/include/freetype/ftmm.h
+++ b/include/freetype/ftmm.h
@@ -322,6 +322,11 @@ FT_BEGIN_HEADER
/* <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 @@ FT_BEGIN_HEADER
/* <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,
@@ -416,6 +426,11 @@ FT_BEGIN_HEADER
/* <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,
FT_UInt num_coords,
diff --git a/src/base/ftmm.c b/src/base/ftmm.c
index c845008..43877ec 100644
--- 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 );