Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Use OVER operator for drawing text (#2908)
Browse files Browse the repository at this point in the history
For opaque text, SOURCE is not any different from OVER. However, when
drawing color glyphs (which consist of RGBA pixels instead of strokes)
SOURCE's handling of alpha is not what we want.

I stumbled across this because cairo 1.15.8 seems to clear the surface
before drawing color emoji if the operator is SOURCE, deleting every-
thing drawn before. Arguably, the area outside the glyph bounds should
not be touched, but even if this is a cairo bug the problem of alpha
within the glyph remains.
  • Loading branch information
heftig authored and stapelberg committed Sep 9, 2017
1 parent 48fd641 commit 1616046
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libi3/font.c
Expand Up @@ -105,7 +105,7 @@ static void draw_text_pango(const char *text, size_t text_len,
pango_layout_set_text(layout, text, text_len);

/* Do the drawing */
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
cairo_set_source_rgb(cr, pango_font_red, pango_font_green, pango_font_blue);
pango_cairo_update_layout(cr, layout);
pango_layout_get_pixel_size(layout, NULL, &height);
Expand Down

0 comments on commit 1616046

Please sign in to comment.