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
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,
#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;
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;
};