diff options
author | Uli Schlachter <psychon@znc.in> | 2021-08-15 13:56:42 +0000 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2021-08-15 13:56:42 +0000 |
commit | 3dc9607f8d080d7256c70d3b4452f47f8346d64a (patch) | |
tree | 41c19ae1f20ef82f17bc3ac2a5bb13925176d7a6 | |
parent | c773060195c5aee7d84208188bed5740a28747a8 (diff) | |
parent | 8c3c41ca737e35740cd2fd7ddf09533f0453dc91 (diff) | |
download | cairo-3dc9607f8d080d7256c70d3b4452f47f8346d64a.tar.gz |
Merge branch 'color-user-font-getter' into 'master'
Add cairo_user_font_face_get_render_color_glyph_func
See merge request cairo/cairo!233
-rw-r--r-- | doc/public/cairo-sections.txt | 2 | ||||
-rw-r--r-- | src/cairo-user-font.c | 28 | ||||
-rw-r--r-- | src/cairo.h | 9 |
3 files changed, 36 insertions, 3 deletions
diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt index 4ea86b4db..be958eef1 100644 --- a/doc/public/cairo-sections.txt +++ b/doc/public/cairo-sections.txt @@ -45,6 +45,8 @@ cairo_user_font_face_set_init_func cairo_user_font_face_get_init_func cairo_user_font_face_set_render_glyph_func cairo_user_font_face_get_render_glyph_func +cairo_user_font_face_set_render_color_glyph_func +cairo_user_font_face_get_render_color_glyph_func cairo_user_font_face_set_unicode_to_glyph_func cairo_user_font_face_get_unicode_to_glyph_func cairo_user_font_face_set_text_to_glyphs_func diff --git a/src/cairo-user-font.c b/src/cairo-user-font.c index 9b8872db5..089b64ad2 100644 --- a/src/cairo-user-font.c +++ b/src/cairo-user-font.c @@ -871,6 +871,34 @@ cairo_user_font_face_get_init_func (cairo_font_face_t *font_face) } /** + * cairo_user_font_face_get_render_color_glyph_func: + * @font_face: A user font face + * + * Gets the color glyph rendering function of a user-font. + * + * Return value: The render_glyph callback of @font_face + * or %NULL if none set or an error has occurred. + * + * Since: 1.18 + **/ +cairo_user_scaled_font_render_glyph_func_t +cairo_user_font_face_get_render_color_glyph_func (cairo_font_face_t *font_face) +{ + cairo_user_font_face_t *user_font_face; + + if (font_face->status) + return NULL; + + if (! _cairo_font_face_is_user (font_face)) { + if (_cairo_font_face_set_error (font_face, CAIRO_STATUS_FONT_TYPE_MISMATCH)) + return NULL; + } + + user_font_face = (cairo_user_font_face_t *) font_face; + return user_font_face->scaled_font_methods.render_color_glyph; +} + +/** * cairo_user_font_face_get_render_glyph_func: * @font_face: A user font face * diff --git a/src/cairo.h b/src/cairo.h index ce679b9ca..a3c5bc11f 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -1749,17 +1749,17 @@ typedef cairo_status_t (*cairo_user_scaled_font_init_func_t) (cairo_scaled_font_ * * The callback is mandatory, and expected to draw the glyph with code @glyph to * the cairo context @cr. @cr is prepared such that the glyph drawing is done in - * font space. That is, the matrix set on @cr is the scale matrix of @scaled_font, + * font space. That is, the matrix set on @cr is the scale matrix of @scaled_font. * The @extents argument is where the user font sets the font extents for * @scaled_font. However, if user prefers to draw in user space, they can * achieve that by changing the matrix on @cr. * * All cairo rendering operations to @cr are permitted. However, when - * this callback set with + * this callback is set with * cairo_user_font_face_set_render_glyph_func(), the result is * undefined if any source other than the default source on @cr is * used. That means, glyph bitmaps should be rendered using - * cairo_mask() instead of cairo_paint(). When this callback set with + * cairo_mask() instead of cairo_paint(). When this callback is set with * cairo_user_font_face_set_render_color_glyph_func(), setting the * source is a valid operation. * @@ -1946,6 +1946,9 @@ cairo_user_font_face_get_init_func (cairo_font_face_t *font_face); cairo_public cairo_user_scaled_font_render_glyph_func_t cairo_user_font_face_get_render_glyph_func (cairo_font_face_t *font_face); +cairo_public cairo_user_scaled_font_render_glyph_func_t +cairo_user_font_face_get_render_color_glyph_func (cairo_font_face_t *font_face); + cairo_public cairo_user_scaled_font_text_to_glyphs_func_t cairo_user_font_face_get_text_to_glyphs_func (cairo_font_face_t *font_face); |