diff --git a/ChangeLog b/ChangeLog index d54467a25..70268d26e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +2016-12-06 Dave Arnold + + Add `FT_Get_Var_Design_Coordinates' function. + + Note that the low-level functions aren't implemented yet. + + * include/freetype/ftmm.h: Declare. + + * include/freetype/internal/services/svmm.h + (FT_Get_Var_Design_Func): New typedef. + (MultiMasters): New MM service function `get_var_design'. + (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. + Update all callers. + + * src/base/ftmm.c (FT_Get_Var_Design_Coordinates): Implement. + + * src/truetype/ttdriver.c: Updated. + + * src/truetype/ttgxvar.c (TT_Get_Var_Design): New dummy function to + handle `get_var_design' service. + * src/truetype/ttgxvar.h: Updated. + + * src/type1/t1driver.c: Updated. + + * src/type1/t1load.c (T1_Get_Var_Design): New dummp function to + handle `get_var_design' service. + * src/type1/t1load.h: Updated. + 2016-12-06 Werner Lemberg * src/type1/t1load.c (parse_subrs): Fix memory leak. diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index c05d3b61f..882bdbb05 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -334,6 +334,34 @@ FT_BEGIN_HEADER FT_Fixed* coords ); + /*************************************************************************/ + /* */ + /* */ + /* FT_Get_Var_Design_Coordinates */ + /* */ + /* */ + /* For Multiple Master and GX Var fonts, get the design coordinates */ + /* of the currently selected interpolated font. */ + /* */ + /* */ + /* face :: A handle to the source face. */ + /* */ + /* num_coords :: The number of design coordinates to retrieve. If it */ + /* is larger than the number of axes, set the excess */ + /* values to~0. */ + /* */ + /* */ + /* coords :: The design coordinates array. */ + /* */ + /* */ + /* FreeType error code. 0~means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Get_Var_Design_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + /*************************************************************************/ /* */ /* */ @@ -374,16 +402,16 @@ FT_BEGIN_HEADER /* For Multiple Masters and GX var fonts, get the normalized blend */ /* coordinates of the currently selected interpolated font. */ /* */ - /* */ + /* */ /* face :: A handle to the source face. */ /* */ - /* */ - /* num_coords :: The number of design coordinates to retrieve. If it */ - /* is larger than the number of axes, set the excess */ - /* values to 0.5 for MM fonts, and to 0 for GX var */ - /* fonts. */ + /* num_coords :: The number of normalized blend coordinates to */ + /* retrieve. If it is larger than the number of axes, */ + /* set the excess values to~0.5 for MM fonts, and to~0 */ + /* for GX var fonts. */ /* */ - /* coords :: The design coordinates array. */ + /* */ + /* coords :: The normalized blend coordinates array. */ /* */ /* */ /* FreeType error code. 0~means success. */ diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h index 809235807..e4d34ba0c 100644 --- a/include/freetype/internal/services/svmm.h +++ b/include/freetype/internal/services/svmm.h @@ -58,6 +58,11 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Long* coords ); + typedef FT_Error + (*FT_Get_Var_Design_Func)( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + typedef FT_Error (*FT_Get_MM_Blend_Func)( FT_Face face, FT_UInt num_coords, @@ -72,6 +77,7 @@ FT_BEGIN_HEADER FT_Get_MM_Blend_Func get_mm_blend; FT_Get_MM_Var_Func get_mm_var; FT_Set_Var_Design_Func set_var_design; + FT_Get_Var_Design_Func get_var_design; }; @@ -83,7 +89,8 @@ FT_BEGIN_HEADER set_mm_blend_, \ get_mm_blend_, \ get_mm_var_, \ - set_var_design_ ) \ + set_var_design_, \ + get_var_design_ ) \ static const FT_Service_MultiMastersRec class_ = \ { \ get_mm_, \ @@ -91,7 +98,8 @@ FT_BEGIN_HEADER set_mm_blend_, \ get_mm_blend_, \ get_mm_var_, \ - set_var_design_ \ + set_var_design_, \ + get_var_design_ \ }; #else /* FT_CONFIG_OPTION_PIC */ @@ -102,7 +110,8 @@ FT_BEGIN_HEADER set_mm_blend_, \ get_mm_blend_, \ get_mm_var_, \ - set_var_design_ ) \ + set_var_design_, \ + get_var_design_ ) \ void \ FT_Init_Class_ ## class_( FT_Service_MultiMastersRec* clazz ) \ { \ @@ -112,6 +121,7 @@ FT_BEGIN_HEADER clazz->get_mm_blend = get_mm_blend_; \ clazz->get_mm_var = get_mm_var_; \ clazz->set_var_design = set_var_design_; \ + clazz->get_var_design = get_var_design_; \ } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/src/base/ftmm.c b/src/base/ftmm.c index 138515e8f..c3528035d 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -172,6 +172,34 @@ } + /* documentation is in ftmm.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Get_Var_Design_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ) + { + FT_Error error; + FT_Service_MultiMasters service; + + + /* check of `face' delayed to `ft_face_get_mm_service' */ + + if ( !coords ) + return FT_THROW( Invalid_Argument ); + + error = ft_face_get_mm_service( face, &service ); + if ( !error ) + { + error = FT_ERR( Invalid_Argument ); + if ( service->get_var_design ) + error = service->get_var_design( face, num_coords, coords ); + } + + return error; + } + + /* documentation is in ftmm.h */ FT_EXPORT_DEF( FT_Error ) @@ -193,7 +221,7 @@ { error = FT_ERR( Invalid_Argument ); if ( service->set_mm_blend ) - error = service->set_mm_blend( face, num_coords, coords ); + error = service->set_mm_blend( face, num_coords, coords ); } return error; @@ -224,7 +252,7 @@ { error = FT_ERR( Invalid_Argument ); if ( service->set_mm_blend ) - error = service->set_mm_blend( face, num_coords, coords ); + error = service->set_mm_blend( face, num_coords, coords ); } return error; @@ -252,7 +280,7 @@ { error = FT_ERR( Invalid_Argument ); if ( service->get_mm_blend ) - error = service->get_mm_blend( face, num_coords, coords ); + error = service->get_mm_blend( face, num_coords, coords ); } return error; @@ -283,7 +311,7 @@ { error = FT_ERR( Invalid_Argument ); if ( service->get_mm_blend ) - error = service->get_mm_blend( face, num_coords, coords ); + error = service->get_mm_blend( face, num_coords, coords ); } return error; diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 1c4b617ee..886f7a0fe 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -472,7 +472,8 @@ (FT_Set_MM_Blend_Func) TT_Set_MM_Blend, /* set_mm_blend */ (FT_Get_MM_Blend_Func) TT_Get_MM_Blend, /* get_mm_blend */ (FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */ - (FT_Set_Var_Design_Func)TT_Set_Var_Design /* set_var_design */ + (FT_Set_Var_Design_Func)TT_Set_Var_Design, /* set_var_design */ + (FT_Get_Var_Design_Func)TT_Get_Var_Design /* get_var_design */ ) #endif diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 0b48c2c91..461369ffd 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -1381,6 +1381,20 @@ } + FT_LOCAL_DEF( FT_Error ) + TT_Get_Var_Design( TT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ) + { + FT_UNUSED( face ); + FT_UNUSED( num_coords ); + FT_UNUSED( coords ); + + /* TODO: Implement this function. */ + return FT_THROW( Unimplemented_Feature ); + } + + /*************************************************************************/ /*************************************************************************/ /***** *****/ diff --git a/src/truetype/ttgxvar.h b/src/truetype/ttgxvar.h index 408de7100..dd13bd8ad 100644 --- a/src/truetype/ttgxvar.h +++ b/src/truetype/ttgxvar.h @@ -162,6 +162,10 @@ FT_BEGIN_HEADER TT_Get_MM_Var( TT_Face face, FT_MM_Var* *master ); + FT_LOCAL( FT_Error ) + TT_Get_Var_Design( TT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); FT_LOCAL( FT_Error ) tt_face_vary_cvt( TT_Face face, diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index e5fb70124..639d7c0fb 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -124,7 +124,8 @@ (FT_Set_MM_Blend_Func) T1_Set_MM_Blend, /* set_mm_blend */ (FT_Get_MM_Blend_Func) T1_Get_MM_Blend, /* get_mm_blend */ (FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */ - (FT_Set_Var_Design_Func)T1_Set_Var_Design /* set_var_design */ + (FT_Set_Var_Design_Func)T1_Set_Var_Design, /* set_var_design */ + (FT_Get_Var_Design_Func)T1_Get_Var_Design /* get_var_design */ }; #endif diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 396f8a578..2b64f85e4 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -546,6 +546,20 @@ } + FT_LOCAL_DEF( FT_Error ) + T1_Get_Var_Design( T1_Face face, + FT_UInt num_coords, + FT_Fixed* coords ) + { + FT_UNUSED( face ); + FT_UNUSED( num_coords ); + FT_UNUSED( coords ); + + /* TODO: Implement this function. */ + return FT_THROW( Unimplemented_Feature ); + } + + FT_LOCAL_DEF( void ) T1_Done_Blend( T1_Face face ) { diff --git a/src/type1/t1load.h b/src/type1/t1load.h index 1fbd0b4fd..72445c531 100644 --- a/src/type1/t1load.h +++ b/src/type1/t1load.h @@ -70,7 +70,7 @@ FT_BEGIN_HEADER T1_Get_Multi_Master( T1_Face face, FT_Multi_Master* master ); - FT_LOCAL_DEF( FT_Error ) + FT_LOCAL( FT_Error ) T1_Get_MM_Var( T1_Face face, FT_MM_Var* *master ); @@ -89,7 +89,12 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Long* coords ); - FT_LOCAL_DEF( FT_Error ) + FT_LOCAL( FT_Error ) + T1_Get_Var_Design( T1_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + FT_LOCAL( FT_Error ) T1_Set_Var_Design( T1_Face face, FT_UInt num_coords, FT_Fixed* coords );