[cairo-commit] 2 commits - doc/public src/cairo.h src/cairo-user-font.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Aug 15 13:56:45 UTC 2021


 doc/public/cairo-sections.txt |    2 ++
 src/cairo-user-font.c         |   28 ++++++++++++++++++++++++++++
 src/cairo.h                   |    9 ++++++---
 3 files changed, 36 insertions(+), 3 deletions(-)

New commits:
commit 3dc9607f8d080d7256c70d3b4452f47f8346d64a
Merge: c77306019 8c3c41ca7
Author: Uli Schlachter <psychon at znc.in>
Date:   Sun Aug 15 13:56:42 2021 +0000

    Merge branch 'color-user-font-getter' into 'master'
    
    Add cairo_user_font_face_get_render_color_glyph_func
    
    See merge request cairo/cairo!233

commit 8c3c41ca737e35740cd2fd7ddf09533f0453dc91
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Aug 14 18:14:44 2021 +0930

    Add cairo_user_font_face_get_render_color_glyph_func

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


More information about the cairo-commit mailing list