freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master f2e121a: [base] Minor API improvement for default var


From: Werner LEMBERG
Subject: [freetype2] master f2e121a: [base] Minor API improvement for default variation axis setting.
Date: Thu, 10 Aug 2017 06:57:53 -0400 (EDT)

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

    [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.
---
 ChangeLog               | 10 ++++++++++
 docs/CHANGES            | 11 +++++++++++
 include/freetype/ftmm.h | 15 +++++++++++++++
 src/base/ftmm.c         |  8 ++++----
 4 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c512808..7fc94e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-08-10  Werner Lemberg  <address@hidden>
+
+       [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  <address@hidden>
 
        [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 );



reply via email to

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