[subset-cff2] Don't encode vsindex in Private dict

This commit is contained in:
Behdad Esfahbod 2023-02-19 11:16:51 -07:00
parent 220caa7e09
commit bf4b34e87e
2 changed files with 10 additions and 6 deletions

View File

@ -192,8 +192,8 @@ struct cff_font_dict_op_serializer_t : op_serializer_t
struct cff_private_dict_op_serializer_t : op_serializer_t
{
cff_private_dict_op_serializer_t (bool desubroutinize_, bool drop_hints_)
: desubroutinize (desubroutinize_), drop_hints (drop_hints_) {}
cff_private_dict_op_serializer_t (bool desubroutinize_, bool drop_hints_, bool pinned_ = false)
: desubroutinize (desubroutinize_), drop_hints (drop_hints_), pinned (pinned_) {}
bool serialize (hb_serialize_context_t *c,
const op_str_t &opstr,
@ -202,7 +202,10 @@ struct cff_private_dict_op_serializer_t : op_serializer_t
TRACE_SERIALIZE (this);
if (drop_hints && dict_opset_t::is_hint_op (opstr.op))
return true;
return_trace (true);
if (pinned && opstr.op == OpCode_vsindexdict)
return_trace (true);
if (opstr.op == OpCode_Subrs)
{
if (desubroutinize || !subrs_link)
@ -217,6 +220,7 @@ struct cff_private_dict_op_serializer_t : op_serializer_t
protected:
const bool desubroutinize;
const bool drop_hints;
const bool pinned;
};
struct flatten_param_t

View File

@ -361,7 +361,7 @@ static bool _serialize_cff2 (hb_serialize_context_t *c,
PrivateDict *pd = c->start_embed<PrivateDict> ();
if (unlikely (!pd)) return false;
c->push ();
cff_private_dict_op_serializer_t privSzr (plan.desubroutinize, plan.drop_hints);
cff_private_dict_op_serializer_t privSzr (plan.desubroutinize, plan.drop_hints, plan.pinned);
if (likely (pd->serialize (c, acc.privateDicts[i], privSzr, subrs_link)))
{
unsigned fd = plan.fdmap[i];