[COLR,glyf] Use map instead of set for tracking current glyphs / layers
diff --git a/src/OT/Color/COLR/COLR.hh b/src/OT/Color/COLR/COLR.hh index 3618a02..012c381 100644 --- a/src/OT/Color/COLR/COLR.hh +++ b/src/OT/Color/COLR/COLR.hh
@@ -69,8 +69,8 @@ unsigned int palette_index; hb_color_t foreground; VarStoreInstancer &instancer; - hb_set_t current_glyphs; - hb_set_t current_layers; + hb_map_t current_glyphs; + hb_map_t current_layers; int depth_left = HB_MAX_NESTING_LEVEL; int edge_count = HB_COLRV1_MAX_EDGE_COUNT;
diff --git a/src/OT/glyf/Glyph.hh b/src/OT/glyf/Glyph.hh index 9117fe8..1aed3ae 100644 --- a/src/OT/glyf/Glyph.hh +++ b/src/OT/glyf/Glyph.hh
@@ -293,7 +293,7 @@ bool use_my_metrics = true, bool phantom_only = false, hb_array_t<int> coords = hb_array_t<int> (), - hb_set_t *current_glyphs = nullptr, + hb_map_t *current_glyphs = nullptr, unsigned int depth = 0, unsigned *edge_count = nullptr) const { @@ -303,7 +303,7 @@ if (unlikely (*edge_count > HB_GLYF_MAX_EDGE_COUNT)) return false; (*edge_count)++; - hb_set_t current_glyphs_stack; + hb_map_t current_glyphs_stack; if (current_glyphs == nullptr) current_glyphs = ¤t_glyphs_stack;
diff --git a/src/hb-ft-colr.hh b/src/hb-ft-colr.hh index 2690316..1afbbbb 100644 --- a/src/hb-ft-colr.hh +++ b/src/hb-ft-colr.hh
@@ -105,8 +105,8 @@ FT_Color *palette; unsigned palette_index; hb_color_t foreground; - hb_set_t current_glyphs; - hb_set_t current_layers; + hb_map_t current_glyphs; + hb_map_t current_layers; int depth_left = HB_MAX_NESTING_LEVEL; int edge_count = HB_COLRV1_MAX_EDGE_COUNT; };
diff --git a/src/hb-map.hh b/src/hb-map.hh index 42604ef..6ea4166 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh
@@ -276,6 +276,11 @@ uint32_t hash = hb_hash (key); return set_with_hash (std::move (key), hash, std::forward<VV> (value), overwrite); } + bool add (const K &key) + { + uint32_t hash = hb_hash (key); + return set_with_hash (key, hash, item_t::default_value ()); + } const V& get_with_hash (const K &key, uint32_t hash) const {