[subset-plan] Add a couple of map pre-allocations

Approximate...
This commit is contained in:
Behdad Esfahbod 2023-06-02 15:41:47 -06:00
parent 76904b0423
commit 7319d0d712

View file

@ -547,6 +547,8 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
unicodes->get_population () < cmap_unicodes->get_population () &&
glyphs->get_population () < cmap_unicodes->get_population ())
{
plan->codepoint_to_glyph->resize (unicodes->get_population () + glyphs->get_population ());
auto &gid_to_unicodes = plan->accelerator->gid_to_unicodes;
for (hb_codepoint_t gid : *glyphs)
{
@ -575,6 +577,7 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
}
else
{
plan->codepoint_to_glyph->resize (cmap_unicodes->get_population ());
for (hb_codepoint_t cp : *cmap_unicodes)
{
hb_codepoint_t gid = (*unicode_glyphid_map)[cp];