1#ifndef OT_LAYOUT_GPOS_POSLOOKUP_HH
2#define OT_LAYOUT_GPOS_POSLOOKUP_HH
3
4#include "PosLookupSubTable.hh"
5#include "../../../hb-ot-layout-common.hh"
6
7namespace OT {
8namespace Layout {
9namespace GPOS_impl {
10
11struct PosLookup : Lookup
12{
13 using SubTable = PosLookupSubTable;
14
15 const SubTable& get_subtable (unsigned int i) const
16 { return Lookup::get_subtable<SubTable> (i); }
17
18 bool is_reverse () const
19 {
20 return false;
21 }
22
23 bool apply (hb_ot_apply_context_t *c) const
24 {
25 TRACE_APPLY (this);
26 return_trace (dispatch (c));
27 }
28
29 bool intersects (const hb_set_t *glyphs) const
30 {
31 hb_intersects_context_t c (glyphs);
32 return dispatch (&c);
33 }
34
35 hb_collect_glyphs_context_t::return_t collect_glyphs (hb_collect_glyphs_context_t *c) const
36 { return dispatch (c); }
37
38 hb_closure_lookups_context_t::return_t closure_lookups (hb_closure_lookups_context_t *c, unsigned this_index) const
39 {
40 if (c->is_lookup_visited (this_index))
41 return hb_closure_lookups_context_t::default_return_value ();
42
43 c->set_lookup_visited (this_index);
44 if (!intersects (c->glyphs))
45 {
46 c->set_lookup_inactive (this_index);
47 return hb_closure_lookups_context_t::default_return_value ();
48 }
49
50 hb_closure_lookups_context_t::return_t ret = dispatch (c);
51 return ret;
52 }
53
54 template <typename set_t>
55 void collect_coverage (set_t *glyphs) const
56 {
57 hb_collect_coverage_context_t<set_t> c (glyphs);
58 dispatch (&c);
59 }
60
61 template <typename context_t>
62 static typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
63
64 template <typename context_t, typename ...Ts>
65 typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
66 { return Lookup::dispatch<SubTable> (c, std::forward<Ts> (ds)...); }
67
68 bool subset (hb_subset_context_t *c) const
69 { return Lookup::subset<SubTable> (c); }
70
71 bool sanitize (hb_sanitize_context_t *c) const
72 { return Lookup::sanitize<SubTable> (c); }
73};
74
75}
76}
77}
78
79#endif /* OT_LAYOUT_GPOS_POSLOOKUP_HH */
80