[COLR,glyf] Use map instead of set for tracking current glyphs / layers

pull/4379/head
Behdad Esfahbod 1 year ago
parent b530e485cd
commit 06ff3bcb8d
  1. 4
      src/OT/Color/COLR/COLR.hh
  2. 4
      src/OT/glyf/Glyph.hh
  3. 4
      src/hb-ft-colr.hh
  4. 5
      src/hb-map.hh

@ -69,8 +69,8 @@ public:
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;

@ -293,7 +293,7 @@ struct Glyph
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 @@ struct Glyph
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 = &current_glyphs_stack;

@ -105,8 +105,8 @@ struct hb_ft_paint_context_t
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;
};

@ -276,6 +276,11 @@ struct hb_hashmap_t
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
{

Loading…
Cancel
Save