[subset] add an inprogress accelerator to plan.

This allows subset code to cache information into the accelerator during preprocess subset. Previously the accelerator was created at the end of subsetting.
This commit is contained in:
Garret Rieger 2022-11-23 20:24:40 +00:00 committed by Behdad Esfahbod
parent 81640fdffe
commit 2c0afde737
3 changed files with 21 additions and 5 deletions

View File

@ -926,6 +926,17 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
hb_subset_plan_destroy (plan);
return nullptr;
}
if (plan->attach_accelerator_data)
{
plan->inprogress_accelerator =
hb_subset_accelerator_t::create (*plan->codepoint_to_glyph,
*plan->unicodes,
plan->has_seac);
}
return plan;
}

View File

@ -96,6 +96,9 @@ struct hb_subset_plan_t
hb_hashmap_destroy (name_table_overrides);
#endif
if (inprogress_accelerator)
hb_subset_accelerator_t::destroy ((void*) inprogress_accelerator);
if (user_axes_location)
{
hb_object_destroy (user_axes_location);
@ -209,6 +212,7 @@ struct hb_subset_plan_t
#endif
const hb_subset_accelerator_t* accelerator;
hb_subset_accelerator_t* inprogress_accelerator;
public:

View File

@ -499,13 +499,14 @@ _subset_table (hb_subset_plan_t *plan,
}
}
static void _attach_accelerator_data (const hb_subset_plan_t* plan,
static void _attach_accelerator_data (hb_subset_plan_t* plan,
hb_face_t* face /* IN/OUT */)
{
hb_subset_accelerator_t* accel =
hb_subset_accelerator_t::create (*plan->codepoint_to_glyph,
*plan->unicodes,
plan->has_seac);
if (!plan->inprogress_accelerator) return;
// Transfer the accelerator from the plan to us.
hb_subset_accelerator_t* accel = plan->inprogress_accelerator;
plan->inprogress_accelerator = nullptr;
if (accel->in_error ())
{