提交 4af3be6e 编写于 作者: G Garret Rieger

Remove glyph array from subset plan, make num_glyphs and glyphset private.

上级 23f36442
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "hb-subset-input.hh" #include "hb-subset-input.hh"
#include "hb-map.hh" #include "hb-map.hh"
#include "hb-set.hh"
struct hb_subset_plan_t struct hb_subset_plan_t
{ {
...@@ -46,21 +47,51 @@ struct hb_subset_plan_t ...@@ -46,21 +47,51 @@ struct hb_subset_plan_t
hb_set_t *unicodes; hb_set_t *unicodes;
// The glyph subset // The glyph subset
hb_vector_t<hb_codepoint_t> glyphs;
hb_set_t *glyphset;
hb_map_t *codepoint_to_glyph; hb_map_t *codepoint_to_glyph;
// Old -> New glyph id mapping // Old -> New glyph id mapping
hb_map_t *glyph_map; hb_map_t *glyph_map;
hb_map_t *reverse_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 // Plan is only good for a specific source/dest so keep them with it
hb_face_t *source; hb_face_t *source;
hb_face_t *dest; hb_face_t *dest;
bool new_gid_for_codepoint (hb_codepoint_t codepoint, private:
hb_codepoint_t *new_gid) const 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); hb_codepoint_t old_gid = codepoint_to_glyph->get (codepoint);
if (old_gid == HB_MAP_VALUE_INVALID) if (old_gid == HB_MAP_VALUE_INVALID)
...@@ -69,8 +100,8 @@ struct hb_subset_plan_t ...@@ -69,8 +100,8 @@ struct hb_subset_plan_t
return new_gid_for_old_gid (old_gid, new_gid); return new_gid_for_old_gid (old_gid, new_gid);
} }
bool new_gid_for_old_gid (hb_codepoint_t old_gid, inline bool new_gid_for_old_gid (hb_codepoint_t old_gid,
hb_codepoint_t *new_gid) const hb_codepoint_t *new_gid) const
{ {
hb_codepoint_t gid = glyph_map->get (old_gid); hb_codepoint_t gid = glyph_map->get (old_gid);
if (gid == HB_MAP_VALUE_INVALID) if (gid == HB_MAP_VALUE_INVALID)
...@@ -80,8 +111,8 @@ struct hb_subset_plan_t ...@@ -80,8 +111,8 @@ struct hb_subset_plan_t
return true; return true;
} }
bool old_gid_for_new_gid (hb_codepoint_t new_gid, inline bool old_gid_for_new_gid (hb_codepoint_t new_gid,
hb_codepoint_t *old_gid) const hb_codepoint_t *old_gid) const
{ {
hb_codepoint_t gid = reverse_glyph_map->get (new_gid); hb_codepoint_t gid = reverse_glyph_map->get (new_gid);
if (gid == HB_MAP_VALUE_INVALID) if (gid == HB_MAP_VALUE_INVALID)
...@@ -91,7 +122,7 @@ struct hb_subset_plan_t ...@@ -91,7 +122,7 @@ struct hb_subset_plan_t
return true; return true;
} }
bool inline bool
add_table (hb_tag_t tag, add_table (hb_tag_t tag,
hb_blob_t *contents) hb_blob_t *contents)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册