Add cairo_user_font_face_get_render_color_glyph_func

This commit is contained in:
Adrian Johnson 2021-08-14 18:14:44 +09:30
parent 48d6061149
commit 8c3c41ca73
3 changed files with 36 additions and 3 deletions

View file

@ -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

View file

@ -870,6 +870,34 @@ cairo_user_font_face_get_init_func (cairo_font_face_t *font_face)
return user_font_face->scaled_font_methods.init;
}
/**
* 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

View file

@ -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);