From 7319d0d71226c15c6c744c6d4e2def72cd20b368 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 2 Jun 2023 15:41:47 -0600 Subject: [PATCH] [subset-plan] Add a couple of map pre-allocations Approximate... --- src/hb-subset-plan.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index b72e387ac..506aba0fc 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -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];