From f2e121ab11d1c9deb460d844d94f1d9fe6074f35 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 10 Aug 2017 12:56:50 +0200 Subject: [PATCH] [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 c512808d4..7fc94e776 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-08-10 Werner Lemberg + + [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 [psnames] Really fix issue #49949. diff --git a/docs/CHANGES b/docs/CHANGES index 6c99f4e9d..592f6a457 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 b4c594189..80ac98d61 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -322,6 +322,11 @@ FT_BEGIN_HEADER /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* 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 /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* 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 /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* 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 c8450087b..43877ece4 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 );