tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PosLookupSubTable.hh (2516B)


      1 #ifndef OT_LAYOUT_GPOS_POSLOOKUPSUBTABLE_HH
      2 #define OT_LAYOUT_GPOS_POSLOOKUPSUBTABLE_HH
      3 
      4 #include "SinglePos.hh"
      5 #include "PairPos.hh"
      6 #include "CursivePos.hh"
      7 #include "MarkBasePos.hh"
      8 #include "MarkLigPos.hh"
      9 #include "MarkMarkPos.hh"
     10 #include "ContextPos.hh"
     11 #include "ChainContextPos.hh"
     12 #include "ExtensionPos.hh"
     13 
     14 namespace OT {
     15 namespace Layout {
     16 namespace GPOS_impl {
     17 
     18 struct PosLookupSubTable
     19 {
     20  friend struct ::OT::Lookup;
     21  friend struct PosLookup;
     22 
     23  enum Type {
     24    Single              = 1,
     25    Pair                = 2,
     26    Cursive             = 3,
     27    MarkBase            = 4,
     28    MarkLig             = 5,
     29    MarkMark            = 6,
     30    Context             = 7,
     31    ChainContext        = 8,
     32    Extension           = 9
     33  };
     34 
     35  template <typename context_t, typename ...Ts>
     36  typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type, Ts&&... ds) const
     37  {
     38    TRACE_DISPATCH (this, lookup_type);
     39    switch (lookup_type) {
     40    case Single:                return_trace (u.single.dispatch (c, std::forward<Ts> (ds)...));
     41    case Pair:                  return_trace (u.pair.dispatch (c, std::forward<Ts> (ds)...));
     42    case Cursive:               return_trace (u.cursive.dispatch (c, std::forward<Ts> (ds)...));
     43    case MarkBase:              return_trace (u.markBase.dispatch (c, std::forward<Ts> (ds)...));
     44    case MarkLig:               return_trace (u.markLig.dispatch (c, std::forward<Ts> (ds)...));
     45    case MarkMark:              return_trace (u.markMark.dispatch (c, std::forward<Ts> (ds)...));
     46    case Context:               return_trace (u.context.dispatch (c, std::forward<Ts> (ds)...));
     47    case ChainContext:          return_trace (u.chainContext.dispatch (c, std::forward<Ts> (ds)...));
     48    case Extension:             return_trace (u.extension.dispatch (c, std::forward<Ts> (ds)...));
     49    default:                    return_trace (c->default_return_value ());
     50    }
     51  }
     52 
     53  bool intersects (const hb_set_t *glyphs, unsigned int lookup_type) const
     54  {
     55    hb_intersects_context_t c (glyphs);
     56    return dispatch (&c, lookup_type);
     57  }
     58 
     59  protected:
     60  union {
     61  SinglePos             single;
     62  PairPos               pair;
     63  CursivePos            cursive;
     64  MarkBasePos           markBase;
     65  MarkLigPos            markLig;
     66  MarkMarkPos           markMark;
     67  ContextPos            context;
     68  ChainContextPos       chainContext;
     69  ExtensionPos          extension;
     70  } u;
     71  public:
     72  DEFINE_SIZE_MIN (0);
     73 };
     74 
     75 }
     76 }
     77 }
     78 
     79 #endif  /* HB_OT_LAYOUT_GPOS_POSLOOKUPSUBTABLE_HH */