summaryrefslogtreecommitdiff
path: root/src/truetype
diff options
context:
space:
mode:
Diffstat (limited to 'src/truetype')
-rw-r--r--src/truetype/ttdriver.c37
-rw-r--r--src/truetype/ttgxvar.c48
-rw-r--r--src/truetype/ttgxvar.h4
3 files changed, 70 insertions, 19 deletions
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index c2e041cd3..c128be19d 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -517,34 +517,37 @@
FT_DEFINE_SERVICE_MULTIMASTERSREC(
tt_service_gx_multi_masters,
- (FT_Get_MM_Func) NULL, /* get_mm */
- (FT_Set_MM_Design_Func) NULL, /* set_mm_design */
- (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_Get_Var_Design_Func)TT_Get_Var_Design, /* get_var_design */
- (FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */
+ (FT_Get_MM_Func) NULL, /* get_mm */
+ (FT_Set_MM_Design_Func) NULL, /* set_mm_design */
+ (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_Get_Var_Design_Func)TT_Get_Var_Design, /* get_var_design */
+ (FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */
+ (FT_Get_Default_Named_Instance_Func)
+ TT_Get_Default_Named_Instance,
+ /* get_default_named_instance */
(FT_Set_MM_WeightVector_Func)
- NULL, /* set_mm_weightvector */
+ NULL, /* set_mm_weightvector */
(FT_Get_MM_WeightVector_Func)
- NULL, /* get_mm_weightvector */
+ NULL, /* get_mm_weightvector */
(FT_Var_Load_Delta_Set_Idx_Map_Func)
tt_var_load_delta_set_index_mapping,
- /* load_delta_set_idx_map */
+ /* load_delta_set_idx_map */
(FT_Var_Load_Item_Var_Store_Func)
tt_var_load_item_variation_store,
- /* load_item_variation_store */
+ /* load_item_variation_store */
(FT_Var_Get_Item_Delta_Func)
- tt_var_get_item_delta, /* get_item_delta */
+ tt_var_get_item_delta, /* get_item_delta */
(FT_Var_Done_Item_Var_Store_Func)
tt_var_done_item_variation_store,
- /* done_item_variation_store */
+ /* done_item_variation_store */
(FT_Var_Done_Delta_Set_Idx_Map_Func)
tt_var_done_delta_set_index_map,
- /* done_delta_set_index_map */
- (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */
- (FT_Done_Blend_Func) tt_done_blend /* done_blend */
+ /* done_delta_set_index_map */
+ (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */
+ (FT_Done_Blend_Func) tt_done_blend /* done_blend */
)
FT_DEFINE_SERVICE_METRICSVARIATIONSREC(
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 963dcb7e3..d28cc245e 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -2630,8 +2630,10 @@
FT_UInt strid = ~0U;
- /* the default instance is missing in array the */
- /* of named instances; try to synthesize an entry */
+ /* The default instance is missing in array the */
+ /* of named instances; try to synthesize an entry. */
+ /* If this fails, `default_named_instance` remains */
+ /* at value zero, which doesn't do any harm. */
found = sfnt->get_name_id( face,
TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY,
&dummy1,
@@ -2659,6 +2661,9 @@
FT_TRACE5(( "TT_Get_MM_Var:"
" Adding default instance to named instances\n" ));
+ /* named instance indices start with value 1 */
+ face->var_default_named_instance = num_instances;
+
ns = &mmvar->namedstyle[fvar_head.instanceCount];
ns->strid = strid;
@@ -3386,6 +3391,45 @@
}
+ /**************************************************************************
+ *
+ * @Function:
+ * TT_Get_Default_Named_Instance
+ *
+ * @Description:
+ * Get the default named instance.
+ *
+ * @Input:
+ * face ::
+ * A handle to the source face.
+ *
+ * @Output:
+ * instance_index ::
+ * The default named instance index.
+ *
+ * @Return:
+ * FreeType error code. 0~means success.
+ */
+ FT_LOCAL_DEF( FT_Error )
+ TT_Get_Default_Named_Instance( TT_Face face,
+ FT_UInt *instance_index )
+ {
+ FT_Error error = FT_Err_Ok;
+
+
+ if ( !face->blend )
+ {
+ if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) )
+ goto Exit;
+ }
+
+ *instance_index = face->var_default_named_instance;
+
+ Exit:
+ return error;
+ }
+
+
/*************************************************************************/
/*************************************************************************/
/***** *****/
diff --git a/src/truetype/ttgxvar.h b/src/truetype/ttgxvar.h
index 4fec980dc..0c096f7df 100644
--- a/src/truetype/ttgxvar.h
+++ b/src/truetype/ttgxvar.h
@@ -375,6 +375,10 @@ FT_BEGIN_HEADER
FT_UInt instance_index );
FT_LOCAL( FT_Error )
+ TT_Get_Default_Named_Instance( TT_Face face,
+ FT_UInt *instance_index );
+
+ FT_LOCAL( FT_Error )
tt_face_vary_cvt( TT_Face face,
FT_Stream stream );