[subset-cff] Pre-size map in subr_remap_t::create()

This commit is contained in:
Behdad Esfahbod 2022-05-18 12:39:55 -06:00
parent ce60462173
commit e91863b717
2 changed files with 7 additions and 0 deletions

View File

@ -39,6 +39,12 @@ struct hb_bimap_t
back_map.reset ();
}
void resize (unsigned pop)
{
forw_map.resize (pop);
back_map.resize (pop);
}
bool in_error () const { return forw_map.in_error () || back_map.in_error (); }
void set (hb_codepoint_t lhs, hb_codepoint_t rhs)

View File

@ -466,6 +466,7 @@ struct subr_remap_t : hb_inc_bimap_t
* no optimization based on usage counts. fonttools doesn't appear doing that either.
*/
resize (closure->get_population ());
hb_codepoint_t old_num = HB_SET_VALUE_INVALID;
while (hb_set_next (closure, &old_num))
add (old_num);