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.
This commit is contained in:
Dave Arnold 2016-12-05 22:08:15 +01:00 committed by Werner Lemberg
parent c0fae7da5a
commit bcae657482
10 changed files with 151 additions and 18 deletions

View File

@ -1,3 +1,31 @@
2016-12-06 Dave Arnold <darnold@adobe.com>
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 <wl@gnu.org>
* src/type1/t1load.c (parse_subrs): Fix memory leak.

View File

@ -334,6 +334,34 @@ FT_BEGIN_HEADER
FT_Fixed* coords );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Var_Design_Coordinates */
/* */
/* <Description> */
/* For Multiple Master and GX Var fonts, get the design coordinates */
/* of the currently selected interpolated font. */
/* */
/* <Input> */
/* 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. */
/* */
/* <Output> */
/* coords :: The design coordinates array. */
/* */
/* <Return> */
/* 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 );
/*************************************************************************/
/* */
/* <Function> */
@ -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. */
/* */
/* <InOut> */
/* <Input> */
/* face :: A handle to the source face. */
/* */
/* <Input> */
/* 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. */
/* <Output> */
/* coords :: The normalized blend coordinates array. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */

View File

@ -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 */

View File

@ -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;

View File

@ -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

View File

@ -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 );
}
/*************************************************************************/
/*************************************************************************/
/***** *****/

View File

@ -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,

View File

@ -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

View File

@ -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 )
{

View File

@ -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 );