hb-view: Pass fg color to hb_font_paint_glyph
This commit is contained in:
parent
9be01b6bff
commit
d094e76cbc
|
@ -350,12 +350,21 @@ render_color_glyph (cairo_scaled_font_t *scaled_font,
|
|||
{
|
||||
hb_font_t *font = (hb_font_t *) (cairo_font_face_get_user_data (cairo_scaled_font_get_font_face (scaled_font),
|
||||
&_hb_font_cairo_user_data_key));
|
||||
hb_color_t color = HB_COLOR (0, 0, 0, 255);
|
||||
cairo_pattern_t *pattern = cairo_get_source (cr);
|
||||
|
||||
if (cairo_pattern_get_type (pattern) == CAIRO_PATTERN_TYPE_SOLID)
|
||||
{
|
||||
double r, g, b, a;
|
||||
cairo_pattern_get_rgba (pattern, &r, &g, &b, &a);
|
||||
color = HB_COLOR ((int)(b * 255.), (int)(g * 255.), (int) (r * 255.), (int)(a * 255.));
|
||||
}
|
||||
|
||||
hb_position_t x_scale, y_scale;
|
||||
hb_font_get_scale (font, &x_scale, &y_scale);
|
||||
cairo_scale (cr, +1./x_scale, -1./y_scale);
|
||||
|
||||
hb_font_paint_glyph (font, glyph, get_cairo_paint_funcs (), cr, 0, HB_COLOR (0, 0, 0, 255));
|
||||
hb_font_paint_glyph (font, glyph, get_cairo_paint_funcs (), cr, 0, color);
|
||||
|
||||
hb_glyph_extents_t hb_extents;
|
||||
hb_font_get_glyph_extents (font, glyph, &hb_extents);
|
||||
|
|
Loading…
Reference in New Issue