summaryrefslogtreecommitdiff
path: root/src/cairo-type3-glyph-surface.c
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/cairo-type3-glyph-surface.c
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/cairo-type3-glyph-surface.c')
-rw-r--r--src/cairo-type3-glyph-surface.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cairo-type3-glyph-surface.c b/src/cairo-type3-glyph-surface.c
index 6b2102319..05ef417dc 100644
--- a/src/cairo-type3-glyph-surface.c
+++ b/src/cairo-type3-glyph-surface.c
@@ -373,6 +373,7 @@ _cairo_type3_glyph_surface_emit_fallback_image (cairo_type3_glyph_surface_t *sur
glyph_index,
CAIRO_SCALED_GLYPH_INFO_METRICS |
CAIRO_SCALED_GLYPH_INFO_SURFACE,
+ NULL, /* foreground color */
&scaled_glyph);
if (unlikely (status))
return status;
@@ -428,6 +429,7 @@ _cairo_type3_glyph_surface_analyze_glyph (void *abstract_surface,
status = _cairo_scaled_glyph_lookup (surface->scaled_font,
glyph_index,
CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE,
+ NULL, /* foreground color */
&scaled_glyph);
if (_cairo_int_status_is_error (status))
@@ -480,11 +482,13 @@ _cairo_type3_glyph_surface_emit_glyph (void *abstract_surface,
glyph_index,
CAIRO_SCALED_GLYPH_INFO_METRICS |
CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE,
+ NULL, /* foreground color */
&scaled_glyph);
if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
status = _cairo_scaled_glyph_lookup (surface->scaled_font,
glyph_index,
CAIRO_SCALED_GLYPH_INFO_METRICS,
+ NULL, /* foreground color */
&scaled_glyph);
if (status == CAIRO_INT_STATUS_SUCCESS)
status = CAIRO_INT_STATUS_IMAGE_FALLBACK;