[subset-cff2] Don't serialize VarStore if pinned

This commit is contained in:
Behdad Esfahbod 2023-02-19 10:47:36 -07:00
parent 8c1b47d7e2
commit a88f3e8d37
1 changed files with 8 additions and 5 deletions

View File

@ -243,16 +243,17 @@ struct cff2_subr_subsetter_t : subr_subsetter_t<cff2_subr_subsetter_t, CFF2Subrs
}
};
struct cff2_subset_plan {
struct cff2_subset_plan
{
bool create (const OT::cff2::accelerator_subset_t &acc,
hb_subset_plan_t *plan)
{
orig_fdcount = acc.fdArray->count;
drop_hints = plan->flags & HB_SUBSET_FLAGS_NO_HINTING;
pinned = (bool) plan->normalized_coords;
desubroutinize = plan->flags & HB_SUBSET_FLAGS_DESUBROUTINIZE ||
plan->normalized_coords; // For instancing we need this path
pinned; // For instancing we need this path
if (desubroutinize)
{
@ -313,6 +314,7 @@ struct cff2_subset_plan {
unsigned int subset_fdcount = 1;
unsigned int subset_fdselect_size = 0;
unsigned int subset_fdselect_format = 0;
bool pinned = false;
hb_vector_t<code_pair_t> subset_fdselect_ranges;
hb_inc_bimap_t fdmap;
@ -424,7 +426,8 @@ static bool _serialize_cff2 (hb_serialize_context_t *c,
}
/* variation store */
if (acc.varStore != &Null (CFF2VariationStore))
if (acc.varStore != &Null (CFF2VariationStore) &&
!plan.pinned)
{
c->push ();
CFF2VariationStore *dest = c->start_embed<CFF2VariationStore> ();