[ft] If there's no variations set, don't set them on hb-font

This commit is contained in:
Behdad Esfahbod 2018-01-05 13:06:25 +00:00
parent ed2f458b14
commit cb43bdbc2f
1 changed files with 11 additions and 3 deletions

View File

@ -635,10 +635,18 @@ hb_ft_font_changed (hb_font_t *font)
{ {
if (!FT_Get_Var_Blend_Coordinates (ft_face, mm_var->num_axis, ft_coords)) if (!FT_Get_Var_Blend_Coordinates (ft_face, mm_var->num_axis, ft_coords))
{ {
for (unsigned int i = 0; i < mm_var->num_axis; ++i) bool nonzero = false;
coords[i] = ft_coords[i] >>= 2;
hb_font_set_var_coords_normalized (font, coords, mm_var->num_axis); for (unsigned int i = 0; i < mm_var->num_axis; ++i)
{
coords[i] = ft_coords[i] >>= 2;
nonzero = nonzero || coords[i];
}
if (nonzero)
hb_font_set_var_coords_normalized (font, coords, mm_var->num_axis);
else
hb_font_set_var_coords_normalized (font, nullptr, 0);
} }
} }
free (coords); free (coords);