[subset] Don't trim glyf's again if preprocessed

Speeds up M1/10000 benchmark by 30%!
This commit is contained in:
Behdad Esfahbod 2022-11-21 20:08:54 -07:00
parent 72059a4789
commit b567ce51d3
1 changed files with 5 additions and 1 deletions

View File

@ -394,7 +394,11 @@ glyf::_populate_subset_glyphs (const hb_subset_plan_t *plan,
plan->pinned_at_default)
subset_glyph.source_glyph = glyf_impl::Glyph ();
else
subset_glyph.source_glyph = glyf.glyph_for_gid (subset_glyph.old_gid, true);
{
/* If plan has an accelerator, the preprocessing step already trimmed glyphs.
* Don't trim them again! */
subset_glyph.source_glyph = glyf.glyph_for_gid (subset_glyph.old_gid, !plan->accelerator);
}
if (plan->flags & HB_SUBSET_FLAGS_NO_HINTING)
subset_glyph.drop_hints_bytes ();