[ft] If there's no variations set, don't set them on hb-font
authorBehdad Esfahbod <behdad@behdad.org>
Fri, 5 Jan 2018 13:06:25 +0000 (13:06 +0000)
committerBehdad Esfahbod <behdad@behdad.org>
Fri, 5 Jan 2018 13:06:25 +0000 (13:06 +0000)
src/hb-ft.cc

index 4f33e114b4023e76e5a4581b234fb646ac40651a..ae8c8d923af4b211305703ce5b3b1760eb1500bc 100644 (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))
       {
+       bool nonzero = false;
+
        for (unsigned int i = 0; i < mm_var->num_axis; ++i)
+        {
          coords[i] = ft_coords[i] >>= 2;
+         nonzero = nonzero || coords[i];
+        }
 
-       hb_font_set_var_coords_normalized (font, coords, mm_var->num_axis);
+       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);