From c37ea4f93ed726c37739325e3f181b3973182e29 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 23 Jan 2023 08:31:24 -0500 Subject: [PATCH] hb-cairo: Fix handling of foreground color Use the new cairo_user_scaled_font_get_foreground_color to obtain the foreground color, since the cr's source can't be trusted. Requires https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/420 --- src/hb-cairo.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/hb-cairo.cc b/src/hb-cairo.cc index b0bcb4a0f..f3d090fd6 100644 --- a/src/hb-cairo.cc +++ b/src/hb-cairo.cc @@ -585,11 +585,9 @@ hb_cairo_render_color_glyph (cairo_scaled_font_t *scaled_font, cairo_font_options_destroy (options); #endif - hb_color_t color = HB_COLOR (0, 0, 0, 255); - cairo_pattern_t *pattern = cairo_get_source (cr); double r, g, b, a; - if (cairo_pattern_get_rgba (pattern, &r, &g, &b, &a) == CAIRO_STATUS_SUCCESS) - color = HB_COLOR (round (b * 255.), round (g * 255.), round (r * 255.), round (a * 255.)); + cairo_user_scaled_font_get_foreground_color (scaled_font, &r, &g, &b, &a); + hb_color_t color = HB_COLOR (round (b * 255.), round (g * 255.), round (r * 255.), round (a * 255.)); hb_position_t x_scale, y_scale; hb_font_get_scale (font, &x_scale, &y_scale);