diff options
-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 8533d44ba..8ff16cc1b 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -1746,17 +1746,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. * @@ -1943,6 +1943,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); |