From d9875ddc9d7a6b7078906929d98e0606a49f5da4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 23 Dec 2022 12:37:42 -0700 Subject: [PATCH] [ft-colr] Add depth counter --- src/hb-ft-colr.hh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/hb-ft-colr.hh b/src/hb-ft-colr.hh index 070c43e61..51f14f6c0 100644 --- a/src/hb-ft-colr.hh +++ b/src/hb-ft-colr.hh @@ -89,7 +89,12 @@ struct hb_ft_paint_context_t funcs (paint_funcs), data (paint_data), palette (palette), foreground (foreground) {} - void recurse (FT_OpaquePaint paint) { _hb_ft_paint (this, paint); + void recurse (FT_OpaquePaint paint) + { + if (depth_left <= 0) return; + depth_left--; + _hb_ft_paint (this, paint); + depth_left++; } const hb_ft_font_t *ft_font; @@ -98,6 +103,7 @@ struct hb_ft_paint_context_t void *data; FT_Color *palette; hb_color_t foreground; + int depth_left = 128; }; static unsigned @@ -285,7 +291,6 @@ _hb_ft_paint (hb_ft_paint_context_t *c, break; case FT_COLR_PAINTFORMAT_COLR_GLYPH: { - /* TODO Depth counter. */ FT_OpaquePaint other_paint = {0}; if (FT_Get_Color_Glyph_Paint (ft_face, paint.u.colr_glyph.glyphID, FT_COLOR_NO_ROOT_TRANSFORM,