xref: /aosp_15_r20/external/harfbuzz_ng/src/OT/Layout/GPOS/PosLookup.hh (revision 2d1272b857b1f7575e6e246373e1cb218663db8a)
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 
7 namespace OT {
8 namespace Layout {
9 namespace GPOS_impl {
10 
11 struct PosLookup : Lookup
12 {
13   using SubTable = PosLookupSubTable;
14 
get_subtableOT::Layout::GPOS_impl::PosLookup15   const SubTable& get_subtable (unsigned int i) const
16   { return Lookup::get_subtable<SubTable> (i); }
17 
is_reverseOT::Layout::GPOS_impl::PosLookup18   bool is_reverse () const
19   {
20     return false;
21   }
22 
applyOT::Layout::GPOS_impl::PosLookup23   bool apply (hb_ot_apply_context_t *c) const
24   {
25     TRACE_APPLY (this);
26     return_trace (dispatch (c));
27   }
28 
intersectsOT::Layout::GPOS_impl::PosLookup29   bool intersects (const hb_set_t *glyphs) const
30   {
31     hb_intersects_context_t c (glyphs);
32     return dispatch (&c);
33   }
34 
collect_glyphsOT::Layout::GPOS_impl::PosLookup35   hb_collect_glyphs_context_t::return_t collect_glyphs (hb_collect_glyphs_context_t *c) const
36   { return dispatch (c); }
37 
closure_lookupsOT::Layout::GPOS_impl::PosLookup38   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>
collect_coverageOT::Layout::GPOS_impl::PosLookup55   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>
dispatchOT::Layout::GPOS_impl::PosLookup65   typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
66   { return Lookup::dispatch<SubTable> (c, std::forward<Ts> (ds)...); }
67 
subsetOT::Layout::GPOS_impl::PosLookup68   bool subset (hb_subset_context_t *c) const
69   { return Lookup::subset<SubTable> (c); }
70 
sanitizeOT::Layout::GPOS_impl::PosLookup71   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