[cff-subset] Compact charstrings just after parsing
Massive peak-memory saving when processing face.
This commit is contained in:
parent
a7617c3cf1
commit
4dda1f7881
|
@ -676,6 +676,11 @@ struct subr_subsetter_t
|
||||||
parsed_charstrings[i].set_vsindex_dropped ();
|
parsed_charstrings[i].set_vsindex_dropped ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Doing this here one by one instead of compacting all at the en
|
||||||
|
* has massive peak-memory saving. */
|
||||||
|
if (plan->inprogress_accelerator)
|
||||||
|
compact_string (parsed_charstrings[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since parsed strings were loaded from accelerator, we still need
|
// Since parsed strings were loaded from accelerator, we still need
|
||||||
|
@ -990,10 +995,8 @@ struct subr_subsetter_t
|
||||||
return !encoder.in_error ();
|
return !encoder.in_error ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void compact_parsed_strings () const
|
void compact_parsed_subrs () const
|
||||||
{
|
{
|
||||||
for (auto &cs : parsed_charstrings)
|
|
||||||
compact_string (cs);
|
|
||||||
for (auto &cs : parsed_global_subrs_storage)
|
for (auto &cs : parsed_global_subrs_storage)
|
||||||
compact_string (cs);
|
compact_string (cs);
|
||||||
for (auto &vec : parsed_local_subrs_storage)
|
for (auto &vec : parsed_local_subrs_storage)
|
||||||
|
@ -1034,7 +1037,7 @@ struct subr_subsetter_t
|
||||||
{
|
{
|
||||||
if (!plan->inprogress_accelerator) return;
|
if (!plan->inprogress_accelerator) return;
|
||||||
|
|
||||||
compact_parsed_strings ();
|
compact_parsed_subrs ();
|
||||||
|
|
||||||
plan->inprogress_accelerator->cff_accelerator =
|
plan->inprogress_accelerator->cff_accelerator =
|
||||||
cff_subset_accelerator_t::create(acc.blob,
|
cff_subset_accelerator_t::create(acc.blob,
|
||||||
|
|
Loading…
Reference in New Issue