From 4f013c42f0c0d87b068ff349fd96cb3dcff1831d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 2 Jan 2023 10:38:30 -0700 Subject: [PATCH] [subset-cff] Always compact charstrings Reduces non-preprocessed subsetting memory footprint significantly. --- src/hb-subset-cff-common.hh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/hb-subset-cff-common.hh b/src/hb-subset-cff-common.hh index 885bb8dd0..83ec80dca 100644 --- a/src/hb-subset-cff-common.hh +++ b/src/hb-subset-cff-common.hh @@ -678,16 +678,21 @@ struct subr_subsetter_t } /* Doing this here one by one instead of compacting all at the en - * has massive peak-memory saving. */ - if (plan->inprogress_accelerator) + * has massive peak-memory saving. + * + * The compacting both saves memory and makes further operations + * faster. + */ + //if (plan->inprogress_accelerator) compact_string (parsed_charstrings[i]); } - // Since parsed strings were loaded from accelerator, we still need - // to compute the subroutine closures which would have normally happened during - // parsing. - // - // Or if we are dropping hinting, redo closure to get actually used subrs. + /* Since parsed strings were loaded from accelerator, we still need + * to compute the subroutine closures which would have normally happened during + * parsing. + * + * Or if we are dropping hinting, redo closure to get actually used subrs. + */ if ((cff_accelerator || (!cff_accelerator && plan->flags & HB_SUBSET_FLAGS_NO_HINTING)) && !closure_subroutines(*parsed_global_subrs,