From c51d33685db7a85243260585f2e8f0aba904f982 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 11 Jan 2023 11:22:22 -0700 Subject: [PATCH] [subset-plan] Simplify no_subset_tables allocation --- src/hb-subset-plan.cc | 2 +- src/hb-subset-plan.hh | 3 +-- src/hb-subset.cc | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 0f8a27768..1a0152c30 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -848,7 +848,7 @@ hb_subset_plan_create_or_fail (hb_face_t *face, plan->layout_scripts = *input->sets.layout_scripts; plan->glyphs_requested = hb_set_copy (input->sets.glyphs); plan->drop_tables = *input->sets.drop_tables; - plan->no_subset_tables = hb_set_copy (input->sets.no_subset_tables); + plan->no_subset_tables = *input->sets.no_subset_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 1cc729785..a73cb76e7 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -50,7 +50,6 @@ struct hb_subset_plan_t { hb_set_destroy (unicodes); hb_set_destroy (glyphs_requested); - hb_set_destroy (no_subset_tables); hb_face_destroy (source); hb_face_destroy (dest); hb_map_destroy (codepoint_to_glyph); @@ -110,7 +109,7 @@ struct hb_subset_plan_t hb_set_t *glyphs_requested; // Tables which should not be processed, just pass them through. - hb_set_t *no_subset_tables; + hb_set_t no_subset_tables; // Tables which should be dropped. hb_set_t drop_tables; diff --git a/src/hb-subset.cc b/src/hb-subset.cc index 4c47a46a9..71536e5f6 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -168,11 +168,11 @@ _get_table_tags (const hb_subset_plan_t* plan, hb_concat ( + hb_array (known_tables) | hb_filter ([&] (hb_tag_t tag) { - return !_table_is_empty (plan->source, tag) && !plan->no_subset_tables->has (tag); + return !_table_is_empty (plan->source, tag) && !plan->no_subset_tables.has (tag); }) | hb_map ([] (hb_tag_t tag) -> hb_tag_t { return tag; }), - plan->no_subset_tables->iter () + plan->no_subset_tables.iter () | hb_filter([&] (hb_tag_t tag) { return !_table_is_empty (plan->source, tag); })); @@ -424,7 +424,7 @@ _subset_table (hb_subset_plan_t *plan, hb_vector_t &buf, hb_tag_t tag) { - if (plan->no_subset_tables->has (tag)) { + if (plan->no_subset_tables.has (tag)) { return _passthrough (plan, tag); }