diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh index df6f61979..3471ee010 100644 --- a/src/hb-ot-cff1-table.hh +++ b/src/hb-ot-cff1-table.hh @@ -636,7 +636,7 @@ struct Charset struct CFF1StringIndex : CFF1Index { bool serialize (hb_serialize_context_t *c, const CFF1StringIndex &strings, - const hb_inc_bimap_t &sidmap) + const hb_map_t &sidmap) { TRACE_SERIALIZE (this); if (unlikely ((strings.count == 0) || (sidmap.get_population () == 0))) diff --git a/src/hb-subset-cff1.cc b/src/hb-subset-cff1.cc index 855c8c51a..308bb5944 100644 --- a/src/hb-subset-cff1.cc +++ b/src/hb-subset-cff1.cc @@ -39,12 +39,20 @@ using namespace CFF; -struct remap_sid_t : hb_inc_bimap_t +struct remap_sid_t : hb_map_t { unsigned int add (unsigned int sid) { if ((sid != CFF_UNDEF_SID) && !is_std_std (sid)) - return offset_sid (hb_inc_bimap_t::add (unoffset_sid (sid))); + { + sid = unoffset_sid (sid); + unsigned v = get (sid); + if (v != HB_MAP_VALUE_INVALID) + return offset_sid (v); + v = next++; + set (sid, v); + return offset_sid (v); + } else return sid; } @@ -62,6 +70,7 @@ struct remap_sid_t : hb_inc_bimap_t static bool is_std_std (unsigned int sid) { return sid < num_std_strings; } static unsigned int offset_sid (unsigned int sid) { return sid + num_std_strings; } static unsigned int unoffset_sid (unsigned int sid) { return sid - num_std_strings; } + unsigned next = 0; }; struct cff1_sub_table_info_t : cff_sub_table_info_t