summaryrefslogtreecommitdiff
path: root/test/user-font-color.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2021-08-30 20:41:18 +0930
committerAdrian Johnson <ajohnson@redneon.com>2021-09-18 07:05:35 +0930
commit8ea4ae5413bd8ae1497e11a473d173cfc2475ae6 (patch)
tree7fc073d2416c0d95c3c5ce5c2277db4b3db36c7e /test/user-font-color.c
parent994e33215e35e49981dea5b459a9b5b85d4cd1b1 (diff)
downloadcairo-8ea4ae5413bd8ae1497e11a473d173cfc2475ae6.tar.gz
Allow user fonts to use the foreground color
Diffstat (limited to 'test/user-font-color.c')
-rw-r--r--test/user-font-color.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/user-font-color.c b/test/user-font-color.c
index 437e57a27..781d6945d 100644
--- a/test/user-font-color.c
+++ b/test/user-font-color.c
@@ -57,13 +57,15 @@ test_scaled_font_init (cairo_scaled_font_t *scaled_font,
static void
render_glyph_solid (cairo_t *cr, double width, double height, cairo_bool_t color)
{
+ cairo_pattern_t *pattern = cairo_pattern_reference(cairo_get_source (cr));
+
if (color)
cairo_set_source_rgba (cr, 0, 1, 1, 0.5);
cairo_rectangle (cr, 0, 0, width/2, height/2);
cairo_fill (cr);
if (color)
- cairo_set_source_rgba (cr, 1, 0, 1, 0.5);
+ cairo_set_source (cr, pattern);
cairo_rectangle (cr, width/4, height/4, width/2, height/2);
cairo_fill (cr);
@@ -71,6 +73,8 @@ render_glyph_solid (cairo_t *cr, double width, double height, cairo_bool_t color
cairo_set_source_rgba (cr, 1, 1, 0, 0.5);
cairo_rectangle (cr, width/2, height/2, width/2, height/2);
cairo_fill (cr);
+
+ cairo_pattern_destroy (pattern);
}
static void
@@ -236,7 +240,7 @@ draw (cairo_t *cr, int width, int height)
cairo_stroke (cr);
/* text in color */
- cairo_set_source_rgb (cr, 0, 0, 0);
+ cairo_set_source_rgb (cr, 0, 0.3, 0);
cairo_move_to (cr, BORDER, BORDER + font_extents.ascent);
cairo_show_text (cr, text);