[font] Make set_variation() respect currently-set variations

Fixes https://github.com/harfbuzz/harfbuzz/issues/4143
This commit is contained in:
Behdad Esfahbod 2023-02-28 14:49:44 -07:00
parent 91627daee2
commit 5226d69733
1 changed files with 18 additions and 9 deletions

View File

@ -2690,6 +2690,14 @@ hb_font_set_variation (hb_font_t *font,
}
/* Initialize design coords. */
if (font->design_coords)
{
assert (coords_length == font->num_coords);
for (unsigned int i = 0; i < coords_length; i++)
design_coords[i] = font->design_coords[i];
}
else
{
for (unsigned int i = 0; i < coords_length; i++)
design_coords[i] = axes[i].get_default ();
if (font->instance_index != HB_FONT_NO_VAR_NAMED_INSTANCE)
@ -2701,6 +2709,7 @@ hb_font_set_variation (hb_font_t *font,
hb_ot_var_named_instance_get_design_coords (font->face, font->instance_index,
&count, design_coords);
}
}
for (unsigned axis_index = 0; axis_index < coords_length; axis_index++)
if (axes[axis_index].axisTag == tag)