summaryrefslogtreecommitdiff
path: root/src/cairoint.h
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2021-08-27 23:12:24 +0930
committerAdrian Johnson <ajohnson@redneon.com>2021-08-28 18:07:01 +0930
commitfea24631076f74a3202ba0233be85588ae28db36 (patch)
tree1df67721f194ad6f161d5d63ddd146d05a0d0b68 /src/cairoint.h
parent5e76dd7a5c0585515eeef5099f12b273c94d3b0f (diff)
downloadcairo-fea24631076f74a3202ba0233be85588ae28db36.tar.gz
Support color fonts that use the foreground color
COLR fonts can have a layer with the same color as the current text color. This change passes the current color (if solid) through to the font backend where it can be used to render color fonts. scaled_glyph_lookup checks if the foreground color has changed (for glyph that require it) and requests a new color surface if required. This also fixes a bug where scaled_glyph_lookup would always request a color surface for glyphs for glyphs in color fonts that do not have color.
Diffstat (limited to 'src/cairoint.h')
-rw-r--r--src/cairoint.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/cairoint.h b/src/cairoint.h
index 1e0cb4bf1..c5872b8cc 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -519,10 +519,24 @@ struct _cairo_scaled_font_backend {
void
(*fini) (void *scaled_font);
+/**
+ * Get the requested glyph info.
+ * @scaled_font: a #cairo_scaled_font_t
+ * @scaled_glyph: a #cairo_scaled_glyph_t the glyph
+ * @info: a #cairo_scaled_glyph_info_t which information to retreive
+ * %CAIRO_SCALED_GLYPH_INFO_METRICS - glyph metrics and bounding box
+ * %CAIRO_SCALED_GLYPH_INFO_SURFACE - surface holding glyph image
+ * %CAIRO_SCALED_GLYPH_INFO_PATH - path holding glyph outline in device space
+ * %CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE - surface holding recording of glyph
+ * %CAIRO_SCALED_GLYPH_INFO_COLOR_SURFACE - surface holding color glyph image
+ * @foreground_color - foreground color to use when rendering color fonts. Use NULL
+ * if not requesting CAIRO_SCALED_GLYPH_INFO_COLOR_SURFACE or foreground color is unknown.
+ */
cairo_warn cairo_int_status_t
(*scaled_glyph_init) (void *scaled_font,
cairo_scaled_glyph_t *scaled_glyph,
- cairo_scaled_glyph_info_t info);
+ cairo_scaled_glyph_info_t info,
+ const cairo_color_t *foreground_color);
/* A backend only needs to implement this or ucs4_to_index(), not
* both. This allows the backend to do something more sophisticated
@@ -1284,12 +1298,14 @@ _cairo_scaled_glyph_set_recording_surface (cairo_scaled_glyph_t *scaled_glyph,
cairo_private void
_cairo_scaled_glyph_set_color_surface (cairo_scaled_glyph_t *scaled_glyph,
cairo_scaled_font_t *scaled_font,
- cairo_image_surface_t *surface);
+ cairo_image_surface_t *surface,
+ cairo_bool_t uses_foreground_color);
cairo_private cairo_int_status_t
_cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
unsigned long index,
cairo_scaled_glyph_info_t info,
+ const cairo_color_t *foreground_color,
cairo_scaled_glyph_t **scaled_glyph_ret);
cairo_private double