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
This commit is contained in:
parent
aea37bfd37
commit
c37ea4f93e
|
@ -585,11 +585,9 @@ hb_cairo_render_color_glyph (cairo_scaled_font_t *scaled_font,
|
||||||
cairo_font_options_destroy (options);
|
cairo_font_options_destroy (options);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
hb_color_t color = HB_COLOR (0, 0, 0, 255);
|
|
||||||
cairo_pattern_t *pattern = cairo_get_source (cr);
|
|
||||||
double r, g, b, a;
|
double r, g, b, a;
|
||||||
if (cairo_pattern_get_rgba (pattern, &r, &g, &b, &a) == CAIRO_STATUS_SUCCESS)
|
cairo_user_scaled_font_get_foreground_color (scaled_font, &r, &g, &b, &a);
|
||||||
color = HB_COLOR (round (b * 255.), round (g * 255.), round (r * 255.), round (a * 255.));
|
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_position_t x_scale, y_scale;
|
||||||
hb_font_get_scale (font, &x_scale, &y_scale);
|
hb_font_get_scale (font, &x_scale, &y_scale);
|
||||||
|
|
Loading…
Reference in New Issue