From c6ef11daf51bba4e06c4eabbc387b1058e8ce8ab Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 19 Jul 2022 15:19:52 -0600 Subject: [PATCH] [util] Fix build with HB_NO_VAR --- util/font-options.hh | 10 ++++++++++ util/helper-cairo-ft.hh | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/util/font-options.hh b/util/font-options.hh index 327214a71..331efd7da 100644 --- a/util/font-options.hh +++ b/util/font-options.hh @@ -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 diff --git a/util/helper-cairo-ft.hh b/util/helper-cairo-ft.hh index f22c558f8..17de6945f 100644 --- a/util/helper-cairo-ft.hh +++ b/util/helper-cairo-ft.hh @@ -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)