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