[subset] Don't go into glyf table if it's empty

This commit is contained in:
Behdad Esfahbod 2022-05-05 10:33:50 -06:00
parent 4fe69bc413
commit 00cb8c629d
2 changed files with 12 additions and 7 deletions

View File

@ -953,6 +953,8 @@ struct glyf
glyf_table.destroy (); glyf_table.destroy ();
} }
bool has_data () const { return num_glyphs; }
protected: protected:
template<typename T> template<typename T>
bool get_points (hb_font_t *font, hb_codepoint_t gid, T consumer) const bool get_points (hb_font_t *font, hb_codepoint_t gid, T consumer) const

View File

@ -393,16 +393,19 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
_remove_invalid_gids (&cur_glyphset, plan->source->get_num_glyphs ()); _remove_invalid_gids (&cur_glyphset, plan->source->get_num_glyphs ());
hb_set_set (plan->_glyphset_colred, &cur_glyphset); hb_set_set (plan->_glyphset_colred, &cur_glyphset);
// Populate a full set of glyphs to retain by adding all referenced
// composite glyphs. /* Populate a full set of glyphs to retain by adding all referenced
for (hb_codepoint_t gid : cur_glyphset) * composite glyphs. */
{ if (glyf.has_data ())
glyf.add_gid_and_children (gid, plan->_glyphset); for (hb_codepoint_t gid : cur_glyphset)
glyf.add_gid_and_children (gid, plan->_glyphset);
else
plan->_glyphset->union_ (cur_glyphset);
#ifndef HB_NO_SUBSET_CFF #ifndef HB_NO_SUBSET_CFF
if (cff.is_valid ()) if (cff.is_valid ())
for (hb_codepoint_t gid : cur_glyphset)
_add_cff_seac_components (cff, gid, plan->_glyphset); _add_cff_seac_components (cff, gid, plan->_glyphset);
#endif #endif
}
_remove_invalid_gids (plan->_glyphset, plan->source->get_num_glyphs ()); _remove_invalid_gids (plan->_glyphset, plan->source->get_num_glyphs ());