diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 84a3fbc5f..4d078b7e3 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -400,6 +400,13 @@ _nameid_closure (hb_face_t *face, #endif } +static hb_set_t* copy (const hb_set_t* other) +{ + hb_set_t* set = hb_set_create (); + set->set (other); + return set; +} + /** * hb_subset_plan_create: * Computes a plan for subsetting the supplied face according @@ -412,7 +419,7 @@ _nameid_closure (hb_face_t *face, **/ hb_subset_plan_t * hb_subset_plan_create (hb_face_t *face, - hb_subset_input_t *input) + const hb_subset_input_t *input) { hb_subset_plan_t *plan; if (unlikely (!(plan = hb_object_create ()))) @@ -428,12 +435,12 @@ hb_subset_plan_create (hb_face_t *face, plan->prune_unicode_ranges = !input->no_prune_unicode_ranges; plan->retain_all_layout_features = input->retain_all_layout_features; plan->unicodes = hb_set_create (); - plan->name_ids = hb_set_reference (input->name_ids); + plan->name_ids = copy (plan->name_ids); _nameid_closure (face, plan->name_ids); - plan->name_languages = hb_set_reference (input->name_languages); - plan->layout_features = hb_set_reference (input->layout_features); - plan->glyphs_requested = hb_set_reference (input->glyphs); - plan->drop_tables = hb_set_reference (input->drop_tables); + plan->name_languages = copy (input->name_languages); + plan->layout_features = copy (input->layout_features); + plan->glyphs_requested = copy (input->glyphs); + plan->drop_tables = copy (input->drop_tables); plan->source = hb_face_reference (face); plan->dest = hb_face_builder_create (); diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index 01117f4b0..6f832ee42 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -204,7 +204,7 @@ typedef struct hb_subset_plan_t hb_subset_plan_t; HB_INTERNAL hb_subset_plan_t * hb_subset_plan_create (hb_face_t *face, - hb_subset_input_t *input); + const hb_subset_input_t *input); HB_INTERNAL void hb_subset_plan_destroy (hb_subset_plan_t *plan); diff --git a/src/hb-subset.cc b/src/hb-subset.cc index d91699de4..1b8cc2967 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -303,7 +303,7 @@ _subset_table (hb_subset_plan_t *plan, hb_tag_t tag) * Subsets a font according to provided input. **/ hb_face_t * -hb_subset (hb_face_t *source, hb_subset_input_t *input) +hb_subset (hb_face_t *source, const hb_subset_input_t *input) { if (unlikely (!input || !source)) return hb_face_get_empty (); diff --git a/src/hb-subset.h b/src/hb-subset.h index 249540f02..1df8cfbbf 100644 --- a/src/hb-subset.h +++ b/src/hb-subset.h @@ -119,7 +119,7 @@ hb_subset_input_get_no_prune_unicode_ranges (hb_subset_input_t *subset_input); /* hb_subset () */ HB_EXTERN hb_face_t * -hb_subset (hb_face_t *source, hb_subset_input_t *input); +hb_subset (hb_face_t *source, const hb_subset_input_t *input); HB_END_DECLS