/src/harfbuzz/src/OT/Layout/GPOS/AnchorMatrix.hh
Line | Count | Source |
1 | | #ifndef OT_LAYOUT_GPOS_ANCHORMATRIX_HH |
2 | | #define OT_LAYOUT_GPOS_ANCHORMATRIX_HH |
3 | | |
4 | | namespace OT { |
5 | | namespace Layout { |
6 | | namespace GPOS_impl { |
7 | | |
8 | | template <typename Types, typename RowCount=typename Types::HBUINT> |
9 | | struct AnchorMatrix |
10 | | { |
11 | | RowCount rows; /* Number of rows */ |
12 | | UnsizedArrayOf<typename Types::template OffsetTo<Anchor, AnchorMatrix>> |
13 | | matrixZ; /* Matrix of offsets to Anchor tables-- |
14 | | * from beginning of AnchorMatrix table */ |
15 | | public: |
16 | | DEFINE_SIZE_ARRAY (sizeof (RowCount), matrixZ); |
17 | | |
18 | | bool sanitize (hb_sanitize_context_t *c, unsigned int cols) const |
19 | 0 | { |
20 | 0 | TRACE_SANITIZE (this); |
21 | 0 | if (!c->check_struct (this)) return_trace (false); |
22 | 0 | hb_barrier (); |
23 | 0 | if (unlikely (hb_unsigned_mul_overflows (rows, cols))) return_trace (false); |
24 | 0 | unsigned int count = rows * cols; |
25 | 0 | if (!c->check_array (matrixZ.arrayZ, count)) return_trace (false); |
26 | | |
27 | 0 | if (c->lazy_some_gpos) |
28 | 0 | return_trace (true); |
29 | | |
30 | 0 | hb_barrier (); |
31 | 0 | for (unsigned int i = 0; i < count; i++) |
32 | 0 | if (!matrixZ[i].sanitize (c, this)) return_trace (false); |
33 | 0 | return_trace (true); |
34 | 0 | } |
35 | | |
36 | | const Anchor& get_anchor (hb_ot_apply_context_t *c, |
37 | | unsigned int row, unsigned int col, |
38 | | unsigned int cols, bool *found) const |
39 | 0 | { |
40 | 0 | *found = false; |
41 | 0 | if (unlikely (row >= rows || col >= cols)) return Null (Anchor); |
42 | 0 | auto &offset = matrixZ[row * cols + col]; |
43 | 0 | if (unlikely (!offset.sanitize (&c->sanitizer, this))) return Null (Anchor); |
44 | 0 | hb_barrier (); |
45 | 0 | *found = !offset.is_null (); |
46 | 0 | return this+offset; |
47 | 0 | } |
48 | | |
49 | | template <typename Iterator, |
50 | | hb_requires (hb_is_iterator (Iterator))> |
51 | | void collect_variation_indices (hb_collect_variation_indices_context_t *c, |
52 | | Iterator index_iter) const |
53 | 0 | { |
54 | 0 | for (unsigned i : index_iter) |
55 | 0 | (this+matrixZ[i]).collect_variation_indices (c); |
56 | 0 | } |
57 | | |
58 | | template <typename Iterator, |
59 | | hb_requires (hb_is_iterator (Iterator))> |
60 | | bool subset (hb_subset_context_t *c, |
61 | | unsigned num_rows, |
62 | | Iterator index_iter) const |
63 | 0 | { |
64 | 0 | TRACE_SUBSET (this); |
65 | |
|
66 | 0 | auto *out = c->serializer->start_embed (this); |
67 | |
|
68 | 0 | if (!index_iter) return_trace (false); |
69 | 0 | if (unlikely (!c->serializer->extend_min (out))) return_trace (false); |
70 | | |
71 | 0 | out->rows = num_rows; |
72 | 0 | for (const unsigned i : index_iter) |
73 | 0 | { |
74 | 0 | auto *offset = c->serializer->embed (matrixZ[i]); |
75 | 0 | if (!offset) return_trace (false); |
76 | 0 | offset->serialize_subset (c, matrixZ[i], this); |
77 | 0 | } |
78 | | |
79 | 0 | return_trace (true); |
80 | 0 | } Unexecuted instantiation: _ZNK2OT6Layout9GPOS_impl12AnchorMatrixINS0_10SmallTypesENS_7NumTypeILb1EtLj2EEEE6subsetI17hb_sorted_array_tIKjETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSC_6item_tEEE5valueEvE4typeELPv0EEEbP19hb_subset_context_tjSC_ Unexecuted instantiation: hb-subset-plan-layout.cc:_ZNK2OT6Layout9GPOS_impl12AnchorMatrixINS0_10SmallTypesENS_7NumTypeILb1EtLj2EEEE6subsetI16hb_filter_iter_tI15hb_range_iter_tIjjEZNKS1_13LigatureArrayIS3_E6subsetINS0_6Common8Coverage6iter_tETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSI_6item_tEEE5valueEvE4typeELPv0EEEbP19hb_subset_context_tSI_jPK8hb_map_tR11hb_vector_tIjLb1EEEUljE1_RK4$_17LSN_0EETnSM_LSN_0EEEbSP_jSI_ Unexecuted instantiation: hb-subset-table-layout.cc:_ZNK2OT6Layout9GPOS_impl12AnchorMatrixINS0_10SmallTypesENS_7NumTypeILb1EtLj2EEEE6subsetI16hb_filter_iter_tI15hb_range_iter_tIjjEZNKS1_13LigatureArrayIS3_E6subsetINS0_6Common8Coverage6iter_tETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSI_6item_tEEE5valueEvE4typeELPv0EEEbP19hb_subset_context_tSI_jPK8hb_map_tR11hb_vector_tIjLb1EEEUljE1_RK4$_17LSN_0EETnSM_LSN_0EEEbSP_jSI_ Unexecuted instantiation: hb-ot-face.cc:_ZNK2OT6Layout9GPOS_impl12AnchorMatrixINS0_10SmallTypesENS_7NumTypeILb1EtLj2EEEE6subsetI16hb_filter_iter_tI15hb_range_iter_tIjjEZNKS1_13LigatureArrayIS3_E6subsetINS0_6Common8Coverage6iter_tETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSI_6item_tEEE5valueEvE4typeELPv0EEEbP19hb_subset_context_tSI_jPK8hb_map_tR11hb_vector_tIjLb1EEEUljE1_RK4$_17LSN_0EETnSM_LSN_0EEEbSP_jSI_ Unexecuted instantiation: hb-ot-layout.cc:_ZNK2OT6Layout9GPOS_impl12AnchorMatrixINS0_10SmallTypesENS_7NumTypeILb1EtLj2EEEE6subsetI16hb_filter_iter_tI15hb_range_iter_tIjjEZNKS1_13LigatureArrayIS3_E6subsetINS0_6Common8Coverage6iter_tETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSI_6item_tEEE5valueEvE4typeELPv0EEEbP19hb_subset_context_tSI_jPK8hb_map_tR11hb_vector_tIjLb1EEEUljE1_RK4$_17LSN_0EETnSM_LSN_0EEEbSP_jSI_ Unexecuted instantiation: hb-aat-layout.cc:_ZNK2OT6Layout9GPOS_impl12AnchorMatrixINS0_10SmallTypesENS_7NumTypeILb1EtLj2EEEE6subsetI16hb_filter_iter_tI15hb_range_iter_tIjjEZNKS1_13LigatureArrayIS3_E6subsetINS0_6Common8Coverage6iter_tETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSI_6item_tEEE5valueEvE4typeELPv0EEEbP19hb_subset_context_tSI_jPK8hb_map_tR11hb_vector_tIjLb1EEEUljE1_RK4$_17LSN_0EETnSM_LSN_0EEEbSP_jSI_ Unexecuted instantiation: hb-ot-shape-fallback.cc:_ZNK2OT6Layout9GPOS_impl12AnchorMatrixINS0_10SmallTypesENS_7NumTypeILb1EtLj2EEEE6subsetI16hb_filter_iter_tI15hb_range_iter_tIjjEZNKS1_13LigatureArrayIS3_E6subsetINS0_6Common8Coverage6iter_tETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSI_6item_tEEE5valueEvE4typeELPv0EEEbP19hb_subset_context_tSI_jPK8hb_map_tR11hb_vector_tIjLb1EEEUljE1_RK4$_17LSN_0EETnSM_LSN_0EEEbSP_jSI_ |
81 | | |
82 | | bool offset_is_null (unsigned row, unsigned col, unsigned num_cols) const |
83 | 0 | { |
84 | 0 | if (unlikely (row >= rows || col >= num_cols)) return true; |
85 | 0 | auto &offset = matrixZ[row * num_cols + col]; |
86 | 0 | return offset.is_null (); |
87 | 0 | } |
88 | | }; |
89 | | |
90 | | |
91 | | } |
92 | | } |
93 | | } |
94 | | |
95 | | #endif /* OT_LAYOUT_GPOS_ANCHORMATRIX_HH */ |