/src/harfbuzz/src/OT/Layout/GSUB/LigatureSet.hh
Line | Count | Source |
1 | | #ifndef OT_LAYOUT_GSUB_LIGATURESET_HH |
2 | | #define OT_LAYOUT_GSUB_LIGATURESET_HH |
3 | | |
4 | | #include "Common.hh" |
5 | | #include "Ligature.hh" |
6 | | |
7 | | namespace OT { |
8 | | namespace Layout { |
9 | | namespace GSUB_impl { |
10 | | |
11 | | template <typename Types> |
12 | | struct LigatureSet |
13 | | { |
14 | | public: |
15 | | Array16OfOffset16To<Ligature<Types>> |
16 | | ligature; /* Array LigatureSet tables |
17 | | * ordered by preference */ |
18 | | |
19 | | DEFINE_SIZE_ARRAY (2, ligature); |
20 | | |
21 | | bool sanitize (hb_sanitize_context_t *c) const |
22 | 81.6k | { |
23 | 81.6k | TRACE_SANITIZE (this); |
24 | 81.6k | return_trace (ligature.sanitize (c, this)); |
25 | 81.6k | } OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::sanitize(hb_sanitize_context_t*) const Line | Count | Source | 22 | 76.7k | { | 23 | 76.7k | TRACE_SANITIZE (this); | 24 | 76.7k | return_trace (ligature.sanitize (c, this)); | 25 | 76.7k | } |
OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::sanitize(hb_sanitize_context_t*) const Line | Count | Source | 22 | 4.88k | { | 23 | 4.88k | TRACE_SANITIZE (this); | 24 | 4.88k | return_trace (ligature.sanitize (c, this)); | 25 | 4.88k | } |
|
26 | | |
27 | | bool intersects (const hb_set_t *glyphs) const |
28 | 2.59k | { |
29 | 2.59k | return |
30 | 2.59k | + hb_iter (ligature) |
31 | 2.59k | | hb_map (hb_add (this)) |
32 | 2.61k | | hb_map ([glyphs] (const Ligature<Types> &_) { return _.intersects (glyphs); })OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::intersects(hb_set_t const*) const::{lambda(OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes> const&)#1}::operator()(OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes> const&) constLine | Count | Source | 32 | 2.61k | | hb_map ([glyphs] (const Ligature<Types> &_) { return _.intersects (glyphs); }) |
Unexecuted instantiation: OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::intersects(hb_set_t const*) const::{lambda(OT::Layout::GSUB_impl::Ligature<OT::Layout::MediumTypes> const&)#1}::operator()(OT::Layout::GSUB_impl::Ligature<OT::Layout::MediumTypes> const&) const |
33 | 2.59k | | hb_any |
34 | 2.59k | ; |
35 | 2.59k | } Unexecuted instantiation: OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::intersects(hb_set_t const*) const OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::intersects(hb_set_t const*) const Line | Count | Source | 28 | 2.59k | { | 29 | 2.59k | return | 30 | 2.59k | + hb_iter (ligature) | 31 | 2.59k | | hb_map (hb_add (this)) | 32 | 2.59k | | hb_map ([glyphs] (const Ligature<Types> &_) { return _.intersects (glyphs); }) | 33 | 2.59k | | hb_any | 34 | 2.59k | ; | 35 | 2.59k | } |
|
36 | | |
37 | | bool intersects_lig_glyph (const hb_set_t *glyphs) const |
38 | 5.08k | { |
39 | 5.08k | return |
40 | 5.08k | + hb_iter (ligature) |
41 | 5.08k | | hb_map (hb_add (this)) |
42 | 5.08k | | hb_map ([glyphs] (const Ligature<Types> &_) { |
43 | 4.63k | return _.intersects_lig_glyph (glyphs) && _.intersects (glyphs); |
44 | 4.63k | }) OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::intersects_lig_glyph(hb_set_t const*) const::{lambda(OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes> const&)#1}::operator()(OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes> const&) constLine | Count | Source | 42 | 4.63k | | hb_map ([glyphs] (const Ligature<Types> &_) { | 43 | 4.63k | return _.intersects_lig_glyph (glyphs) && _.intersects (glyphs); | 44 | 4.63k | }) |
Unexecuted instantiation: OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::intersects_lig_glyph(hb_set_t const*) const::{lambda(OT::Layout::GSUB_impl::Ligature<OT::Layout::MediumTypes> const&)#1}::operator()(OT::Layout::GSUB_impl::Ligature<OT::Layout::MediumTypes> const&) const |
45 | 5.08k | | hb_any |
46 | 5.08k | ; |
47 | 5.08k | } Unexecuted instantiation: OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::intersects_lig_glyph(hb_set_t const*) const OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::intersects_lig_glyph(hb_set_t const*) const Line | Count | Source | 38 | 5.08k | { | 39 | 5.08k | return | 40 | 5.08k | + hb_iter (ligature) | 41 | 5.08k | | hb_map (hb_add (this)) | 42 | 5.08k | | hb_map ([glyphs] (const Ligature<Types> &_) { | 43 | 5.08k | return _.intersects_lig_glyph (glyphs) && _.intersects (glyphs); | 44 | 5.08k | }) | 45 | 5.08k | | hb_any | 46 | 5.08k | ; | 47 | 5.08k | } |
|
48 | | |
49 | | void closure (hb_closure_context_t *c) const |
50 | 6.48k | { |
51 | 6.48k | + hb_iter (ligature) |
52 | 6.48k | | hb_map (hb_add (this)) |
53 | 13.3M | | hb_apply ([c] (const Ligature<Types> &_) { _.closure (c); })OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const::{lambda(OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes> const&)#1}::operator()(OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes> const&) constLine | Count | Source | 53 | 13.3M | | hb_apply ([c] (const Ligature<Types> &_) { _.closure (c); }) |
Unexecuted instantiation: OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const::{lambda(OT::Layout::GSUB_impl::Ligature<OT::Layout::MediumTypes> const&)#1}::operator()(OT::Layout::GSUB_impl::Ligature<OT::Layout::MediumTypes> const&) const |
54 | 6.48k | ; |
55 | 6.48k | } OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const Line | Count | Source | 50 | 6.48k | { | 51 | 6.48k | + hb_iter (ligature) | 52 | 6.48k | | hb_map (hb_add (this)) | 53 | 6.48k | | hb_apply ([c] (const Ligature<Types> &_) { _.closure (c); }) | 54 | 6.48k | ; | 55 | 6.48k | } |
Unexecuted instantiation: OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const |
56 | | |
57 | | void collect_glyphs (hb_collect_glyphs_context_t *c) const |
58 | 0 | { |
59 | 0 | + hb_iter (ligature) |
60 | 0 | | hb_map (hb_add (this)) |
61 | 0 | | hb_apply ([c] (const Ligature<Types> &_) { _.collect_glyphs (c); })Unexecuted instantiation: OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const::{lambda(OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes> const&)#1}::operator()(OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes> const&) constUnexecuted instantiation: OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const::{lambda(OT::Layout::GSUB_impl::Ligature<OT::Layout::MediumTypes> const&)#1}::operator()(OT::Layout::GSUB_impl::Ligature<OT::Layout::MediumTypes> const&) const |
62 | 0 | ; |
63 | 0 | } Unexecuted instantiation: OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const Unexecuted instantiation: OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const |
64 | | |
65 | | template <typename set_t> |
66 | | void collect_seconds (set_t &s) const |
67 | 36.0k | { |
68 | 36.0k | + hb_iter (ligature) |
69 | 36.0k | | hb_map (hb_add (this)) |
70 | 120k | | hb_apply ([&s] (const Ligature<Types> &_) { _.collect_second (s); })OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::collect_seconds<hb_set_digest_t>(hb_set_digest_t&) const::{lambda(OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes> const&)#1}::operator()(OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes> const&) constLine | Count | Source | 70 | 112k | | hb_apply ([&s] (const Ligature<Types> &_) { _.collect_second (s); }) |
OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::collect_seconds<hb_set_digest_t>(hb_set_digest_t&) const::{lambda(OT::Layout::GSUB_impl::Ligature<OT::Layout::MediumTypes> const&)#1}::operator()(OT::Layout::GSUB_impl::Ligature<OT::Layout::MediumTypes> const&) constLine | Count | Source | 70 | 7.78k | | hb_apply ([&s] (const Ligature<Types> &_) { _.collect_second (s); }) |
|
71 | 36.0k | ; |
72 | 36.0k | } void OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::collect_seconds<hb_set_digest_t>(hb_set_digest_t&) const Line | Count | Source | 67 | 33.8k | { | 68 | 33.8k | + hb_iter (ligature) | 69 | 33.8k | | hb_map (hb_add (this)) | 70 | 33.8k | | hb_apply ([&s] (const Ligature<Types> &_) { _.collect_second (s); }) | 71 | 33.8k | ; | 72 | 33.8k | } |
void OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::collect_seconds<hb_set_digest_t>(hb_set_digest_t&) const Line | Count | Source | 67 | 2.27k | { | 68 | 2.27k | + hb_iter (ligature) | 69 | 2.27k | | hb_map (hb_add (this)) | 70 | 2.27k | | hb_apply ([&s] (const Ligature<Types> &_) { _.collect_second (s); }) | 71 | 2.27k | ; | 72 | 2.27k | } |
|
73 | | |
74 | | bool would_apply (hb_would_apply_context_t *c) const |
75 | 24.8k | { |
76 | 24.8k | return |
77 | 24.8k | + hb_iter (ligature) |
78 | 24.8k | | hb_map (hb_add (this)) |
79 | 25.8k | | hb_map ([c] (const Ligature<Types> &_) { return _.would_apply (c); })OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::would_apply(OT::hb_would_apply_context_t*) const::{lambda(OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes> const&)#1}::operator()(OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes> const&) constLine | Count | Source | 79 | 25.8k | | hb_map ([c] (const Ligature<Types> &_) { return _.would_apply (c); }) |
Unexecuted instantiation: OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::would_apply(OT::hb_would_apply_context_t*) const::{lambda(OT::Layout::GSUB_impl::Ligature<OT::Layout::MediumTypes> const&)#1}::operator()(OT::Layout::GSUB_impl::Ligature<OT::Layout::MediumTypes> const&) const |
80 | 24.8k | | hb_any |
81 | 24.8k | ; |
82 | 24.8k | } OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::would_apply(OT::hb_would_apply_context_t*) const Line | Count | Source | 75 | 24.7k | { | 76 | 24.7k | return | 77 | 24.7k | + hb_iter (ligature) | 78 | 24.7k | | hb_map (hb_add (this)) | 79 | 24.7k | | hb_map ([c] (const Ligature<Types> &_) { return _.would_apply (c); }) | 80 | 24.7k | | hb_any | 81 | 24.7k | ; | 82 | 24.7k | } |
OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::would_apply(OT::hb_would_apply_context_t*) const Line | Count | Source | 75 | 73 | { | 76 | 73 | return | 77 | 73 | + hb_iter (ligature) | 78 | 73 | | hb_map (hb_add (this)) | 79 | 73 | | hb_map ([c] (const Ligature<Types> &_) { return _.would_apply (c); }) | 80 | 73 | | hb_any | 81 | 73 | ; | 82 | 73 | } |
|
83 | | |
84 | | bool apply (hb_ot_apply_context_t *c, const hb_set_digest_t *seconds = nullptr) const |
85 | 3.20M | { |
86 | 3.20M | TRACE_APPLY (this); |
87 | | |
88 | 3.20M | unsigned int num_ligs = ligature.len; |
89 | | |
90 | 3.20M | #ifndef HB_NO_OT_RULESETS_FAST_PATH |
91 | 3.20M | if (HB_OPTIMIZE_SIZE_VAL || num_ligs <= 1) |
92 | 1.42M | #endif |
93 | 1.42M | { |
94 | 1.48M | slow: |
95 | 1.98M | for (unsigned int i = 0; i < num_ligs; i++) |
96 | 522k | { |
97 | 522k | const auto &lig = this+ligature.arrayZ[i]; |
98 | 522k | if (lig.apply (c)) return_trace (true); |
99 | 522k | } |
100 | 1.48M | return_trace (false); |
101 | 1.48M | } |
102 | | |
103 | | /* This version is optimized for speed by matching the second component |
104 | | * of the ligature here, instead of calling into the ligation code. |
105 | | * |
106 | | * This is replicated in ChainRuleSet and RuleSet. */ |
107 | | |
108 | 1.77M | auto &skippy_iter = c->iter_context; |
109 | 1.77M | skippy_iter.reset (c->buffer->idx); |
110 | 1.77M | skippy_iter.set_match_func (match_always, nullptr); |
111 | 1.77M | skippy_iter.set_glyph_data ((HBUINT16 *) nullptr); |
112 | 1.77M | unsigned unsafe_to; |
113 | 1.77M | hb_codepoint_t second = (unsigned) -1; |
114 | 1.77M | bool matched = skippy_iter.next (&unsafe_to); |
115 | 1.77M | if (likely (matched)) |
116 | 1.72M | { |
117 | 1.72M | second = c->buffer->info[skippy_iter.idx].codepoint; |
118 | 1.72M | unsafe_to = skippy_iter.idx + 1; |
119 | | |
120 | 1.72M | if (skippy_iter.may_skip (c->buffer->info[skippy_iter.idx])) |
121 | 6.52k | { |
122 | | /* Can't use the fast path if eg. the next char is a default-ignorable |
123 | | * or other skippable. */ |
124 | 6.52k | goto slow; |
125 | 6.52k | } |
126 | 1.72M | } |
127 | 45.3k | else |
128 | 45.3k | goto slow; |
129 | | |
130 | 1.72M | if (seconds && !seconds->may_have (second)) |
131 | 179k | return_trace (false); |
132 | 1.54M | bool unsafe_to_concat = false; |
133 | 9.32M | for (unsigned int i = 0; i < num_ligs; i++) |
134 | 8.14M | { |
135 | 8.14M | const auto &lig = this+ligature.arrayZ[i]; |
136 | 8.14M | if (unlikely (lig.component.lenP1 <= 1) || |
137 | 3.97M | lig.component.arrayZ[0] == second) |
138 | 4.85M | { |
139 | 4.85M | if (lig.apply (c)) |
140 | 362k | { |
141 | 362k | if (unsafe_to_concat) |
142 | 229k | c->buffer->unsafe_to_concat (c->buffer->idx, unsafe_to); |
143 | 362k | return_trace (true); |
144 | 362k | } |
145 | 4.85M | } |
146 | 3.28M | else if (likely (lig.component.lenP1 > 1)) |
147 | 3.28M | unsafe_to_concat = true; |
148 | 8.14M | } |
149 | 1.18M | if (likely (unsafe_to_concat)) |
150 | 1.15M | c->buffer->unsafe_to_concat (c->buffer->idx, unsafe_to); |
151 | | |
152 | 1.18M | return_trace (false); |
153 | 1.54M | } OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::apply(OT::hb_ot_apply_context_t*, hb_set_digest_t const*) const Line | Count | Source | 85 | 3.10M | { | 86 | 3.10M | TRACE_APPLY (this); | 87 | | | 88 | 3.10M | unsigned int num_ligs = ligature.len; | 89 | | | 90 | 3.10M | #ifndef HB_NO_OT_RULESETS_FAST_PATH | 91 | 3.10M | if (HB_OPTIMIZE_SIZE_VAL || num_ligs <= 1) | 92 | 1.37M | #endif | 93 | 1.37M | { | 94 | 1.42M | slow: | 95 | 1.91M | for (unsigned int i = 0; i < num_ligs; i++) | 96 | 501k | { | 97 | 501k | const auto &lig = this+ligature.arrayZ[i]; | 98 | 501k | if (lig.apply (c)) return_trace (true); | 99 | 501k | } | 100 | 1.42M | return_trace (false); | 101 | 1.42M | } | 102 | | | 103 | | /* This version is optimized for speed by matching the second component | 104 | | * of the ligature here, instead of calling into the ligation code. | 105 | | * | 106 | | * This is replicated in ChainRuleSet and RuleSet. */ | 107 | | | 108 | 1.72M | auto &skippy_iter = c->iter_context; | 109 | 1.72M | skippy_iter.reset (c->buffer->idx); | 110 | 1.72M | skippy_iter.set_match_func (match_always, nullptr); | 111 | 1.72M | skippy_iter.set_glyph_data ((HBUINT16 *) nullptr); | 112 | 1.72M | unsigned unsafe_to; | 113 | 1.72M | hb_codepoint_t second = (unsigned) -1; | 114 | 1.72M | bool matched = skippy_iter.next (&unsafe_to); | 115 | 1.72M | if (likely (matched)) | 116 | 1.68M | { | 117 | 1.68M | second = c->buffer->info[skippy_iter.idx].codepoint; | 118 | 1.68M | unsafe_to = skippy_iter.idx + 1; | 119 | | | 120 | 1.68M | if (skippy_iter.may_skip (c->buffer->info[skippy_iter.idx])) | 121 | 4.96k | { | 122 | | /* Can't use the fast path if eg. the next char is a default-ignorable | 123 | | * or other skippable. */ | 124 | 4.96k | goto slow; | 125 | 4.96k | } | 126 | 1.68M | } | 127 | 41.4k | else | 128 | 41.4k | goto slow; | 129 | | | 130 | 1.68M | if (seconds && !seconds->may_have (second)) | 131 | 169k | return_trace (false); | 132 | 1.51M | bool unsafe_to_concat = false; | 133 | 9.18M | for (unsigned int i = 0; i < num_ligs; i++) | 134 | 8.02M | { | 135 | 8.02M | const auto &lig = this+ligature.arrayZ[i]; | 136 | 8.02M | if (unlikely (lig.component.lenP1 <= 1) || | 137 | 3.88M | lig.component.arrayZ[0] == second) | 138 | 4.82M | { | 139 | 4.82M | if (lig.apply (c)) | 140 | 359k | { | 141 | 359k | if (unsafe_to_concat) | 142 | 227k | c->buffer->unsafe_to_concat (c->buffer->idx, unsafe_to); | 143 | 359k | return_trace (true); | 144 | 359k | } | 145 | 4.82M | } | 146 | 3.20M | else if (likely (lig.component.lenP1 > 1)) | 147 | 3.20M | unsafe_to_concat = true; | 148 | 8.02M | } | 149 | 1.15M | if (likely (unsafe_to_concat)) | 150 | 1.12M | c->buffer->unsafe_to_concat (c->buffer->idx, unsafe_to); | 151 | | | 152 | 1.15M | return_trace (false); | 153 | 1.51M | } |
OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::apply(OT::hb_ot_apply_context_t*, hb_set_digest_t const*) const Line | Count | Source | 85 | 100k | { | 86 | 100k | TRACE_APPLY (this); | 87 | | | 88 | 100k | unsigned int num_ligs = ligature.len; | 89 | | | 90 | 100k | #ifndef HB_NO_OT_RULESETS_FAST_PATH | 91 | 100k | if (HB_OPTIMIZE_SIZE_VAL || num_ligs <= 1) | 92 | 52.5k | #endif | 93 | 52.5k | { | 94 | 57.9k | slow: | 95 | 79.2k | for (unsigned int i = 0; i < num_ligs; i++) | 96 | 21.3k | { | 97 | 21.3k | const auto &lig = this+ligature.arrayZ[i]; | 98 | 21.3k | if (lig.apply (c)) return_trace (true); | 99 | 21.3k | } | 100 | 57.9k | return_trace (false); | 101 | 57.9k | } | 102 | | | 103 | | /* This version is optimized for speed by matching the second component | 104 | | * of the ligature here, instead of calling into the ligation code. | 105 | | * | 106 | | * This is replicated in ChainRuleSet and RuleSet. */ | 107 | | | 108 | 47.8k | auto &skippy_iter = c->iter_context; | 109 | 47.8k | skippy_iter.reset (c->buffer->idx); | 110 | 47.8k | skippy_iter.set_match_func (match_always, nullptr); | 111 | 47.8k | skippy_iter.set_glyph_data ((HBUINT16 *) nullptr); | 112 | 47.8k | unsigned unsafe_to; | 113 | 47.8k | hb_codepoint_t second = (unsigned) -1; | 114 | 47.8k | bool matched = skippy_iter.next (&unsafe_to); | 115 | 47.8k | if (likely (matched)) | 116 | 43.9k | { | 117 | 43.9k | second = c->buffer->info[skippy_iter.idx].codepoint; | 118 | 43.9k | unsafe_to = skippy_iter.idx + 1; | 119 | | | 120 | 43.9k | if (skippy_iter.may_skip (c->buffer->info[skippy_iter.idx])) | 121 | 1.56k | { | 122 | | /* Can't use the fast path if eg. the next char is a default-ignorable | 123 | | * or other skippable. */ | 124 | 1.56k | goto slow; | 125 | 1.56k | } | 126 | 43.9k | } | 127 | 3.92k | else | 128 | 3.92k | goto slow; | 129 | | | 130 | 42.3k | if (seconds && !seconds->may_have (second)) | 131 | 10.0k | return_trace (false); | 132 | 32.3k | bool unsafe_to_concat = false; | 133 | 141k | for (unsigned int i = 0; i < num_ligs; i++) | 134 | 112k | { | 135 | 112k | const auto &lig = this+ligature.arrayZ[i]; | 136 | 112k | if (unlikely (lig.component.lenP1 <= 1) || | 137 | 89.1k | lig.component.arrayZ[0] == second) | 138 | 30.2k | { | 139 | 30.2k | if (lig.apply (c)) | 140 | 2.45k | { | 141 | 2.45k | if (unsafe_to_concat) | 142 | 1.31k | c->buffer->unsafe_to_concat (c->buffer->idx, unsafe_to); | 143 | 2.45k | return_trace (true); | 144 | 2.45k | } | 145 | 30.2k | } | 146 | 81.8k | else if (likely (lig.component.lenP1 > 1)) | 147 | 81.8k | unsafe_to_concat = true; | 148 | 112k | } | 149 | 29.8k | if (likely (unsafe_to_concat)) | 150 | 29.0k | c->buffer->unsafe_to_concat (c->buffer->idx, unsafe_to); | 151 | | | 152 | 29.8k | return_trace (false); | 153 | 32.3k | } |
|
154 | | |
155 | | bool serialize (hb_serialize_context_t *c, |
156 | | hb_array_t<const HBGlyphID16> ligatures, |
157 | | hb_array_t<const unsigned int> component_count_list, |
158 | | hb_array_t<const HBGlyphID16> &component_list /* Starting from second for each ligature */) |
159 | 7.16k | { |
160 | 7.16k | TRACE_SERIALIZE (this); |
161 | 7.16k | if (unlikely (!c->extend_min (this))) return_trace (false); |
162 | 7.13k | if (unlikely (!ligature.serialize (c, ligatures.length))) return_trace (false); |
163 | 28.0k | for (unsigned int i = 0; i < ligatures.length; i++) |
164 | 20.9k | { |
165 | 20.9k | unsigned int component_count = (unsigned) hb_max ((int) component_count_list[i] - 1, 0); |
166 | 20.9k | if (unlikely (!ligature[i].serialize_serialize (c, |
167 | 20.9k | ligatures[i], |
168 | 20.9k | component_list.sub_array (0, component_count)))) |
169 | 81 | return_trace (false); |
170 | 20.9k | component_list += component_count; |
171 | 20.9k | } |
172 | 7.13k | return_trace (true); |
173 | 7.13k | } |
174 | | |
175 | | bool subset (hb_subset_context_t *c, unsigned coverage_idx) const |
176 | 4.57k | { |
177 | 4.57k | TRACE_SUBSET (this); |
178 | 4.57k | auto *out = c->serializer->start_embed (*this); |
179 | 4.57k | if (unlikely (!c->serializer->extend_min (out))) return_trace (false); |
180 | | |
181 | 4.57k | + hb_iter (ligature) |
182 | 4.57k | | hb_filter (subset_offset_array (c, out->ligature, this, coverage_idx)) |
183 | 4.57k | | hb_drain |
184 | 4.57k | ; |
185 | | |
186 | 4.57k | if (bool (out->ligature)) |
187 | | // Ensure Coverage table is always packed after this. |
188 | 4.09k | c->serializer->add_virtual_link (coverage_idx); |
189 | | |
190 | 4.57k | return_trace (bool (out->ligature)); |
191 | 4.57k | } Unexecuted instantiation: OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::subset(hb_subset_context_t*, unsigned int) const OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>::subset(hb_subset_context_t*, unsigned int) const Line | Count | Source | 176 | 4.57k | { | 177 | 4.57k | TRACE_SUBSET (this); | 178 | 4.57k | auto *out = c->serializer->start_embed (*this); | 179 | 4.57k | if (unlikely (!c->serializer->extend_min (out))) return_trace (false); | 180 | | | 181 | 4.57k | + hb_iter (ligature) | 182 | 4.57k | | hb_filter (subset_offset_array (c, out->ligature, this, coverage_idx)) | 183 | 4.57k | | hb_drain | 184 | 4.57k | ; | 185 | | | 186 | 4.57k | if (bool (out->ligature)) | 187 | | // Ensure Coverage table is always packed after this. | 188 | 4.09k | c->serializer->add_virtual_link (coverage_idx); | 189 | | | 190 | 4.57k | return_trace (bool (out->ligature)); | 191 | 4.57k | } |
Unexecuted instantiation: OT::Layout::GSUB_impl::LigatureSet<OT::Layout::MediumTypes>::subset(hb_subset_context_t*, unsigned int) const |
192 | | }; |
193 | | |
194 | | } |
195 | | } |
196 | | } |
197 | | |
198 | | #endif /* OT_LAYOUT_GSUB_LIGATURESET_HH */ |