From f21b15dcc318aa62d256443be3ccec7953a64242 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 20 Jan 2023 13:38:22 -0700 Subject: [PATCH] [hb-view] Update to alternative cairo custom-palette API --- meson.build | 1 + src/hb-cairo.cc | 5 +++-- util/helper-cairo.hh | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 947c371da..b22db3988 100644 --- a/meson.build +++ b/meson.build @@ -214,6 +214,7 @@ if cairo_dep.found() else check_funcs += [['cairo_user_font_face_set_render_color_glyph_func', {'deps': cairo_dep}]] endif + check_funcs += [['cairo_font_options_get_custom_palette_color', {'deps': cairo_dep}]] endif if cairo_ft_dep.found() diff --git a/src/hb-cairo.cc b/src/hb-cairo.cc index c760311a5..9bcd447af 100644 --- a/src/hb-cairo.cc +++ b/src/hb-cairo.cc @@ -313,7 +313,7 @@ hb_cairo_paint_custom_palette_color (hb_paint_funcs_t *funcs, hb_color_t *color, void *user_data HB_UNUSED) { -#ifdef CAIRO_COLOR_PALETTE_CUSTOM +#ifdef HAVE_CAIRO_FONT_OPTIONS_GET_CUSTOM_PALETTE_COLOR cairo_t *cr = (cairo_t *) paint_data; cairo_font_options_t *options; @@ -321,7 +321,8 @@ hb_cairo_paint_custom_palette_color (hb_paint_funcs_t *funcs, options = cairo_font_options_create (); cairo_get_font_options (cr, options); - if (cairo_font_options_get_custom_palette_color (options, color_index, + if (CAIRO_STATUS_SUCCESS == + cairo_font_options_get_custom_palette_color (options, color_index, &red, &green, &blue, &alpha)) { cairo_font_options_destroy (options); diff --git a/util/helper-cairo.hh b/util/helper-cairo.hh index ca7f469c1..aa3905ce1 100644 --- a/util/helper-cairo.hh +++ b/util/helper-cairo.hh @@ -126,7 +126,7 @@ helper_cairo_create_scaled_font (const font_options_t *font_opts, #ifdef CAIRO_COLOR_PALETTE_DEFAULT cairo_font_options_set_color_palette (font_options, view_opts->palette); #endif -#ifdef CAIRO_COLOR_PALETTE_CUSTOM +#ifdef HAVE_CAIRO_FONT_OPTIONS_GET_CUSTOM_PALETTE_COLOR if (view_opts->custom_palette) { char **entries = g_strsplit (view_opts->custom_palette, ",", -1);