[cff] Convert subr_subset_param_t to use constructor

This commit is contained in:
Behdad Esfahbod 2022-05-10 15:38:37 -06:00
parent 96140db485
commit de053e2efb
1 changed files with 31 additions and 28 deletions

View File

@ -398,19 +398,19 @@ struct parsed_cs_str_vec_t : hb_vector_t<parsed_cs_str_t>
struct subr_subset_param_t struct subr_subset_param_t
{ {
void init (parsed_cs_str_t *parsed_charstring_, subr_subset_param_t (parsed_cs_str_t *parsed_charstring_,
parsed_cs_str_vec_t *parsed_global_subrs_, parsed_cs_str_vec_t *parsed_local_subrs_, parsed_cs_str_vec_t *parsed_global_subrs_,
hb_set_t *global_closure_, hb_set_t *local_closure_, parsed_cs_str_vec_t *parsed_local_subrs_,
bool drop_hints_) hb_set_t *global_closure_,
{ hb_set_t *local_closure_,
parsed_charstring = parsed_charstring_; bool drop_hints_) :
current_parsed_str = parsed_charstring; current_parsed_str (parsed_charstring_),
parsed_global_subrs = parsed_global_subrs_; parsed_charstring (parsed_charstring_),
parsed_local_subrs = parsed_local_subrs_; parsed_global_subrs (parsed_global_subrs_),
global_closure = global_closure_; parsed_local_subrs (parsed_local_subrs_),
local_closure = local_closure_; global_closure (global_closure_),
drop_hints = drop_hints_; local_closure (local_closure_),
} drop_hints (drop_hints_) {}
parsed_cs_str_t *get_parsed_str_for_context (call_context_t &context) parsed_cs_str_t *get_parsed_str_for_context (call_context_t &context)
{ {
@ -569,10 +569,11 @@ struct subr_subsetter_t
cs_interpreter_t<ENV, OPSET, subr_subset_param_t> interp; cs_interpreter_t<ENV, OPSET, subr_subset_param_t> interp;
interp.env.init (str, acc, fd); interp.env.init (str, acc, fd);
subr_subset_param_t param; subr_subset_param_t param (&parsed_charstrings[i],
param.init (&parsed_charstrings[i], &parsed_global_subrs,
&parsed_global_subrs, &parsed_local_subrs[fd], &parsed_local_subrs[fd],
&closures.global_closure, &closures.local_closures[fd], &closures.global_closure,
&closures.local_closures[fd],
plan->flags & HB_SUBSET_FLAGS_NO_HINTING); plan->flags & HB_SUBSET_FLAGS_NO_HINTING);
if (unlikely (!interp.interpret (param))) if (unlikely (!interp.interpret (param)))
@ -593,10 +594,11 @@ struct subr_subsetter_t
unsigned int fd = acc.fdSelect->get_fd (glyph); unsigned int fd = acc.fdSelect->get_fd (glyph);
if (unlikely (fd >= acc.fdCount)) if (unlikely (fd >= acc.fdCount))
return false; return false;
subr_subset_param_t param; subr_subset_param_t param (&parsed_charstrings[i],
param.init (&parsed_charstrings[i], &parsed_global_subrs,
&parsed_global_subrs, &parsed_local_subrs[fd], &parsed_local_subrs[fd],
&closures.global_closure, &closures.local_closures[fd], &closures.global_closure,
&closures.local_closures[fd],
plan->flags & HB_SUBSET_FLAGS_NO_HINTING); plan->flags & HB_SUBSET_FLAGS_NO_HINTING);
drop_hints_param_t drop; drop_hints_param_t drop;
@ -618,10 +620,11 @@ struct subr_subsetter_t
unsigned int fd = acc.fdSelect->get_fd (glyph); unsigned int fd = acc.fdSelect->get_fd (glyph);
if (unlikely (fd >= acc.fdCount)) if (unlikely (fd >= acc.fdCount))
return false; return false;
subr_subset_param_t param; subr_subset_param_t param (&parsed_charstrings[i],
param.init (&parsed_charstrings[i], &parsed_global_subrs,
&parsed_global_subrs, &parsed_local_subrs[fd], &parsed_local_subrs[fd],
&closures.global_closure, &closures.local_closures[fd], &closures.global_closure,
&closures.local_closures[fd],
plan->flags & HB_SUBSET_FLAGS_NO_HINTING); plan->flags & HB_SUBSET_FLAGS_NO_HINTING);
collect_subr_refs_in_str (parsed_charstrings[i], param); collect_subr_refs_in_str (parsed_charstrings[i], param);
} }