diff --git a/src/hb-subset-accelerator.hh b/src/hb-subset-accelerator.hh index 5652db147..ecf751748 100644 --- a/src/hb-subset-accelerator.hh +++ b/src/hb-subset-accelerator.hh @@ -43,10 +43,12 @@ struct hb_subset_accelerator_t } static hb_subset_accelerator_t* create(const hb_map_t& unicode_to_gid_, - const hb_set_t& unicodes_) { + const hb_set_t& unicodes_, + bool has_seac_) { hb_subset_accelerator_t* accel = (hb_subset_accelerator_t*) hb_malloc (sizeof(hb_subset_accelerator_t)); new (accel) hb_subset_accelerator_t (unicode_to_gid_, unicodes_); + accel->has_seac = has_seac_; return accel; } @@ -64,6 +66,7 @@ struct hb_subset_accelerator_t const hb_map_t unicode_to_gid; const hb_set_t unicodes; + bool has_seac; // TODO(garretrieger): cumulative glyf checksum map // TODO(garretrieger): sanitized table cache. diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index fb65be0d7..2d989e9c6 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -47,7 +47,7 @@ using OT::Layout::GPOS; typedef hb_hashmap_t> script_langsys_map; #ifndef HB_NO_SUBSET_CFF -static inline void +static inline bool _add_cff_seac_components (const OT::cff1::accelerator_t &cff, hb_codepoint_t gid, hb_set_t *gids_to_retain) @@ -57,7 +57,9 @@ _add_cff_seac_components (const OT::cff1::accelerator_t &cff, { gids_to_retain->add (base_gid); gids_to_retain->add (accent_gid); + return true; } + return false; } #endif @@ -639,9 +641,15 @@ _populate_gids_to_retain (hb_subset_plan_t* plan, else plan->_glyphset->union_ (cur_glyphset); #ifndef HB_NO_SUBSET_CFF - if (cff.is_valid ()) - for (hb_codepoint_t gid : cur_glyphset) - _add_cff_seac_components (cff, gid, plan->_glyphset); + if (!plan->accelerator || plan->accelerator->has_seac) + { + bool has_seac = false; + if (cff.is_valid ()) + for (hb_codepoint_t gid : cur_glyphset) + if (_add_cff_seac_components (cff, gid, plan->_glyphset)) + has_seac = true; + plan->has_seac = has_seac; + } #endif _remove_invalid_gids (plan->_glyphset, plan->source->get_num_glyphs ()); diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index e31030f4e..55d2dcd4d 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -194,6 +194,7 @@ struct hb_subset_plan_t hb_map_t *axes_old_index_tag_map; bool all_axes_pinned; bool pinned_at_default; + bool has_seac; //hmtx metrics map: new gid->(advance, lsb) hb_hashmap_t> *hmtx_map; diff --git a/src/hb-subset.cc b/src/hb-subset.cc index de9322de3..c9d06fb59 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -504,7 +504,8 @@ static void _attach_accelerator_data (const hb_subset_plan_t* plan, { hb_subset_accelerator_t* accel = hb_subset_accelerator_t::create (*plan->codepoint_to_glyph, - *plan->unicodes); + *plan->unicodes, + plan->has_seac); if (accel->in_error ()) {