diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index 5a90b7c390604c804cc6575214493061a305bfa7..7acb07ae0c4db7d1bdaf55eeb01067e2cb828769 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -33,6 +33,7 @@ #include "hb-subset-input.hh" #include "hb-map.hh" +#include "hb-set.hh" struct hb_subset_plan_t { @@ -46,21 +47,51 @@ struct hb_subset_plan_t hb_set_t *unicodes; // The glyph subset - hb_vector_t glyphs; - hb_set_t *glyphset; hb_map_t *codepoint_to_glyph; // Old -> New glyph id mapping hb_map_t *glyph_map; hb_map_t *reverse_glyph_map; - unsigned int num_glyphs; // Plan is only good for a specific source/dest so keep them with it hb_face_t *source; hb_face_t *dest; - bool new_gid_for_codepoint (hb_codepoint_t codepoint, - hb_codepoint_t *new_gid) const + private: + unsigned int _num_output_glyphs; + hb_set_t *_glyphset; + + public: + + /* + * The set of input glyph ids which will be retained in the subset. + */ + inline const hb_set_t * + glyphset () const + { + return _glyphset; + } + + /* + * The total number of output glyphs in the final subset. + */ + inline unsigned int + num_output_glyphs () + { + return _num_output_glyphs; + } + + /* + * Given an output gid , returns true if that glyph id is an empty + * glyph (ie. it's a gid that we are dropping all data for). + */ + inline bool is_empty_glyph (hb_codepoint_t gid) const + { + return !_glyphset->has (gid); + } + + inline bool new_gid_for_codepoint (hb_codepoint_t codepoint, + hb_codepoint_t *new_gid) const { hb_codepoint_t old_gid = codepoint_to_glyph->get (codepoint); if (old_gid == HB_MAP_VALUE_INVALID) @@ -69,8 +100,8 @@ struct hb_subset_plan_t return new_gid_for_old_gid (old_gid, new_gid); } - bool new_gid_for_old_gid (hb_codepoint_t old_gid, - hb_codepoint_t *new_gid) const + inline bool new_gid_for_old_gid (hb_codepoint_t old_gid, + hb_codepoint_t *new_gid) const { hb_codepoint_t gid = glyph_map->get (old_gid); if (gid == HB_MAP_VALUE_INVALID) @@ -80,8 +111,8 @@ struct hb_subset_plan_t return true; } - bool old_gid_for_new_gid (hb_codepoint_t new_gid, - hb_codepoint_t *old_gid) const + inline bool old_gid_for_new_gid (hb_codepoint_t new_gid, + hb_codepoint_t *old_gid) const { hb_codepoint_t gid = reverse_glyph_map->get (new_gid); if (gid == HB_MAP_VALUE_INVALID) @@ -91,7 +122,7 @@ struct hb_subset_plan_t return true; } - bool + inline bool add_table (hb_tag_t tag, hb_blob_t *contents) {