From 0bff5704912fb99789ca7e09d3fafb640c2ccfed Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 18 Jan 2023 22:33:32 -0700 Subject: [PATCH] [hb-view] Use custom palette if any set --- util/helper-cairo.hh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/util/helper-cairo.hh b/util/helper-cairo.hh index 114d79e86..c2a2eda77 100644 --- a/util/helper-cairo.hh +++ b/util/helper-cairo.hh @@ -122,12 +122,11 @@ helper_cairo_create_scaled_font (const font_options_t *font_opts) font_options = cairo_font_options_create (); cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE); cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_OFF); -#ifdef CAIRO_COLOR_PALETTE_DEFAULT - cairo_font_options_set_color_palette (font_options, font_opts->palette); -#endif + unsigned palette_index = font_opts->palette; #ifdef CAIRO_COLOR_PALETTE_CUSTOM if (font_opts->custom_palette) { + palette_index = HB_PAINT_PALETTE_INDEX_CUSTOM; char **entries = g_strsplit (font_opts->custom_palette, ",", -1); for (unsigned int i = 0; entries[i]; i++) { @@ -137,6 +136,9 @@ helper_cairo_create_scaled_font (const font_options_t *font_opts) } } #endif +#ifdef CAIRO_COLOR_PALETTE_DEFAULT + cairo_font_options_set_color_palette (font_options, palette_index); +#endif cairo_scaled_font_t *scaled_font = cairo_scaled_font_create (cairo_face, &font_matrix,