* src/cff/cffobjs.c (cff_face_init): Make named instances work.

This commit is contained in:
Werner Lemberg 2016-12-18 18:23:19 +01:00
parent a8652c59da
commit ca3d401993
2 changed files with 60 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2016-12-18 Werner Lemberg <wl@gnu.org>
* src/cff/cffobjs.c (cff_face_init): Make named instances work.
2016-12-18 Werner Lemberg <wl@gnu.org>
[truetype, cff] Extend `get_var_blend' function of MM service.

View File

@ -683,6 +683,62 @@
}
#endif /* FT_DEBUG_LEVEL_TRACE */
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
{
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
FT_Int instance_index = face_index >> 16;
if ( FT_HAS_MULTIPLE_MASTERS( cffface ) &&
mm &&
instance_index > 0 )
{
FT_MM_Var* mm_var;
error = mm->get_mm_var( cffface, NULL );
if ( error )
goto Exit;
mm->get_var_blend( cffface, NULL, NULL, &mm_var );
if ( mm_var->namedstyle )
{
FT_Var_Named_Style* named_style;
FT_String* style_name;
/* in `face_index', the instance index starts with value 1 */
named_style = mm_var->namedstyle + instance_index - 1;
error = sfnt->get_name( face,
(FT_UShort)named_style->strid,
&style_name );
if ( error )
goto Exit;
/* set style name; if already set, replace it */
if ( face->root.style_name )
FT_FREE( face->root.style_name );
face->root.style_name = style_name;
/* finally, select the named instance */
error = mm->set_var_design( cffface,
mm_var->num_axis,
named_style->coords );
if ( error )
goto Exit;
}
}
}
#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
if ( !dict->has_font_matrix )
dict->units_per_em = pure_cff ? 1000 : face->root.units_per_EM;