[util] Fix build with HB_NO_VAR

This commit is contained in:
Behdad Esfahbod 2022-07-19 15:19:52 -06:00
parent 712bfa8872
commit c6ef11daf5
2 changed files with 11 additions and 1 deletions

View File

@ -44,7 +44,9 @@ struct font_options_t : face_options_t
{
~font_options_t ()
{
#ifndef HB_NO_VAR
free (variations);
#endif
g_free (font_funcs);
hb_font_destroy (font);
}
@ -54,8 +56,10 @@ struct font_options_t : face_options_t
void post_parse (GError **error);
hb_bool_t sub_font = false;
#ifndef HB_NO_VAR
hb_variation_t *variations = nullptr;
unsigned int num_variations = 0;
#endif
int x_ppem = 0;
int y_ppem = 0;
double ptem = 0.;
@ -102,7 +106,9 @@ font_options_t::post_parse (GError **error)
int scale_y = (int) scalbnf (font_size_y, subpixel_bits);
hb_font_set_scale (font, scale_x, scale_y);
#ifndef HB_NO_VAR
hb_font_set_variations (font, variations, num_variations);
#endif
void (*set_font_funcs) (hb_font_t *) = nullptr;
if (!font_funcs)
@ -152,6 +158,7 @@ font_options_t::post_parse (GError **error)
}
#ifndef HB_NO_VAR
static gboolean
parse_variations (const char *name G_GNUC_UNUSED,
const char *arg,
@ -194,6 +201,7 @@ parse_variations (const char *name G_GNUC_UNUSED,
return true;
}
#endif
static gboolean
parse_font_size (const char *name G_GNUC_UNUSED,
@ -292,6 +300,7 @@ font_options_t::add_options (option_parser_t *parser)
this,
false /* We add below. */);
#ifndef HB_NO_VAR
const gchar *variations_help = "Comma-separated list of font variations\n"
"\n"
" Variations are set globally. The format for specifying variation settings\n"
@ -314,6 +323,7 @@ font_options_t::add_options (option_parser_t *parser)
"Variations options:",
"Options for font variations used",
this);
#endif
}
#endif

View File

@ -80,7 +80,7 @@ helper_cairo_create_ft_font_face (const font_options_t *font_opts)
}
else
{
#ifdef HAVE_FT_SET_VAR_BLEND_COORDINATES
#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);
if (num_coords)