diff --git a/src/hb-subset-plan-layout.cc b/src/hb-subset-plan-layout.cc index c0c20f094..aa2807b69 100644 --- a/src/hb-subset-plan-layout.cc +++ b/src/hb-subset-plan-layout.cc @@ -35,6 +35,25 @@ using OT::Layout::GPOS; #ifndef HB_NO_SUBSET_LAYOUT +void +remap_used_mark_sets (hb_subset_plan_t *plan, + hb_map_t& used_mark_sets_map) +{ + hb_blob_ptr_t gdef = plan->source_table (); + + if (!gdef->has_data () || !gdef->has_mark_glyph_sets ()) + { + gdef.destroy (); + return; + } + + hb_set_t used_mark_sets; + gdef->get_mark_glyph_sets ().collect_used_mark_sets (plan->_glyphset_gsub, used_mark_sets); + gdef.destroy (); + + remap_indexes (&used_mark_sets, &used_mark_sets_map); +} + /* * Removes all tags from 'tags' that are not in filter. Additionally eliminates any duplicates. * Returns true if anything was removed (not including duplicates). diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 45dd84e80..dc344fabb 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -33,7 +33,7 @@ #include "hb-ot-cmap-table.hh" #include "hb-ot-glyf-table.hh" #include "hb-ot-layout-base-table.hh" -#include "hb-ot-layout-gdef-table.hh" +//#include "hb-ot-layout-gdef-table.hh" #include "hb-ot-cff1-table.hh" #include "hb-ot-cff2-table.hh" #include "OT/Color/COLR/COLR.hh" @@ -337,25 +337,6 @@ _math_closure (hb_subset_plan_t *plan, math.destroy (); } -static inline void -_remap_used_mark_sets (hb_subset_plan_t *plan, - hb_map_t& used_mark_sets_map) -{ - hb_blob_ptr_t gdef = plan->source_table (); - - if (!gdef->has_data () || !gdef->has_mark_glyph_sets ()) - { - gdef.destroy (); - return; - } - - hb_set_t used_mark_sets; - gdef->get_mark_glyph_sets ().collect_used_mark_sets (plan->_glyphset_gsub, used_mark_sets); - gdef.destroy (); - - remap_indexes (&used_mark_sets, &used_mark_sets_map); -} - static inline void _remove_invalid_gids (hb_set_t *glyphs, unsigned int num_glyphs) @@ -1055,8 +1036,10 @@ hb_subset_plan_t::hb_subset_plan_t (hb_face_t *face, for (auto &v : bounds_height_vec) v = 0xFFFFFFFF; +#ifndef HB_NO_SUBSET_LAYOUT if (!drop_tables.has (HB_OT_TAG_GDEF)) - _remap_used_mark_sets (this, used_mark_sets_map); + remap_used_mark_sets (this, used_mark_sets_map); +#endif #ifndef HB_NO_VAR #ifndef HB_NO_BASE diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index e358cb3bc..b1a67b40b 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -296,14 +296,21 @@ struct hb_subset_plan_t } }; -void +// hb-subset-plan implementation is split into multiple files to keep +// compile times more reasonable: +// - hb-subset-plan.cc +// - hb-subset-plan-layout.cc +// +// The functions below are those needed to connect the split files +// above together. +HB_INTERNAL void remap_indexes (const hb_set_t *indexes, hb_map_t *mapping /* OUT */); #ifndef HB_NO_VAR template -void +HB_INTERNAL void remap_variation_indices (const ItemVarStore &var_store, const hb_set_t &variation_indices, const hb_vector_t& normalized_coords, @@ -311,7 +318,7 @@ remap_variation_indices (const ItemVarStore &var_store, bool no_variations, /* all axes pinned */ hb_hashmap_t> &variation_idx_delta_map /* OUT */); -void +HB_INTERNAL void generate_varstore_inner_maps (const hb_set_t& varidx_set, unsigned subtable_count, hb_vector_t &inner_maps /* OUT */); @@ -320,14 +327,19 @@ generate_varstore_inner_maps (const hb_set_t& varidx_set, #ifndef HB_NO_SUBSET_LAYOUT typedef hb_hashmap_t> script_langsys_map; -void layout_nameid_closure (hb_subset_plan_t* plan, - hb_set_t* drop_tables); +HB_INTERNAL void +remap_used_mark_sets (hb_subset_plan_t *plan, + hb_map_t& used_mark_sets_map); -void +HB_INTERNAL void +layout_nameid_closure (hb_subset_plan_t* plan, + hb_set_t* drop_tables); + +HB_INTERNAL void layout_populate_gids_to_retain (hb_subset_plan_t* plan, hb_set_t* drop_tables); -void +HB_INTERNAL void collect_layout_variation_indices (hb_subset_plan_t* plan); #endif