1 #ifndef OT_LAYOUT_GSUB_SUBSTLOOKUPSUBTABLE_HH 2 #define OT_LAYOUT_GSUB_SUBSTLOOKUPSUBTABLE_HH 3 4 #include "Common.hh" 5 #include "SingleSubst.hh" 6 #include "MultipleSubst.hh" 7 #include "AlternateSubst.hh" 8 #include "LigatureSubst.hh" 9 #include "ContextSubst.hh" 10 #include "ChainContextSubst.hh" 11 #include "ExtensionSubst.hh" 12 #include "ReverseChainSingleSubst.hh" 13 14 namespace OT { 15 namespace Layout { 16 namespace GSUB_impl { 17 18 struct SubstLookupSubTable 19 { 20 friend struct ::OT::Lookup; 21 friend struct SubstLookup; 22 23 protected: 24 union { 25 SingleSubst single; 26 MultipleSubst multiple; 27 AlternateSubst alternate; 28 LigatureSubst ligature; 29 ContextSubst context; 30 ChainContextSubst chainContext; 31 ExtensionSubst extension; 32 ReverseChainSingleSubst reverseChainContextSingle; 33 } u; 34 public: 35 DEFINE_SIZE_MIN (0); 36 37 enum Type { 38 Single = 1, 39 Multiple = 2, 40 Alternate = 3, 41 Ligature = 4, 42 Context = 5, 43 ChainContext = 6, 44 Extension = 7, 45 ReverseChainSingle = 8 46 }; 47 48 template <typename context_t, typename ...Ts> dispatchOT::Layout::GSUB_impl::SubstLookupSubTable49 typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type, Ts&&... ds) const 50 { 51 TRACE_DISPATCH (this, lookup_type); 52 switch (lookup_type) { 53 case Single: return_trace (u.single.dispatch (c, std::forward<Ts> (ds)...)); 54 case Multiple: return_trace (u.multiple.dispatch (c, std::forward<Ts> (ds)...)); 55 case Alternate: return_trace (u.alternate.dispatch (c, std::forward<Ts> (ds)...)); 56 case Ligature: return_trace (u.ligature.dispatch (c, std::forward<Ts> (ds)...)); 57 case Context: return_trace (u.context.dispatch (c, std::forward<Ts> (ds)...)); 58 case ChainContext: return_trace (u.chainContext.dispatch (c, std::forward<Ts> (ds)...)); 59 case Extension: return_trace (u.extension.dispatch (c, std::forward<Ts> (ds)...)); 60 case ReverseChainSingle: return_trace (u.reverseChainContextSingle.dispatch (c, std::forward<Ts> (ds)...)); 61 default: return_trace (c->default_return_value ()); 62 } 63 } 64 intersectsOT::Layout::GSUB_impl::SubstLookupSubTable65 bool intersects (const hb_set_t *glyphs, unsigned int lookup_type) const 66 { 67 hb_intersects_context_t c (glyphs); 68 return dispatch (&c, lookup_type); 69 } 70 }; 71 72 73 } 74 } 75 } 76 77 #endif /* HB_OT_LAYOUT_GSUB_SUBSTLOOKUPSUBTABLE_HH */ 78