[layout] Use dispatch() for add_coverage()
This commit is contained in:
parent
50b8dc79da
commit
8e36ccfd4f
|
@ -1506,16 +1506,8 @@ struct PosLookup : Lookup
|
|||
template <typename set_t>
|
||||
inline void add_coverage (set_t *glyphs) const
|
||||
{
|
||||
hb_get_coverage_context_t c;
|
||||
const Coverage *last = NULL;
|
||||
unsigned int count = get_subtable_count ();
|
||||
for (unsigned int i = 0; i < count; i++) {
|
||||
const Coverage *coverage = &get_subtable (i).dispatch (&c, get_type ());
|
||||
if (coverage != last) {
|
||||
coverage->add_coverage (glyphs);
|
||||
last = coverage;
|
||||
}
|
||||
}
|
||||
hb_add_coverage_context_t<set_t> c (glyphs);
|
||||
dispatch (&c);
|
||||
}
|
||||
|
||||
inline bool apply_once (hb_apply_context_t *c) const
|
||||
|
|
|
@ -1200,16 +1200,8 @@ struct SubstLookup : Lookup
|
|||
template <typename set_t>
|
||||
inline void add_coverage (set_t *glyphs) const
|
||||
{
|
||||
hb_get_coverage_context_t c;
|
||||
const Coverage *last = NULL;
|
||||
unsigned int count = get_subtable_count ();
|
||||
for (unsigned int i = 0; i < count; i++) {
|
||||
const Coverage *coverage = &get_subtable (i).dispatch (&c, get_type ());
|
||||
if (coverage != last) {
|
||||
coverage->add_coverage (glyphs);
|
||||
last = coverage;
|
||||
}
|
||||
}
|
||||
hb_add_coverage_context_t<set_t> c (glyphs);
|
||||
dispatch (&c);
|
||||
}
|
||||
|
||||
inline bool would_apply (hb_would_apply_context_t *c,
|
||||
|
|
|
@ -238,7 +238,8 @@ struct hb_collect_glyphs_context_t
|
|||
#define HB_DEBUG_GET_COVERAGE (HB_DEBUG+0)
|
||||
#endif
|
||||
|
||||
struct hb_get_coverage_context_t
|
||||
template <typename set_t>
|
||||
struct hb_add_coverage_context_t
|
||||
{
|
||||
inline const char *get_name (void) { return "GET_COVERAGE"; }
|
||||
static const unsigned int max_debug_depth = HB_DEBUG_GET_COVERAGE;
|
||||
|
@ -248,10 +249,17 @@ struct hb_get_coverage_context_t
|
|||
template <typename T>
|
||||
inline return_t dispatch (const T &obj) { return obj.get_coverage (); }
|
||||
static return_t default_return_value (void) { return Null(Coverage); }
|
||||
bool stop_sublookup_iteration (return_t r) const
|
||||
{
|
||||
r.add_coverage (set);
|
||||
return false;
|
||||
}
|
||||
|
||||
hb_get_coverage_context_t (void) :
|
||||
hb_add_coverage_context_t (set_t *set_) :
|
||||
set (set_),
|
||||
debug_depth (0) {}
|
||||
|
||||
set_t *set;
|
||||
unsigned int debug_depth;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue