[cairo] [PATCH 3/6] Expose 'has color glyphs' as a scaled font property

matthias.clasen at gmail.com matthias.clasen at gmail.com
Sat Apr 9 03:22:30 UTC 2016


From: Matthias Clasen <mclasen at redhat.com>

This information will be used in subsequent commits to quickly
decide that we won't try to handle glpyhs as masks. Implementing
the new has_color_glyphs vfunc is optional - only backends that
support color glyphs need to implement it.
---
 src/cairo-scaled-font-private.h | 2 ++
 src/cairo-scaled-font.c         | 9 +++++++++
 src/cairoint.h                  | 3 +++
 3 files changed, 14 insertions(+)

diff --git a/src/cairo-scaled-font-private.h b/src/cairo-scaled-font-private.h
index 6ce6bb6..317d211 100644
--- a/src/cairo-scaled-font-private.h
+++ b/src/cairo-scaled-font-private.h
@@ -178,6 +178,8 @@ _cairo_scaled_glyph_attach_private (cairo_scaled_glyph_t *scaled_glyph,
 				   void (*destroy) (cairo_scaled_glyph_private_t *,
 						    cairo_scaled_glyph_t *,
 						    cairo_scaled_font_t *));
+cairo_private cairo_bool_t
+_cairo_scaled_font_has_color_glyphs (cairo_scaled_font_t *scaled_font);
 
 CAIRO_END_DECLS
 
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 27a52b2..508c962 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -3178,3 +3178,12 @@ cairo_scaled_font_get_font_options (cairo_scaled_font_t		*scaled_font,
     _cairo_font_options_init_copy (options, &scaled_font->options);
 }
 slim_hidden_def (cairo_scaled_font_get_font_options);
+
+cairo_bool_t
+_cairo_scaled_font_has_color_glyphs (cairo_scaled_font_t *scaled_font)
+{
+    if (scaled_font->backend != NULL && scaled_font->backend->has_color_glyphs != NULL)
+        return scaled_font->backend->has_color_glyphs (scaled_font);
+    else
+       return FALSE;
+}
diff --git a/src/cairoint.h b/src/cairoint.h
index 6fb020f..01ffd32 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -598,6 +598,9 @@ struct _cairo_scaled_font_backend {
                            long                  offset,
                            unsigned char        *buffer,
                            unsigned long        *length);
+
+    cairo_bool_t
+    (*has_color_glyphs)   (void                 *scaled_font);
 };
 
 struct _cairo_font_face_backend {
-- 
2.7.3



More information about the cairo mailing list