[font] Make set_variation() respect currently-set variations
Fixes https://github.com/harfbuzz/harfbuzz/issues/4143
This commit is contained in:
parent
91627daee2
commit
5226d69733
|
@ -2690,16 +2690,25 @@ hb_font_set_variation (hb_font_t *font,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize design coords. */
|
/* Initialize design coords. */
|
||||||
for (unsigned int i = 0; i < coords_length; i++)
|
if (font->design_coords)
|
||||||
design_coords[i] = axes[i].get_default ();
|
|
||||||
if (font->instance_index != HB_FONT_NO_VAR_NAMED_INSTANCE)
|
|
||||||
{
|
{
|
||||||
unsigned count = coords_length;
|
assert (coords_length == font->num_coords);
|
||||||
/* This may fail if index is out-of-range;
|
for (unsigned int i = 0; i < coords_length; i++)
|
||||||
* That's why we initialize design_coords from fvar above
|
design_coords[i] = font->design_coords[i];
|
||||||
* unconditionally. */
|
}
|
||||||
hb_ot_var_named_instance_get_design_coords (font->face, font->instance_index,
|
else
|
||||||
&count, design_coords);
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
unsigned count = coords_length;
|
||||||
|
/* This may fail if index is out-of-range;
|
||||||
|
* That's why we initialize design_coords from fvar above
|
||||||
|
* unconditionally. */
|
||||||
|
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++)
|
for (unsigned axis_index = 0; axis_index < coords_length; axis_index++)
|
||||||
|
|
Loading…
Reference in New Issue