ref: ca3d4019935507e129a600b97974b0f4feca2663
parent: a8652c59daca62b5f25680928efcdd04ea9f6731
author: Werner Lemberg <[email protected]>
date: Sun Dec 18 13:23:19 EST 2016
* src/cff/cffobjs.c (cff_face_init): Make named instances work.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2016-12-18 Werner Lemberg <[email protected]>
+ * src/cff/cffobjs.c (cff_face_init): Make named instances work.
+
+2016-12-18 Werner Lemberg <[email protected]>
+
[truetype, cff] Extend `get_var_blend' function of MM service.
In particular, we need access to named instance data.
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -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;