diff options
Diffstat (limited to 'freetype/src/type1')
-rw-r--r-- | freetype/src/type1/t1driver.c | 24 | ||||
-rw-r--r-- | freetype/src/type1/t1load.c | 65 | ||||
-rw-r--r-- | freetype/src/type1/t1load.h | 10 |
3 files changed, 88 insertions, 11 deletions
diff --git a/freetype/src/type1/t1driver.c b/freetype/src/type1/t1driver.c index 029b410b4..8fcb2a385 100644 --- a/freetype/src/type1/t1driver.c +++ b/freetype/src/type1/t1driver.c @@ -122,17 +122,19 @@ #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT static const FT_Service_MultiMastersRec t1_service_multi_masters = { - (FT_Get_MM_Func) T1_Get_Multi_Master, /* get_mm */ - (FT_Set_MM_Design_Func) T1_Set_MM_Design, /* set_mm_design */ - (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_Get_Var_Design_Func)T1_Get_Var_Design, /* get_var_design */ - (FT_Set_Instance_Func) T1_Reset_MM_Blend, /* set_instance */ - - (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */ - (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */ + (FT_Get_MM_Func) T1_Get_Multi_Master, /* get_mm */ + (FT_Set_MM_Design_Func) T1_Set_MM_Design, /* set_mm_design */ + (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_Get_Var_Design_Func) T1_Get_Var_Design, /* get_var_design */ + (FT_Set_Instance_Func) T1_Reset_MM_Blend, /* set_instance */ + (FT_Set_MM_WeightVector_Func) T1_Set_MM_WeightVector, /* set_mm_weightvector */ + (FT_Get_MM_WeightVector_Func) T1_Get_MM_WeightVector, /* get_mm_weightvector */ + + (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */ + (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */ }; #endif diff --git a/freetype/src/type1/t1load.c b/freetype/src/type1/t1load.c index 9dfa637a6..94e856058 100644 --- a/freetype/src/type1/t1load.c +++ b/freetype/src/type1/t1load.c @@ -475,6 +475,71 @@ return FT_Err_Ok; } + FT_LOCAL_DEF( FT_Error ) + T1_Set_MM_WeightVector( T1_Face face, + FT_UInt len, + FT_Fixed* weightvector ) + { + PS_Blend blend = face->blend; + FT_UInt i, n; + + if ( !blend) + return FT_THROW( Invalid_Argument ); + + if ( len == 0 && weightvector == NULL ) + { + for ( i = 0; i < blend->num_designs; i++ ) + blend->weight_vector[i] = blend->default_weight_vector[i]; + } + else + { + if ( weightvector == NULL ) + return FT_THROW( Invalid_Argument ); + + n = len < blend->num_designs ? len : blend->num_designs; + + for ( i = 0; i < n; i++ ) + blend->weight_vector[i] = weightvector[i]; + + for ( ; i < blend->num_designs; i++ ) + blend->weight_vector[i] = (FT_Fixed)0; + + if ( len ) + face->root.face_flags |= FT_FACE_FLAG_VARIATION; + else + face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; + } + return FT_Err_Ok; + } + + + FT_LOCAL_DEF( FT_Error ) + T1_Get_MM_WeightVector( T1_Face face, + FT_UInt* len, + FT_Fixed* weightvector ) + { + PS_Blend blend = face->blend; + FT_UInt i; + + + if ( !blend ) + return FT_THROW( Invalid_Argument ); + if (*len < blend->num_designs) + { + *len = blend->num_designs; + return FT_THROW( Invalid_Argument ); + } + + for (i = 0; i < blend->num_designs; i++) + weightvector[i] = blend->weight_vector[i]; + for (; i < *len; i++) + weightvector[i] = (FT_Fixed)0; + + *len = blend->num_designs; + + return FT_Err_Ok; + } + FT_LOCAL_DEF( FT_Error ) T1_Set_MM_Design( T1_Face face, diff --git a/freetype/src/type1/t1load.h b/freetype/src/type1/t1load.h index 03be3f7f9..5763ccc1e 100644 --- a/freetype/src/type1/t1load.h +++ b/freetype/src/type1/t1load.h @@ -106,6 +106,16 @@ FT_BEGIN_HEADER FT_LOCAL( void ) T1_Done_Blend( T1_Face face ); + FT_LOCAL( FT_Error ) + T1_Set_MM_WeightVector( T1_Face face, + FT_UInt len, + FT_Fixed* weightvector ); + + FT_LOCAL( FT_Error ) + T1_Get_MM_WeightVector( T1_Face face, + FT_UInt* len, + FT_Fixed* weightvector ); + #endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */ |