From 61d0c547010096e37ced5b8629a0638cceaefddb Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 23 Jul 2022 13:25:54 -0600 Subject: [PATCH] [ft] Pass design, not normalized, coords to freetype Needed for avar2 to work. --- src/hb-ft.cc | 6 +++--- util/helper-cairo-ft.hh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 0a6db9bfb..5c88a7f3b 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -177,15 +177,15 @@ static void _hb_ft_hb_font_changed (hb_font_t *font, FT_Face ft_face) #if defined(HAVE_FT_GET_VAR_BLEND_COORDINATES) && !defined(HB_NO_VAR) unsigned int num_coords; - const int *coords = hb_font_get_var_coords_normalized (font, &num_coords); + const float *coords = hb_font_get_var_coords_design (font, &num_coords); if (num_coords) { FT_Fixed *ft_coords = (FT_Fixed *) hb_calloc (num_coords, sizeof (FT_Fixed)); if (ft_coords) { for (unsigned int i = 0; i < num_coords; i++) - ft_coords[i] = coords[i] * 4; - FT_Set_Var_Blend_Coordinates (ft_face, num_coords, ft_coords); + ft_coords[i] = coords[i] * 65536.f; + FT_Set_Var_Design_Coordinates (ft_face, num_coords, ft_coords); hb_free (ft_coords); } } diff --git a/util/helper-cairo-ft.hh b/util/helper-cairo-ft.hh index 17de6945f..5152c7cac 100644 --- a/util/helper-cairo-ft.hh +++ b/util/helper-cairo-ft.hh @@ -82,15 +82,15 @@ helper_cairo_create_ft_font_face (const font_options_t *font_opts) { #if !defined(HB_NO_VAR) && defined(HAVE_FT_SET_VAR_BLEND_COORDINATES) unsigned int num_coords; - const int *coords = hb_font_get_var_coords_normalized (font_opts->font, &num_coords); + const float *coords = hb_font_get_var_coords_design (font_opts->font, &num_coords); if (num_coords) { FT_Fixed *ft_coords = (FT_Fixed *) calloc (num_coords, sizeof (FT_Fixed)); if (ft_coords) { for (unsigned int i = 0; i < num_coords; i++) - ft_coords[i] = coords[i] << 2; - FT_Set_Var_Blend_Coordinates (ft_face, num_coords, ft_coords); + ft_coords[i] = coords[i] * 65536.f; + FT_Set_Var_Design_Coordinates (ft_face, num_coords, ft_coords); free (ft_coords); } }