[GSUB/GPOS] Add add_coverage()

This commit is contained in:
Behdad Esfahbod 2012-08-01 21:18:54 -04:00
parent 60a3035ac5
commit a878c58a8f
2 changed files with 36 additions and 0 deletions

View File

@ -1511,6 +1511,20 @@ struct PosLookup : Lookup
return c;
}
template <typename set_t>
inline void add_coverage (set_t *glyphs) const
{
const Coverage *last = NULL;
unsigned int count = get_subtable_count ();
for (unsigned int i = 0; i < count; i++) {
const Coverage *c = &get_subtable (i).get_coverage (get_type ());
if (c != last) {
c->add_coverage (glyphs);
last = c;
}
}
}
inline bool apply_once (hb_apply_context_t *c) const
{
unsigned int lookup_type = get_type ();
@ -1583,6 +1597,10 @@ struct GPOS : GSUBGPOS
inline const PosLookup& get_lookup (unsigned int i) const
{ return CastR<PosLookup> (GSUBGPOS::get_lookup (i)); }
template <typename set_t>
inline void add_coverage (set_t *glyphs, unsigned int lookup_index) const
{ get_lookup (lookup_index).add_coverage (glyphs); }
inline bool position_lookup (hb_apply_context_t *c, unsigned int lookup_index) const
{ return get_lookup (lookup_index).apply_string (c); }

View File

@ -1165,6 +1165,20 @@ struct SubstLookup : Lookup
return c;
}
template <typename set_t>
inline void add_coverage (set_t *glyphs) const
{
const Coverage *last = NULL;
unsigned int count = get_subtable_count ();
for (unsigned int i = 0; i < count; i++) {
const Coverage *c = &get_subtable (i).get_coverage (get_type ());
if (c != last) {
c->add_coverage (glyphs);
last = c;
}
}
}
inline bool would_apply (hb_would_apply_context_t *c) const
{
unsigned int lookup_type = get_type ();
@ -1284,6 +1298,10 @@ struct GSUB : GSUBGPOS
inline const SubstLookup& get_lookup (unsigned int i) const
{ return CastR<SubstLookup> (GSUBGPOS::get_lookup (i)); }
template <typename set_t>
inline void add_coverage (set_t *glyphs, unsigned int lookup_index) const
{ get_lookup (lookup_index).add_coverage (glyphs); }
inline bool would_substitute_lookup (hb_would_apply_context_t *c, unsigned int lookup_index) const
{ return get_lookup (lookup_index).would_apply (c); }