| 1 | #ifndef OT_LAYOUT_GPOS_LIGATUREARRAY_HH |
| 2 | #define OT_LAYOUT_GPOS_LIGATUREARRAY_HH |
| 3 | |
| 4 | namespace OT { |
| 5 | namespace Layout { |
| 6 | namespace GPOS_impl { |
| 7 | |
| 8 | |
| 9 | typedef AnchorMatrix LigatureAttach; /* component-major-- |
| 10 | * in order of writing direction--, |
| 11 | * mark-minor-- |
| 12 | * ordered by class--zero-based. */ |
| 13 | |
| 14 | /* Array of LigatureAttach tables ordered by LigatureCoverage Index */ |
| 15 | struct LigatureArray : List16OfOffset16To<LigatureAttach> |
| 16 | { |
| 17 | template <typename Iterator, |
| 18 | hb_requires (hb_is_iterator (Iterator))> |
| 19 | bool subset (hb_subset_context_t *c, |
| 20 | Iterator coverage, |
| 21 | unsigned class_count, |
| 22 | const hb_map_t *klass_mapping) const |
| 23 | { |
| 24 | TRACE_SUBSET (this); |
| 25 | const hb_set_t &glyphset = *c->plan->glyphset_gsub (); |
| 26 | |
| 27 | auto *out = c->serializer->start_embed (this); |
| 28 | if (unlikely (!c->serializer->extend_min (out))) return_trace (false); |
| 29 | |
| 30 | for (const auto _ : + hb_zip (coverage, *this) |
| 31 | | hb_filter (glyphset, hb_first)) |
| 32 | { |
| 33 | auto *matrix = out->serialize_append (c->serializer); |
| 34 | if (unlikely (!matrix)) return_trace (false); |
| 35 | |
| 36 | const LigatureAttach& src = (this + _.second); |
| 37 | auto indexes = |
| 38 | + hb_range (src.rows * class_count) |
| 39 | | hb_filter ([=] (unsigned index) { return klass_mapping->has (index % class_count); }) |
| 40 | ; |
| 41 | matrix->serialize_subset (c, |
| 42 | _.second, |
| 43 | this, |
| 44 | src.rows, |
| 45 | indexes); |
| 46 | } |
| 47 | return_trace (this->len); |
| 48 | } |
| 49 | }; |
| 50 | |
| 51 | |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | #endif /* OT_LAYOUT_GPOS_LIGATUREARRAY_HH */ |
| 57 | |