Coverage Report

Created: 2026-12-01 07:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/harfbuzz/src/hb-aat-layout-common.hh
Line
Count
Source
1
/*
2
 * Copyright © 2017  Google, Inc.
3
 *
4
 *  This is part of HarfBuzz, a text shaping library.
5
 *
6
 * Permission is hereby granted, without written agreement and without
7
 * license or royalty fees, to use, copy, modify, and distribute this
8
 * software and its documentation for any purpose, provided that the
9
 * above copyright notice and the following two paragraphs appear in
10
 * all copies of this software.
11
 *
12
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16
 * DAMAGE.
17
 *
18
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
21
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23
 *
24
 * Google Author(s): Behdad Esfahbod
25
 */
26
27
#ifndef HB_AAT_LAYOUT_COMMON_HH
28
#define HB_AAT_LAYOUT_COMMON_HH
29
30
#include "hb-aat-layout.hh"
31
#include "hb-aat-map.hh"
32
#include "hb-ot-layout-common.hh"
33
#include "hb-ot-layout-gdef-table.hh"
34
#include "hb-open-type.hh"
35
#include "hb-cache.hh"
36
#include "hb-bit-set.hh"
37
#include "hb-set-builder.hh"
38
#include "hb-bit-page.hh"
39
40
41
namespace OT {
42
struct GDEF;
43
};
44
45
namespace AAT {
46
47
using namespace OT;
48
49
struct ankr;
50
struct kern_pair_filter_t;
51
52
using hb_aat_class_cache_t = hb_ot_layout_mapping_cache_t;
53
54
struct hb_aat_scratch_t
55
{
56
27.3k
  hb_aat_scratch_t () = default;
57
  hb_aat_scratch_t (const hb_aat_scratch_t &) = delete;
58
59
  hb_aat_scratch_t (hb_aat_scratch_t &&o)
60
0
  {
61
0
    buffer_glyph_set.set_relaxed (o.buffer_glyph_set.get_relaxed ());
62
0
    o.buffer_glyph_set.set_relaxed (nullptr);
63
0
  }
64
  hb_aat_scratch_t & operator = (hb_aat_scratch_t &&o)
65
9.09k
  {
66
9.09k
    buffer_glyph_set.set_relaxed (o.buffer_glyph_set.get_relaxed ());
67
9.09k
    o.buffer_glyph_set.set_relaxed (nullptr);
68
9.09k
    return *this;
69
9.09k
  }
70
  ~hb_aat_scratch_t ()
71
27.3k
  {
72
27.3k
    auto *s = buffer_glyph_set.get_relaxed ();
73
27.3k
    if (unlikely (!s))
74
25.6k
      return;
75
1.68k
    s->fini ();
76
1.68k
    hb_free (s);
77
1.68k
  }
78
79
  hb_bit_set_t *create_buffer_glyph_set () const
80
1.13M
  {
81
1.13M
    hb_bit_set_t *s = buffer_glyph_set.get_acquire ();
82
1.13M
    if (s && buffer_glyph_set.cmpexch (s, nullptr))
83
1.12M
    {
84
1.12M
      s->clear ();
85
1.12M
      return s;
86
1.12M
    }
87
88
1.68k
    s = (hb_bit_set_t *) hb_calloc (1, sizeof (hb_bit_set_t));
89
1.68k
    if (unlikely (!s))
90
0
      return nullptr;
91
1.68k
    s->init ();
92
93
1.68k
    return s;
94
1.68k
  }
95
  void destroy_buffer_glyph_set (hb_bit_set_t *s) const
96
2.29M
  {
97
2.29M
    if (unlikely (!s))
98
1.16M
      return;
99
1.13M
    if (buffer_glyph_set.cmpexch (nullptr, s))
100
1.13M
      return;
101
0
    s->fini ();
102
0
    hb_free (s);
103
0
  }
104
105
  mutable hb_atomic_t<hb_bit_set_t *> buffer_glyph_set;
106
};
107
108
enum { DELETED_GLYPH = 0xFFFF };
109
110
0
#define HB_BUFFER_SCRATCH_FLAG_AAT_HAS_DELETED HB_BUFFER_SCRATCH_FLAG_SHAPER0
111
112
struct hb_aat_apply_context_t :
113
       hb_dispatch_context_t<hb_aat_apply_context_t, bool, HB_DEBUG_APPLY>
114
{
115
0
  const char *get_name () { return "APPLY"; }
116
  template <typename T, typename ...Ts>
117
  return_t dispatch (const T &obj, Ts&&... ds)
118
3.34M
  { return obj.apply (this, std::forward<Ts> (ds)...); }
bool AAT::hb_aat_apply_context_t::dispatch<OT::KernOT, AAT::kern_accelerator_data_t const&>(OT::KernOT const&, AAT::kern_accelerator_data_t const&)
Line
Count
Source
118
2.29M
  { return obj.apply (this, std::forward<Ts> (ds)...); }
bool AAT::hb_aat_apply_context_t::dispatch<AAT::KerxSubTableFormat0<OT::KernOTSubTableHeader>>(AAT::KerxSubTableFormat0<OT::KernOTSubTableHeader> const&)
Line
Count
Source
118
1.04M
  { return obj.apply (this, std::forward<Ts> (ds)...); }
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::KerxSubTableFormat1<OT::KernOTSubTableHeader>>(AAT::KerxSubTableFormat1<OT::KernOTSubTableHeader> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::KerxSubTableFormat2<OT::KernOTSubTableHeader>>(AAT::KerxSubTableFormat2<OT::KernOTSubTableHeader> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<OT::KernSubTableFormat3<OT::KernOTSubTableHeader>>(OT::KernSubTableFormat3<OT::KernOTSubTableHeader> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<OT::KernAAT, AAT::kern_accelerator_data_t const&>(OT::KernAAT const&, AAT::kern_accelerator_data_t const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::KerxSubTableFormat0<OT::KernAATSubTableHeader>>(AAT::KerxSubTableFormat0<OT::KernAATSubTableHeader> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::KerxSubTableFormat1<OT::KernAATSubTableHeader>>(AAT::KerxSubTableFormat1<OT::KernAATSubTableHeader> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::KerxSubTableFormat2<OT::KernAATSubTableHeader>>(AAT::KerxSubTableFormat2<OT::KernAATSubTableHeader> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<OT::KernSubTableFormat3<OT::KernAATSubTableHeader>>(OT::KernSubTableFormat3<OT::KernAATSubTableHeader> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::RearrangementSubtable<AAT::ExtendedTypes>>(AAT::RearrangementSubtable<AAT::ExtendedTypes> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::ContextualSubtable<AAT::ExtendedTypes>>(AAT::ContextualSubtable<AAT::ExtendedTypes> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::LigatureSubtable<AAT::ExtendedTypes>>(AAT::LigatureSubtable<AAT::ExtendedTypes> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::NoncontextualSubtable<AAT::ExtendedTypes>>(AAT::NoncontextualSubtable<AAT::ExtendedTypes> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::InsertionSubtable<AAT::ExtendedTypes>>(AAT::InsertionSubtable<AAT::ExtendedTypes> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::RearrangementSubtable<AAT::ObsoleteTypes>>(AAT::RearrangementSubtable<AAT::ObsoleteTypes> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::ContextualSubtable<AAT::ObsoleteTypes>>(AAT::ContextualSubtable<AAT::ObsoleteTypes> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::LigatureSubtable<AAT::ObsoleteTypes>>(AAT::LigatureSubtable<AAT::ObsoleteTypes> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::NoncontextualSubtable<AAT::ObsoleteTypes>>(AAT::NoncontextualSubtable<AAT::ObsoleteTypes> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::InsertionSubtable<AAT::ObsoleteTypes>>(AAT::InsertionSubtable<AAT::ObsoleteTypes> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::KerxSubTableFormat0<AAT::KerxSubTableHeader>>(AAT::KerxSubTableFormat0<AAT::KerxSubTableHeader> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::KerxSubTableFormat1<AAT::KerxSubTableHeader>>(AAT::KerxSubTableFormat1<AAT::KerxSubTableHeader> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::KerxSubTableFormat2<AAT::KerxSubTableHeader>>(AAT::KerxSubTableFormat2<AAT::KerxSubTableHeader> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>>(AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader> const&)
Unexecuted instantiation: bool AAT::hb_aat_apply_context_t::dispatch<AAT::KerxSubTableFormat6<AAT::KerxSubTableHeader>>(AAT::KerxSubTableFormat6<AAT::KerxSubTableHeader> const&)
119
0
  static return_t default_return_value () { return false; }
120
0
  bool stop_sublookup_iteration (return_t r) const { return r; }
121
122
  const hb_ot_shape_plan_t *plan;
123
  hb_font_t *font;
124
  hb_face_t *face;
125
  hb_buffer_t *buffer;
126
  hb_sanitize_context_t sanitizer;
127
  const ankr *ankr_table;
128
  const OT::GDEF &gdef;
129
  bool has_glyph_classes;
130
  const hb_sorted_vector_t<hb_aat_map_t::range_flags_t> *range_flags = nullptr;
131
  hb_mask_t subtable_flags = 0;
132
  bool buffer_is_reversed = false;
133
  // Caches
134
  bool using_buffer_glyph_set = false;
135
  hb_bit_set_t *buffer_glyph_set = nullptr;
136
  const hb_bit_set_t *first_set = nullptr;
137
  const hb_bit_set_t *second_set = nullptr;
138
  bool second_set_gates = false;
139
  union {
140
    hb_aat_class_cache_t *machine_class_cache = nullptr;
141
    const kern_pair_filter_t *kern_pair_filter;
142
  };
143
144
  /* Unused. For debug tracing only. */
145
  unsigned int lookup_index;
146
147
  HB_INTERNAL hb_aat_apply_context_t (const hb_ot_shape_plan_t *plan_,
148
              hb_font_t *font_,
149
              hb_buffer_t *buffer_,
150
              hb_blob_t *blob = const_cast<hb_blob_t *> (&Null (hb_blob_t)));
151
152
  HB_INTERNAL ~hb_aat_apply_context_t ();
153
154
  HB_INTERNAL void set_ankr_table (const AAT::ankr *ankr_table_);
155
156
9.94M
  void set_lookup_index (unsigned int i) { lookup_index = i; }
157
158
  void reverse_buffer ()
159
7.19k
  {
160
7.19k
    buffer->reverse ();
161
7.19k
    buffer_is_reversed = !buffer_is_reversed;
162
7.19k
  }
163
164
  void setup_buffer_glyph_set ()
165
1.13M
  {
166
1.13M
    using_buffer_glyph_set = buffer->len >= 4 && buffer_glyph_set;
167
168
1.13M
    if (likely (using_buffer_glyph_set))
169
1.13M
    {
170
1.13M
      if (likely (buffer->len <= 128))
171
1.12M
      {
172
1.12M
        buffer->collect_codepoints (*buffer_glyph_set);
173
1.12M
        using_buffer_glyph_set = !buffer_glyph_set->in_error ();
174
1.12M
        return;
175
1.12M
      }
176
10.0k
      buffer_glyph_set->clear ();
177
10.0k
      hb_set_builder_t<hb_bit_set_t> glyphs (*buffer_glyph_set);
178
3.70M
      for (unsigned i = 0; i < buffer->len; i++)
179
3.69M
        glyphs.add (buffer->info[i].codepoint);
180
      /* A partial set cannot be used to skip an AAT subtable. */
181
10.0k
      using_buffer_glyph_set = glyphs.flush ();
182
10.0k
    }
183
1.13M
  }
184
  bool buffer_intersects_machine () const
185
7.64M
  {
186
7.64M
    if (likely (using_buffer_glyph_set))
187
4.52M
      return buffer_glyph_set->intersects (*first_set);
188
189
    // Faster for shorter buffers.
190
8.01M
    for (unsigned i = 0; i < buffer->len; i++)
191
5.21M
      if (first_set->has (buffer->info[i].codepoint))
192
323k
  return true;
193
2.79M
    return false;
194
3.12M
  }
195
  /* Returns false (skip) only when second_set is a sufficient skip gate for the
196
   * subtable (second_set_gates) AND the buffer contains none of its completer
197
   * glyphs, so no action can fire. */
198
  bool buffer_intersects_second () const
199
1.04M
  {
200
1.04M
    if (!second_set_gates)
201
1.04M
      return true;
202
203
0
    if (likely (using_buffer_glyph_set))
204
0
      return buffer_glyph_set->intersects (*second_set);
205
206
    // Faster for shorter buffers.
207
0
    for (unsigned i = 0; i < buffer->len; i++)
208
0
      if (second_set->has (buffer->info[i].codepoint))
209
0
  return true;
210
0
    return false;
211
0
  }
212
213
  template <typename T>
214
  HB_NODISCARD bool output_glyphs (unsigned int count,
215
           const T *glyphs)
216
0
  {
217
0
    if (likely (using_buffer_glyph_set))
218
0
      buffer_glyph_set->add_array (glyphs, count);
219
0
    for (unsigned int i = 0; i < count; i++)
220
0
    {
221
0
      bool at_end_of_text = buffer->idx == buffer->len;
222
0
      if (at_end_of_text)
223
0
  if (unlikely (!buffer->output_glyph (glyphs[i]))) return false;
224
225
0
      hb_glyph_info_t &info = at_end_of_text ? buffer->prev () : buffer->cur ();
226
0
      if (glyphs[i] == DELETED_GLYPH)
227
0
      {
228
0
        buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_AAT_HAS_DELETED;
229
0
  _hb_glyph_info_set_aat_deleted (&info);
230
0
      }
231
0
      else
232
0
      {
233
0
#ifndef HB_NO_OT_LAYOUT
234
0
  if (has_glyph_classes)
235
0
    _hb_glyph_info_set_glyph_props (&info,
236
0
            gdef.get_glyph_props (glyphs[i]));
237
0
#endif
238
0
      }
239
0
      if (!at_end_of_text)
240
0
  if (unlikely (!buffer->output_glyph (glyphs[i]))) return false;
241
0
    }
242
0
    return true;
243
0
  }
244
245
  HB_NODISCARD bool replace_glyph (hb_codepoint_t glyph)
246
0
  {
247
0
    if (glyph == DELETED_GLYPH)
248
0
    {
249
0
      buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_AAT_HAS_DELETED;
250
0
      _hb_glyph_info_set_aat_deleted (&buffer->cur());
251
0
    }
252
253
0
    if (likely (using_buffer_glyph_set))
254
0
      buffer_glyph_set->add (glyph);
255
0
#ifndef HB_NO_OT_LAYOUT
256
0
    if (has_glyph_classes)
257
0
      _hb_glyph_info_set_glyph_props (&buffer->cur(),
258
0
              gdef.get_glyph_props (glyph));
259
0
#endif
260
0
    return buffer->replace_glyph (glyph);
261
0
  }
262
263
  HB_NODISCARD bool delete_glyph ()
264
0
  {
265
0
    buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_AAT_HAS_DELETED;
266
0
    _hb_glyph_info_set_aat_deleted (&buffer->cur());
267
0
    if (likely (using_buffer_glyph_set))
268
0
      buffer_glyph_set->add (DELETED_GLYPH);
269
0
    return buffer->replace_glyph (DELETED_GLYPH);
270
0
  }
271
272
  void replace_glyph_inplace (unsigned i, hb_codepoint_t glyph)
273
0
  {
274
0
    buffer->info[i].codepoint = glyph;
275
0
    if (glyph == DELETED_GLYPH)
276
0
    {
277
0
      buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_AAT_HAS_DELETED;
278
0
      _hb_glyph_info_set_aat_deleted (&buffer->info[i]);
279
0
    }
280
0
    if (likely (using_buffer_glyph_set))
281
0
      buffer_glyph_set->add (glyph);
282
0
#ifndef HB_NO_OT_LAYOUT
283
0
    if (has_glyph_classes)
284
0
      _hb_glyph_info_set_glyph_props (&buffer->info[i],
285
0
              gdef.get_glyph_props (glyph));
286
0
#endif
287
0
  }
288
};
289
290
291
/*
292
 * Lookup Table
293
 */
294
295
template <typename T> struct Lookup;
296
297
/* Collects the glyphs of LookupFormat2 / LookupFormat4 segments.
298
 *
299
 * Segments are supposed to be sorted and disjoint, in which case adding
300
 * them one by one touches each glyph and each page of the set at most once.
301
 * The sanitizer does not check that, and a malformed table can repeat a
302
 * segment spanning the whole glyph range thousands of times, each costing a
303
 * full pass.  So once a segment is out of order, add the rest as a single
304
 * range; that is a superset of the glyphs, which is fine for a set that is
305
 * only used as a pre-filter. */
306
template <typename segments_t, typename set_t, typename filter_t>
307
static inline void
308
collect_segments_glyphs_filtered (const segments_t &segments,
309
          set_t &glyphs,
310
          const void *base,
311
          const filter_t &filter)
312
0
{
313
0
  unsigned count = segments.get_length ();
314
0
  hb_codepoint_t next = 0; /* One past the last glyph added. */
315
0
  unsigned i;
316
0
  for (i = 0; i < count; i++)
317
0
  {
318
0
    const auto &segment = segments[i];
319
0
    if (segment.first < next) break; /* Not sorted and disjoint. */
320
0
    if (!segment.may_match (base, filter))
321
0
      continue;
322
0
    segment.collect_glyphs_filtered (glyphs, base, filter);
323
0
    next = segment.last + 1;
324
0
  }
325
326
0
  hb_codepoint_t first = HB_CODEPOINT_INVALID, last = 0;
327
0
  for (; i < count; i++)
328
0
  {
329
0
    const auto &segment = segments[i];
330
0
    if (!segment.may_match (base, filter))
331
0
      continue;
332
0
    first = hb_min (first, (hb_codepoint_t) segment.first);
333
0
    last = hb_max (last, (hb_codepoint_t) segment.last);
334
0
  }
335
0
  if (first <= last)
336
0
    glyphs.add_range (first, last);
337
0
}
Unexecuted instantiation: hb-ot-face.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> > >, hb_bit_set_t, AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1}>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> > > const&, hb_bit_set_t&, void const*, AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1} const&)
Unexecuted instantiation: hb-ot-face.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> > >, hb_bit_set_t, AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1}>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> > > const&, hb_bit_set_t&, void const*, AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1} const&)
Unexecuted instantiation: hb-ot-face.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> > >, hb_bit_set_t, hb_bit_page_t>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> > > const&, hb_bit_set_t&, void const*, hb_bit_page_t const&)
Unexecuted instantiation: hb-ot-face.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> > >, hb_bit_set_t, hb_bit_page_t>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> > > const&, hb_bit_set_t&, void const*, hb_bit_page_t const&)
Unexecuted instantiation: hb-ot-face.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned int, 4u> > >, hb_bit_set_t, AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1}>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned int, 4u> > > const&, hb_bit_set_t&, void const*, AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1} const&)
Unexecuted instantiation: hb-ot-face.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned int, 4u> > >, hb_bit_set_t, AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1}>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned int, 4u> > > const&, hb_bit_set_t&, void const*, AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1} const&)
Unexecuted instantiation: hb-aat-layout.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> > >, hb_bit_set_t, AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1}>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> > > const&, hb_bit_set_t&, void const*, AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1} const&)
Unexecuted instantiation: hb-aat-layout.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> > >, hb_bit_set_t, AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1}>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> > > const&, hb_bit_set_t&, void const*, AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1} const&)
Unexecuted instantiation: hb-aat-layout.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> > >, hb_bit_set_t, hb_bit_page_t>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> > > const&, hb_bit_set_t&, void const*, hb_bit_page_t const&)
Unexecuted instantiation: hb-aat-layout.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> > >, hb_bit_set_t, hb_bit_page_t>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> > > const&, hb_bit_set_t&, void const*, hb_bit_page_t const&)
Unexecuted instantiation: hb-aat-layout.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::HBGlyphID16> >, hb_bit_set_t, AAT::LookupFormat2<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1}>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::HBGlyphID16> > const&, hb_bit_set_t&, void const*, AAT::LookupFormat2<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1} const&)
Unexecuted instantiation: hb-aat-layout.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::HBGlyphID16> >, hb_bit_set_t, AAT::LookupFormat4<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1}>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::HBGlyphID16> > const&, hb_bit_set_t&, void const*, AAT::LookupFormat4<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1} const&)
Unexecuted instantiation: hb-aat-layout.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned int, 4u> > >, hb_bit_set_t, AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1}>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned int, 4u> > > const&, hb_bit_set_t&, void const*, AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1} const&)
Unexecuted instantiation: hb-aat-layout.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned int, 4u> > >, hb_bit_set_t, AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1}>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned int, 4u> > > const&, hb_bit_set_t&, void const*, AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1} const&)
Unexecuted instantiation: hb-ot-layout.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> > >, hb_bit_set_t, AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1}>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> > > const&, hb_bit_set_t&, void const*, AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1} const&)
Unexecuted instantiation: hb-ot-layout.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> > >, hb_bit_set_t, AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1}>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> > > const&, hb_bit_set_t&, void const*, AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1} const&)
Unexecuted instantiation: hb-ot-layout.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> > >, hb_bit_set_t, hb_bit_page_t>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> > > const&, hb_bit_set_t&, void const*, hb_bit_page_t const&)
Unexecuted instantiation: hb-ot-layout.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> > >, hb_bit_set_t, hb_bit_page_t>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> > > const&, hb_bit_set_t&, void const*, hb_bit_page_t const&)
Unexecuted instantiation: hb-ot-layout.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned int, 4u> > >, hb_bit_set_t, AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1}>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentSingle<OT::NumType<true, unsigned int, 4u> > > const&, hb_bit_set_t&, void const*, AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1} const&)
Unexecuted instantiation: hb-ot-layout.cc:void AAT::collect_segments_glyphs_filtered<OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned int, 4u> > >, hb_bit_set_t, AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1}>(OT::VarSizedBinSearchArrayOf<AAT::LookupSegmentArray<OT::NumType<true, unsigned int, 4u> > > const&, hb_bit_set_t&, void const*, AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1} const&)
338
339
template <typename T>
340
struct LookupFormat0
341
{
342
  friend struct Lookup<T>;
343
344
  private:
345
  const T* get_value (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
346
0
  {
347
0
    if (unlikely (glyph_id >= num_glyphs)) return nullptr;
348
0
    return &arrayZ[glyph_id];
349
0
  }
Unexecuted instantiation: AAT::LookupFormat0<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::get_value(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::LookupFormat0<OT::NumType<true, unsigned short, 2u> >::get_value(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::LookupFormat0<OT::HBGlyphID16>::get_value(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::LookupFormat0<OT::NumType<true, unsigned int, 4u> >::get_value(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::LookupFormat0<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::get_value(unsigned int, unsigned int) const
350
351
  template <typename set_t>
352
  void collect_glyphs (set_t &glyphs, unsigned num_glyphs) const
353
0
  {
354
0
    glyphs.add_range (0, num_glyphs - 1);
355
0
  }
Unexecuted instantiation: void AAT::LookupFormat0<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&, unsigned int) const
Unexecuted instantiation: void AAT::LookupFormat0<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&, unsigned int) const
Unexecuted instantiation: void AAT::LookupFormat0<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&, unsigned int) const
356
  template <typename set_t, typename filter_t>
357
  void collect_glyphs_filtered (set_t &glyphs, unsigned num_glyphs, const filter_t &filter) const
358
0
  {
359
0
    for (unsigned i = 0; i < num_glyphs; i++)
360
0
      if (filter (arrayZ[i]))
361
0
  glyphs.add (i);
362
0
  }
363
364
  bool sanitize (hb_sanitize_context_t *c) const
365
0
  {
366
0
    TRACE_SANITIZE (this);
367
0
    return_trace (arrayZ.sanitize (c, c->get_num_glyphs ()));
368
0
  }
Unexecuted instantiation: AAT::LookupFormat0<OT::NumType<true, unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat0<OT::NumType<true, unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat0<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
369
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
370
0
  {
371
0
    TRACE_SANITIZE (this);
372
0
    return_trace (arrayZ.sanitize (c, c->get_num_glyphs (), base));
373
0
  }
Unexecuted instantiation: AAT::LookupFormat0<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat0<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat0<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
374
375
  protected:
376
  HBUINT16  format;   /* Format identifier--format = 0 */
377
  UnsizedArrayOf<T>
378
    arrayZ;   /* Array of lookup values, indexed by glyph index. */
379
  public:
380
  DEFINE_SIZE_UNBOUNDED (2);
381
};
382
383
384
template <typename T>
385
struct LookupSegmentSingle
386
{
387
  static constexpr unsigned TerminationWordCount = 2u;
388
389
  int cmp (hb_codepoint_t g) const
390
0
  { return g < first ? -1 : g <= last ? 0 : +1 ; }
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::HBGlyphID16>::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::NumType<true, unsigned int, 4u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::cmp(unsigned int) const
391
392
  template <typename set_t>
393
  void collect_glyphs (set_t &glyphs) const
394
  {
395
    if (first == DELETED_GLYPH) return;
396
    glyphs.add_range (first, last);
397
  }
398
  template <typename filter_t>
399
  bool may_match (const void *base HB_UNUSED, const filter_t &filter) const
400
0
  { return first != DELETED_GLYPH && first <= last && filter (value); }
Unexecuted instantiation: bool AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> >::may_match<AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1}>(void const*, AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1} const&) const
Unexecuted instantiation: bool AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> >::may_match<hb_bit_page_t>(void const*, hb_bit_page_t const&) const
Unexecuted instantiation: bool AAT::LookupSegmentSingle<OT::NumType<true, unsigned int, 4u> >::may_match<AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1}>(void const*, AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1} const&) const
Unexecuted instantiation: bool AAT::LookupSegmentSingle<OT::HBGlyphID16>::may_match<AAT::LookupFormat2<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1}>(void const*, AAT::LookupFormat2<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1} const&) const
401
  template <typename set_t, typename filter_t>
402
  void collect_glyphs_filtered (set_t &glyphs, const void *base, const filter_t &filter) const
403
0
  {
404
0
    if (!may_match (base, filter)) return;
405
0
    glyphs.add_range (first, last);
406
0
  }
Unexecuted instantiation: void AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> >::collect_glyphs_filtered<hb_bit_set_t, AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1}>(hb_bit_set_t&, void const*, AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1} const&) const
Unexecuted instantiation: void AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> >::collect_glyphs_filtered<hb_bit_set_t, hb_bit_page_t>(hb_bit_set_t&, void const*, hb_bit_page_t const&) const
Unexecuted instantiation: void AAT::LookupSegmentSingle<OT::NumType<true, unsigned int, 4u> >::collect_glyphs_filtered<hb_bit_set_t, AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1}>(hb_bit_set_t&, void const*, AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1} const&) const
Unexecuted instantiation: void AAT::LookupSegmentSingle<OT::HBGlyphID16>::collect_glyphs_filtered<hb_bit_set_t, AAT::LookupFormat2<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1}>(hb_bit_set_t&, void const*, AAT::LookupFormat2<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1} const&) const
407
408
  bool sanitize (hb_sanitize_context_t *c) const
409
0
  {
410
0
    TRACE_SANITIZE (this);
411
0
    return_trace (c->check_struct (this) && value.sanitize (c));
412
0
  }
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::NumType<true, unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::NumType<true, unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
413
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
414
0
  {
415
0
    TRACE_SANITIZE (this);
416
0
    return_trace (c->check_struct (this) && value.sanitize (c, base));
417
0
  }
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
418
419
  HBGlyphID16 last;   /* Last GlyphID in this segment */
420
  HBGlyphID16 first;    /* First GlyphID in this segment */
421
  T   value;    /* The lookup value (only one) */
422
  public:
423
  DEFINE_SIZE_STATIC (4 + T::static_size);
424
};
425
426
template <typename T>
427
struct LookupFormat2
428
{
429
  friend struct Lookup<T>;
430
431
  private:
432
  const T* get_value (hb_codepoint_t glyph_id) const
433
0
  {
434
0
    const LookupSegmentSingle<T> *v = segments.bsearch (glyph_id);
435
0
    return v ? &v->value : nullptr;
436
0
  }
Unexecuted instantiation: AAT::LookupFormat2<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat2<OT::HBGlyphID16>::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat2<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::get_value(unsigned int) const
437
438
  template <typename set_t>
439
  void collect_glyphs (set_t &glyphs) const
440
0
  {
441
0
    collect_glyphs_filtered (glyphs, [] (const T &) { return true; });
Unexecuted instantiation: AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1}::operator()(OT::NumType<true, unsigned short, 2u> const&) const
Unexecuted instantiation: AAT::LookupFormat2<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1}::operator()(OT::HBGlyphID16 const&) const
Unexecuted instantiation: AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1}::operator()(OT::NumType<true, unsigned int, 4u> const&) const
442
0
  }
Unexecuted instantiation: void AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupFormat2<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
443
  template <typename set_t, typename filter_t>
444
  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
445
0
  { collect_segments_glyphs_filtered (segments, glyphs, this, filter); }
Unexecuted instantiation: void AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs_filtered<hb_bit_set_t, AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1}>(hb_bit_set_t&, AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1} const&) const
Unexecuted instantiation: void AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::collect_glyphs_filtered<hb_bit_set_t, hb_bit_page_t>(hb_bit_set_t&, hb_bit_page_t const&) const
Unexecuted instantiation: void AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs_filtered<hb_bit_set_t, AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1}>(hb_bit_set_t&, AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1} const&) const
Unexecuted instantiation: void AAT::LookupFormat2<OT::HBGlyphID16>::collect_glyphs_filtered<hb_bit_set_t, AAT::LookupFormat2<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1}>(hb_bit_set_t&, AAT::LookupFormat2<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1} const&) const
446
447
  bool sanitize (hb_sanitize_context_t *c) const
448
0
  {
449
0
    TRACE_SANITIZE (this);
450
0
    return_trace (segments.sanitize (c));
451
0
  }
Unexecuted instantiation: AAT::LookupFormat2<OT::NumType<true, unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat2<OT::NumType<true, unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat2<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
452
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
453
0
  {
454
0
    TRACE_SANITIZE (this);
455
0
    return_trace (segments.sanitize (c, base));
456
0
  }
Unexecuted instantiation: AAT::LookupFormat2<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat2<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat2<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
457
458
  protected:
459
  HBUINT16  format;   /* Format identifier--format = 2 */
460
  VarSizedBinSearchArrayOf<LookupSegmentSingle<T>>
461
    segments; /* The actual segments. These must already be sorted,
462
         * according to the first word in each one (the last
463
         * glyph in each segment). */
464
  public:
465
  DEFINE_SIZE_ARRAY (8, segments);
466
};
467
468
template <typename T>
469
struct LookupSegmentArray
470
{
471
  static constexpr unsigned TerminationWordCount = 2u;
472
473
  const T* get_value (hb_codepoint_t glyph_id, const void *base) const
474
0
  {
475
0
    return first <= glyph_id && glyph_id <= last ? &(base+valuesZ)[glyph_id - first] : nullptr;
476
0
  }
Unexecuted instantiation: AAT::LookupSegmentArray<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::get_value(unsigned int, void const*) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> >::get_value(unsigned int, void const*) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::HBGlyphID16>::get_value(unsigned int, void const*) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::NumType<true, unsigned int, 4u> >::get_value(unsigned int, void const*) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::get_value(unsigned int, void const*) const
477
478
  template <typename set_t>
479
  void collect_glyphs (set_t &glyphs) const
480
  {
481
    if (first == DELETED_GLYPH) return;
482
    glyphs.add_range (first, last);
483
  }
484
  /* Without looking at the values; for a superset. */
485
  template <typename filter_t>
486
  bool may_match (const void *base HB_UNUSED, const filter_t &filter HB_UNUSED) const
487
0
  { return first != DELETED_GLYPH && first <= last; }
Unexecuted instantiation: bool AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> >::may_match<AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1}>(void const*, AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1} const&) const
Unexecuted instantiation: bool AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> >::may_match<hb_bit_page_t>(void const*, hb_bit_page_t const&) const
Unexecuted instantiation: bool AAT::LookupSegmentArray<OT::NumType<true, unsigned int, 4u> >::may_match<AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1}>(void const*, AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1} const&) const
Unexecuted instantiation: bool AAT::LookupSegmentArray<OT::HBGlyphID16>::may_match<AAT::LookupFormat4<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1}>(void const*, AAT::LookupFormat4<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1} const&) const
488
  template <typename set_t, typename filter_t>
489
  void collect_glyphs_filtered (set_t &glyphs, const void *base, const filter_t &filter) const
490
0
  {
491
0
    if (first == DELETED_GLYPH) return;
492
0
    const auto &values = base+valuesZ;
493
0
    for (hb_codepoint_t i = first; i <= last; i++)
494
0
      if (filter (values[i - first]))
495
0
  glyphs.add (i);
496
0
  }
Unexecuted instantiation: void AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> >::collect_glyphs_filtered<hb_bit_set_t, AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1}>(hb_bit_set_t&, void const*, AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1} const&) const
Unexecuted instantiation: void AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> >::collect_glyphs_filtered<hb_bit_set_t, hb_bit_page_t>(hb_bit_set_t&, void const*, hb_bit_page_t const&) const
Unexecuted instantiation: void AAT::LookupSegmentArray<OT::NumType<true, unsigned int, 4u> >::collect_glyphs_filtered<hb_bit_set_t, AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1}>(hb_bit_set_t&, void const*, AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1} const&) const
Unexecuted instantiation: void AAT::LookupSegmentArray<OT::HBGlyphID16>::collect_glyphs_filtered<hb_bit_set_t, AAT::LookupFormat4<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1}>(hb_bit_set_t&, void const*, AAT::LookupFormat4<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1} const&) const
497
498
  int cmp (hb_codepoint_t g) const
499
0
  { return g < first ? -1 : g <= last ? 0 : +1; }
Unexecuted instantiation: AAT::LookupSegmentArray<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::HBGlyphID16>::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::NumType<true, unsigned int, 4u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::cmp(unsigned int) const
500
501
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
502
0
  {
503
0
    TRACE_SANITIZE (this);
504
0
    return_trace (c->check_struct (this) &&
505
0
      hb_barrier () &&
506
0
      first <= last &&
507
0
      valuesZ.sanitize (c, base, last - first + 1));
508
0
  }
Unexecuted instantiation: AAT::LookupSegmentArray<OT::NumType<true, unsigned short, 2u> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::NumType<true, unsigned int, 4u> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*, void const*) const
509
  template <typename ...Ts>
510
  bool sanitize (hb_sanitize_context_t *c, const void *base, Ts&&... ds) const
511
0
  {
512
0
    TRACE_SANITIZE (this);
513
0
    return_trace (c->check_struct (this) &&
514
0
      hb_barrier () &&
515
0
      first <= last &&
516
0
      valuesZ.sanitize (c, base, last - first + 1, std::forward<Ts> (ds)...));
517
0
  }
Unexecuted instantiation: bool AAT::LookupSegmentArray<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::sanitize<void const*&>(hb_sanitize_context_t*, void const*, void const*&) const
Unexecuted instantiation: bool AAT::LookupSegmentArray<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize<void const*&>(hb_sanitize_context_t*, void const*, void const*&) const
Unexecuted instantiation: bool AAT::LookupSegmentArray<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize<void const*&>(hb_sanitize_context_t*, void const*, void const*&) const
518
519
  HBGlyphID16 last;   /* Last GlyphID in this segment */
520
  HBGlyphID16 first;    /* First GlyphID in this segment */
521
  NNOffset16To<UnsizedArrayOf<T>>
522
    valuesZ;  /* A 16-bit offset from the start of
523
         * the table to the data. */
524
  public:
525
  DEFINE_SIZE_STATIC (6);
526
};
527
528
template <typename T>
529
struct LookupFormat4
530
{
531
  friend struct Lookup<T>;
532
533
  private:
534
  const T* get_value (hb_codepoint_t glyph_id) const
535
0
  {
536
0
    const LookupSegmentArray<T> *v = segments.bsearch (glyph_id);
537
0
    return v ? v->get_value (glyph_id, this) : nullptr;
538
0
  }
Unexecuted instantiation: AAT::LookupFormat4<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat4<OT::HBGlyphID16>::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat4<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::get_value(unsigned int) const
539
540
  template <typename set_t>
541
  void collect_glyphs (set_t &glyphs) const
542
0
  {
543
0
    collect_glyphs_filtered (glyphs, [] (const T &) { return true; });
Unexecuted instantiation: AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1}::operator()(OT::NumType<true, unsigned short, 2u> const&) const
Unexecuted instantiation: AAT::LookupFormat4<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1}::operator()(OT::HBGlyphID16 const&) const
Unexecuted instantiation: AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1}::operator()(OT::NumType<true, unsigned int, 4u> const&) const
544
0
  }
Unexecuted instantiation: void AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupFormat4<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
545
  template <typename set_t, typename filter_t>
546
  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
547
0
  { collect_segments_glyphs_filtered (segments, glyphs, this, filter); }
Unexecuted instantiation: void AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs_filtered<hb_bit_set_t, AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1}>(hb_bit_set_t&, AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned short, 2u> const&)#1} const&) const
Unexecuted instantiation: void AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::collect_glyphs_filtered<hb_bit_set_t, hb_bit_page_t>(hb_bit_set_t&, hb_bit_page_t const&) const
Unexecuted instantiation: void AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs_filtered<hb_bit_set_t, AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1}>(hb_bit_set_t&, AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::NumType<true, unsigned int, 4u> const&)#1} const&) const
Unexecuted instantiation: void AAT::LookupFormat4<OT::HBGlyphID16>::collect_glyphs_filtered<hb_bit_set_t, AAT::LookupFormat4<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1}>(hb_bit_set_t&, AAT::LookupFormat4<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const::{lambda(OT::HBGlyphID16 const&)#1} const&) const
548
549
  bool sanitize (hb_sanitize_context_t *c) const
550
0
  {
551
0
    TRACE_SANITIZE (this);
552
0
    return_trace (segments.sanitize (c, this));
553
0
  }
Unexecuted instantiation: AAT::LookupFormat4<OT::NumType<true, unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat4<OT::NumType<true, unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat4<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
554
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
555
0
  {
556
0
    TRACE_SANITIZE (this);
557
0
    return_trace (segments.sanitize (c, this, base));
558
0
  }
Unexecuted instantiation: AAT::LookupFormat4<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat4<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat4<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
559
560
  protected:
561
  HBUINT16  format;   /* Format identifier--format = 4 */
562
  VarSizedBinSearchArrayOf<LookupSegmentArray<T>>
563
    segments; /* The actual segments. These must already be sorted,
564
         * according to the first word in each one (the last
565
         * glyph in each segment). */
566
  public:
567
  DEFINE_SIZE_ARRAY (8, segments);
568
};
569
570
template <typename T>
571
struct LookupSingle
572
{
573
  static constexpr unsigned TerminationWordCount = 1u;
574
575
0
  int cmp (hb_codepoint_t g) const { return glyph.cmp (g); }
Unexecuted instantiation: AAT::LookupSingle<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSingle<OT::NumType<true, unsigned short, 2u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSingle<OT::HBGlyphID16>::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSingle<OT::NumType<true, unsigned int, 4u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSingle<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::cmp(unsigned int) const
576
577
  template <typename set_t>
578
  void collect_glyphs (set_t &glyphs) const
579
0
  {
580
0
    if (glyph == DELETED_GLYPH) return;
581
0
    glyphs.add (glyph);
582
0
  }
Unexecuted instantiation: void AAT::LookupSingle<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupSingle<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupSingle<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
583
  template <typename set_t, typename filter_t>
584
  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
585
0
  {
586
0
    if (glyph == DELETED_GLYPH) return;
587
0
    if (!filter (value)) return;
588
0
    glyphs.add (glyph);
589
0
  }
590
591
  bool sanitize (hb_sanitize_context_t *c) const
592
0
  {
593
0
    TRACE_SANITIZE (this);
594
0
    return_trace (c->check_struct (this) && value.sanitize (c));
595
0
  }
Unexecuted instantiation: AAT::LookupSingle<OT::NumType<true, unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupSingle<OT::NumType<true, unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupSingle<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
596
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
597
0
  {
598
0
    TRACE_SANITIZE (this);
599
0
    return_trace (c->check_struct (this) && value.sanitize (c, base));
600
0
  }
Unexecuted instantiation: AAT::LookupSingle<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupSingle<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupSingle<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
601
602
  HBGlyphID16 glyph;    /* Last GlyphID */
603
  T   value;    /* The lookup value (only one) */
604
  public:
605
  DEFINE_SIZE_STATIC (2 + T::static_size);
606
};
607
608
template <typename T>
609
struct LookupFormat6
610
{
611
  friend struct Lookup<T>;
612
613
  private:
614
  const T* get_value (hb_codepoint_t glyph_id) const
615
0
  {
616
0
    const LookupSingle<T> *v = entries.bsearch (glyph_id);
617
0
    return v ? &v->value : nullptr;
618
0
  }
Unexecuted instantiation: AAT::LookupFormat6<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat6<OT::NumType<true, unsigned short, 2u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat6<OT::HBGlyphID16>::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat6<OT::NumType<true, unsigned int, 4u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat6<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::get_value(unsigned int) const
619
620
  template <typename set_t>
621
  void collect_glyphs (set_t &glyphs) const
622
0
  {
623
0
    unsigned count = entries.get_length ();
624
0
    for (unsigned i = 0; i < count; i++)
625
0
      entries[i].collect_glyphs (glyphs);
626
0
  }
Unexecuted instantiation: void AAT::LookupFormat6<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupFormat6<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupFormat6<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
627
  template <typename set_t, typename filter_t>
628
  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
629
0
  {
630
0
    unsigned count = entries.get_length ();
631
0
    for (unsigned i = 0; i < count; i++)
632
0
      entries[i].collect_glyphs_filtered (glyphs, filter);
633
0
  }
634
635
  bool sanitize (hb_sanitize_context_t *c) const
636
0
  {
637
0
    TRACE_SANITIZE (this);
638
0
    return_trace (entries.sanitize (c));
639
0
  }
Unexecuted instantiation: AAT::LookupFormat6<OT::NumType<true, unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat6<OT::NumType<true, unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat6<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
640
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
641
0
  {
642
0
    TRACE_SANITIZE (this);
643
0
    return_trace (entries.sanitize (c, base));
644
0
  }
Unexecuted instantiation: AAT::LookupFormat6<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat6<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat6<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
645
646
  protected:
647
  HBUINT16  format;   /* Format identifier--format = 6 */
648
  VarSizedBinSearchArrayOf<LookupSingle<T>>
649
    entries;  /* The actual entries, sorted by glyph index. */
650
  public:
651
  DEFINE_SIZE_ARRAY (8, entries);
652
};
653
654
template <typename T>
655
struct LookupFormat8
656
{
657
  friend struct Lookup<T>;
658
659
  private:
660
  const T* get_value (hb_codepoint_t glyph_id) const
661
0
  {
662
0
    return firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount ?
663
0
     &valueArrayZ[glyph_id - firstGlyph] : nullptr;
664
0
  }
Unexecuted instantiation: AAT::LookupFormat8<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat8<OT::NumType<true, unsigned short, 2u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat8<OT::HBGlyphID16>::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat8<OT::NumType<true, unsigned int, 4u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat8<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::get_value(unsigned int) const
665
666
  template <typename set_t>
667
  void collect_glyphs (set_t &glyphs) const
668
0
  {
669
0
    if (unlikely (!glyphCount)) return;
670
0
    if (firstGlyph == DELETED_GLYPH) return;
671
0
    glyphs.add_range (firstGlyph, firstGlyph + glyphCount - 1);
672
0
  }
Unexecuted instantiation: void AAT::LookupFormat8<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupFormat8<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupFormat8<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
673
  template <typename set_t, typename filter_t>
674
  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
675
0
  {
676
0
    if (unlikely (!glyphCount)) return;
677
0
    if (firstGlyph == DELETED_GLYPH) return;
678
0
    const T *p = valueArrayZ.arrayZ;
679
0
    for (unsigned i = 0; i < glyphCount; i++)
680
0
      if (filter (p[i]))
681
0
  glyphs.add (firstGlyph + i);
682
0
  }
683
684
  bool sanitize (hb_sanitize_context_t *c) const
685
0
  {
686
0
    TRACE_SANITIZE (this);
687
0
    return_trace (c->check_struct (this) && valueArrayZ.sanitize (c, glyphCount));
688
0
  }
Unexecuted instantiation: AAT::LookupFormat8<OT::NumType<true, unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat8<OT::NumType<true, unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat8<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
689
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
690
0
  {
691
0
    TRACE_SANITIZE (this);
692
0
    return_trace (c->check_struct (this) && valueArrayZ.sanitize (c, glyphCount, base));
693
0
  }
Unexecuted instantiation: AAT::LookupFormat8<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat8<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat8<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
694
695
  protected:
696
  HBUINT16  format;   /* Format identifier--format = 8 */
697
  HBGlyphID16 firstGlyph; /* First glyph index included in the trimmed array. */
698
  HBUINT16  glyphCount; /* Total number of glyphs (equivalent to the last
699
         * glyph minus the value of firstGlyph plus 1). */
700
  UnsizedArrayOf<T>
701
    valueArrayZ;  /* The lookup values (indexed by the glyph index
702
         * minus the value of firstGlyph). */
703
  public:
704
  DEFINE_SIZE_ARRAY (6, valueArrayZ);
705
};
706
707
template <typename T>
708
struct LookupFormat10
709
{
710
  friend struct Lookup<T>;
711
712
  private:
713
  const typename T::type get_value_or_null (hb_codepoint_t glyph_id) const
714
0
  {
715
0
    if (!(firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount))
716
0
      return Null (T);
717
718
0
    const HBUINT8 *p = &valueArrayZ[(glyph_id - firstGlyph) * valueSize];
719
720
0
    unsigned int v = 0;
721
0
    unsigned int count = valueSize;
722
0
    for (unsigned int i = 0; i < count; i++)
723
0
      v = (v << 8) | *p++;
724
725
0
    return v;
726
0
  }
Unexecuted instantiation: AAT::LookupFormat10<OT::NumType<true, unsigned int, 4u> >::get_value_or_null(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat10<OT::NumType<true, unsigned short, 2u> >::get_value_or_null(unsigned int) const
727
728
  template <typename set_t>
729
  void collect_glyphs (set_t &glyphs) const
730
0
  {
731
0
    if (unlikely (!glyphCount)) return;
732
0
    if (firstGlyph == DELETED_GLYPH) return;
733
0
    glyphs.add_range (firstGlyph, firstGlyph + glyphCount - 1);
734
0
  }
Unexecuted instantiation: void AAT::LookupFormat10<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupFormat10<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupFormat10<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
735
736
  template <typename set_t, typename filter_t>
737
  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
738
0
  {
739
0
    if (unlikely (!glyphCount)) return;
740
0
    if (firstGlyph == DELETED_GLYPH) return;
741
0
    const HBUINT8 *p = valueArrayZ.arrayZ;
742
0
    for (unsigned i = 0; i < glyphCount; i++)
743
0
    {
744
0
      unsigned int v = 0;
745
0
      unsigned int count = valueSize;
746
0
      for (unsigned int j = 0; j < count; j++)
747
0
  v = (v << 8) | *p++;
748
0
      if (filter (v))
749
0
  glyphs.add (firstGlyph + i);
750
0
    }
751
0
  }
752
753
  bool sanitize (hb_sanitize_context_t *c) const
754
0
  {
755
0
    TRACE_SANITIZE (this);
756
0
    return_trace (c->check_struct (this) &&
757
0
      hb_barrier () &&
758
0
      1 <= valueSize && valueSize <= 4 &&
759
0
      valueArrayZ.sanitize (c, glyphCount * valueSize));
760
0
  }
Unexecuted instantiation: AAT::LookupFormat10<OT::NumType<true, unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat10<OT::NumType<true, unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat10<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
761
762
  protected:
763
  HBUINT16  format;   /* Format identifier--format = 8 */
764
  HBUINT16  valueSize;  /* Byte size of each value. */
765
  HBGlyphID16 firstGlyph; /* First glyph index included in the trimmed array. */
766
  HBUINT16  glyphCount; /* Total number of glyphs (equivalent to the last
767
         * glyph minus the value of firstGlyph plus 1). */
768
  UnsizedArrayOf<HBUINT8>
769
    valueArrayZ;  /* The lookup values (indexed by the glyph index
770
         * minus the value of firstGlyph). */
771
  public:
772
  DEFINE_SIZE_ARRAY (8, valueArrayZ);
773
};
774
775
template <typename T>
776
struct Lookup
777
{
778
  const T* get_value (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
779
0
  {
780
0
    switch (u.format.v) {
781
0
    case 0: hb_barrier (); return u.format0.get_value (glyph_id, num_glyphs);
782
0
    case 2: hb_barrier (); return u.format2.get_value (glyph_id);
783
0
    case 4: hb_barrier (); return u.format4.get_value (glyph_id);
784
0
    case 6: hb_barrier (); return u.format6.get_value (glyph_id);
785
0
    case 8: hb_barrier (); return u.format8.get_value (glyph_id);
786
0
    default:return nullptr;
787
0
    }
788
0
  }
Unexecuted instantiation: AAT::Lookup<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::get_value(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::Lookup<OT::NumType<true, unsigned short, 2u> >::get_value(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::Lookup<OT::HBGlyphID16>::get_value(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::Lookup<OT::NumType<true, unsigned int, 4u> >::get_value(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::Lookup<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::get_value(unsigned int, unsigned int) const
789
790
  const typename T::type get_value_or_null (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
791
0
  {
792
0
    switch (u.format.v) {
793
      /* Format 10 cannot return a pointer. */
794
0
      case 10: hb_barrier (); return u.format10.get_value_or_null (glyph_id);
795
0
      default:
796
0
      const T *v = get_value (glyph_id, num_glyphs);
797
0
      return v ? *v : Null (T);
798
0
    }
799
0
  }
Unexecuted instantiation: AAT::Lookup<OT::NumType<true, unsigned int, 4u> >::get_value_or_null(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::Lookup<OT::NumType<true, unsigned short, 2u> >::get_value_or_null(unsigned int, unsigned int) const
800
801
  template <typename set_t>
802
  void collect_glyphs (set_t &glyphs, unsigned int num_glyphs) const
803
0
  {
804
0
    switch (u.format.v) {
805
0
    case 0: hb_barrier (); u.format0.collect_glyphs (glyphs, num_glyphs); return;
806
0
    case 2: hb_barrier (); u.format2.collect_glyphs (glyphs); return;
807
0
    case 4: hb_barrier (); u.format4.collect_glyphs (glyphs); return;
808
0
    case 6: hb_barrier (); u.format6.collect_glyphs (glyphs); return;
809
0
    case 8: hb_barrier (); u.format8.collect_glyphs (glyphs); return;
810
0
    case 10: hb_barrier (); u.format10.collect_glyphs (glyphs); return;
811
0
    default:return;
812
0
    }
813
0
  }
Unexecuted instantiation: void AAT::Lookup<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&, unsigned int) const
Unexecuted instantiation: void AAT::Lookup<OT::NumType<true, unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&, unsigned int) const
Unexecuted instantiation: void AAT::Lookup<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&, unsigned int) const
814
  template <typename set_t, typename filter_t>
815
  void collect_glyphs_filtered (set_t &glyphs, unsigned num_glyphs, const filter_t &filter) const
816
0
  {
817
0
    switch (u.format.v) {
818
0
    case 0: hb_barrier (); u.format0.collect_glyphs_filtered (glyphs, num_glyphs, filter); return;
819
0
    case 2: hb_barrier (); u.format2.collect_glyphs_filtered (glyphs, filter); return;
820
0
    case 4: hb_barrier (); u.format4.collect_glyphs_filtered (glyphs, filter); return;
821
0
    case 6: hb_barrier (); u.format6.collect_glyphs_filtered (glyphs, filter); return;
822
0
    case 8: hb_barrier (); u.format8.collect_glyphs_filtered (glyphs, filter); return;
823
0
    case 10: hb_barrier (); u.format10.collect_glyphs_filtered (glyphs, filter); return;
824
0
    default:return;
825
0
    }
826
0
  }
827
828
  typename T::type get_class (hb_codepoint_t glyph_id,
829
            unsigned int num_glyphs,
830
            unsigned int outOfRange) const
831
0
  {
832
0
    const T *v = get_value (glyph_id, num_glyphs);
833
0
    return v ? *v : outOfRange;
834
0
  }
835
836
  bool sanitize (hb_sanitize_context_t *c) const
837
0
  {
838
0
    TRACE_SANITIZE (this);
839
0
    if (!u.format.v.sanitize (c)) return_trace (false);
840
0
    hb_barrier ();
841
0
    switch (u.format.v) {
842
0
    case 0: hb_barrier (); return_trace (u.format0.sanitize (c));
843
0
    case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
844
0
    case 4: hb_barrier (); return_trace (u.format4.sanitize (c));
845
0
    case 6: hb_barrier (); return_trace (u.format6.sanitize (c));
846
0
    case 8: hb_barrier (); return_trace (u.format8.sanitize (c));
847
0
    case 10: hb_barrier (); return_trace (u.format10.sanitize (c));
848
0
    default:return_trace (true);
849
0
    }
850
0
  }
Unexecuted instantiation: AAT::Lookup<OT::NumType<true, unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::Lookup<OT::NumType<true, unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::Lookup<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
851
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
852
0
  {
853
0
    TRACE_SANITIZE (this);
854
0
    if (!u.format.v.sanitize (c)) return_trace (false);
855
0
    hb_barrier ();
856
0
    switch (u.format.v) {
857
0
    case 0: hb_barrier (); return_trace (u.format0.sanitize (c, base));
858
0
    case 2: hb_barrier (); return_trace (u.format2.sanitize (c, base));
859
0
    case 4: hb_barrier (); return_trace (u.format4.sanitize (c, base));
860
0
    case 6: hb_barrier (); return_trace (u.format6.sanitize (c, base));
861
0
    case 8: hb_barrier (); return_trace (u.format8.sanitize (c, base));
862
0
    case 10: return_trace (false); /* We don't support format10 here currently. */
863
0
    default:return_trace (true);
864
0
    }
865
0
  }
Unexecuted instantiation: AAT::Lookup<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::Lookup<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::NumType<true, unsigned int, 4u> >, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::Lookup<OT::OffsetTo<AAT::OpticalBounds, OT::NumType<true, unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
866
867
  protected:
868
  union {
869
  struct { HBUINT16 v; }  format;   /* Format identifier */
870
  LookupFormat0<T>  format0;
871
  LookupFormat2<T>  format2;
872
  LookupFormat4<T>  format4;
873
  LookupFormat6<T>  format6;
874
  LookupFormat8<T>  format8;
875
  LookupFormat10<T> format10;
876
  } u;
877
  public:
878
  DEFINE_SIZE_UNION (2, format.v);
879
};
880
DECLARE_NULL_NAMESPACE_BYTES_TEMPLATE1 (AAT, Lookup, 13);
881
882
/*
883
 * (Extended) State Table
884
 */
885
886
template <typename T>
887
struct Entry
888
{
889
  // This doesn't seem like it's ever called.
890
  bool sanitize (hb_sanitize_context_t *c) const
891
  {
892
    TRACE_SANITIZE (this);
893
    /* Note, we don't recurse-sanitize data because we don't access it.
894
     * That said, in our DEFINE_SIZE_STATIC we access T::static_size,
895
     * which ensures that data has a simple sanitize(). To be determined
896
     * if I need to remove that as well.
897
     *
898
     * HOWEVER! Because we are a template, our DEFINE_SIZE_STATIC
899
     * assertion wouldn't be checked, hence the line below. */
900
    static_assert (T::static_size, "");
901
902
    return_trace (c->check_struct (this));
903
  }
904
905
  public:
906
  HBUINT16  newState; /* Byte offset from beginning of state table
907
         * to the new state. Really?!?! Or just state
908
         * number?  The latter in morx for sure. */
909
  HBUINT16  flags;    /* Table specific. */
910
  T   data;   /* Optional offsets to per-glyph tables. */
911
  public:
912
  DEFINE_SIZE_STATIC (4 + T::static_size);
913
};
914
915
template <>
916
struct Entry<void>
917
{
918
  // This does seem like it's ever called.
919
  bool sanitize (hb_sanitize_context_t *c) const
920
0
  {
921
0
    TRACE_SANITIZE (this);
922
0
    return_trace (c->check_struct (this));
923
0
  }
924
925
  public:
926
  HBUINT16  newState; /* Byte offset from beginning of state table to the new state. */
927
  HBUINT16  flags;    /* Table specific. */
928
  public:
929
  DEFINE_SIZE_STATIC (4);
930
};
931
932
enum Class
933
{
934
  CLASS_END_OF_TEXT = 0,
935
  CLASS_OUT_OF_BOUNDS = 1,
936
  CLASS_DELETED_GLYPH = 2,
937
  CLASS_END_OF_LINE = 3,
938
};
939
940
template <typename Types, typename Extra>
941
struct StateTable
942
{
943
  typedef typename Types::HBUINT HBUINT;
944
  typedef typename Types::HBUSHORT HBUSHORT;
945
  typedef typename Types::ClassTypeNarrow ClassType;
946
947
  enum State
948
  {
949
    STATE_START_OF_TEXT = 0,
950
    STATE_START_OF_LINE = 1,
951
  };
952
953
  template <typename set_t, typename table_t>
954
  void collect_initial_glyphs (set_t &glyphs, unsigned num_glyphs, const table_t &table) const
955
0
  {
956
0
    unsigned num_classes = nClasses;
957
958
0
    if (unlikely (num_classes > hb_bit_page_t::BITS))
959
0
    {
960
0
      (this+classTable).collect_glyphs (glyphs, num_glyphs);
961
0
      return;
962
0
    }
963
964
    // Collect all classes going out from the start state.
965
0
    hb_bit_page_t filter;
966
967
0
    for (unsigned i = 0; i < num_classes; i++)
968
0
    {
969
0
      const auto &entry = get_entry (STATE_START_OF_TEXT, i);
970
0
      if (new_state (entry.newState) == STATE_START_OF_TEXT &&
971
0
    !table.is_action_initiable (entry) && !table.is_actionable (entry))
972
0
  continue;
973
974
0
      filter.add (i);
975
0
    }
976
977
    // And glyphs in those classes.
978
979
0
    if (filter (CLASS_DELETED_GLYPH))
980
0
      glyphs.add (DELETED_GLYPH);
981
982
0
    (this+classTable).collect_glyphs_filtered (glyphs, num_glyphs, filter);
983
0
  }
Unexecuted instantiation: void AAT::StateTable<AAT::ExtendedTypes, AAT::Format1Entry<true>::EntryData>::collect_initial_glyphs<hb_bit_set_t, AAT::KerxSubTableFormat1<AAT::KerxSubTableHeader> >(hb_bit_set_t&, unsigned int, AAT::KerxSubTableFormat1<AAT::KerxSubTableHeader> const&) const
Unexecuted instantiation: void AAT::StateTable<AAT::ExtendedTypes, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::EntryData>::collect_initial_glyphs<hb_bit_set_t, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader> >(hb_bit_set_t&, unsigned int, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader> const&) const
Unexecuted instantiation: void AAT::StateTable<AAT::ObsoleteTypes, void>::collect_initial_glyphs<hb_bit_set_t, AAT::KerxSubTableFormat1<OT::KernOTSubTableHeader> >(hb_bit_set_t&, unsigned int, AAT::KerxSubTableFormat1<OT::KernOTSubTableHeader> const&) const
Unexecuted instantiation: void AAT::StateTable<AAT::ObsoleteTypes, void>::collect_initial_glyphs<hb_bit_set_t, AAT::KerxSubTableFormat1<OT::KernAATSubTableHeader> >(hb_bit_set_t&, unsigned int, AAT::KerxSubTableFormat1<OT::KernAATSubTableHeader> const&) const
Unexecuted instantiation: void AAT::StateTable<AAT::ExtendedTypes, void>::collect_initial_glyphs<hb_bit_set_t, AAT::RearrangementSubtable<AAT::ExtendedTypes> >(hb_bit_set_t&, unsigned int, AAT::RearrangementSubtable<AAT::ExtendedTypes> const&) const
Unexecuted instantiation: void AAT::StateTable<AAT::ExtendedTypes, AAT::ContextualSubtable<AAT::ExtendedTypes>::EntryData>::collect_initial_glyphs<hb_bit_set_t, AAT::ContextualSubtable<AAT::ExtendedTypes> >(hb_bit_set_t&, unsigned int, AAT::ContextualSubtable<AAT::ExtendedTypes> const&) const
Unexecuted instantiation: void AAT::StateTable<AAT::ExtendedTypes, AAT::LigatureEntry<true>::EntryData>::collect_initial_glyphs<hb_bit_set_t, AAT::LigatureSubtable<AAT::ExtendedTypes> >(hb_bit_set_t&, unsigned int, AAT::LigatureSubtable<AAT::ExtendedTypes> const&) const
Unexecuted instantiation: void AAT::StateTable<AAT::ExtendedTypes, AAT::InsertionSubtable<AAT::ExtendedTypes>::EntryData>::collect_initial_glyphs<hb_bit_set_t, AAT::InsertionSubtable<AAT::ExtendedTypes> >(hb_bit_set_t&, unsigned int, AAT::InsertionSubtable<AAT::ExtendedTypes> const&) const
Unexecuted instantiation: void AAT::StateTable<AAT::ObsoleteTypes, void>::collect_initial_glyphs<hb_bit_set_t, AAT::RearrangementSubtable<AAT::ObsoleteTypes> >(hb_bit_set_t&, unsigned int, AAT::RearrangementSubtable<AAT::ObsoleteTypes> const&) const
Unexecuted instantiation: void AAT::StateTable<AAT::ObsoleteTypes, AAT::ContextualSubtable<AAT::ObsoleteTypes>::EntryData>::collect_initial_glyphs<hb_bit_set_t, AAT::ContextualSubtable<AAT::ObsoleteTypes> >(hb_bit_set_t&, unsigned int, AAT::ContextualSubtable<AAT::ObsoleteTypes> const&) const
Unexecuted instantiation: void AAT::StateTable<AAT::ObsoleteTypes, void>::collect_initial_glyphs<hb_bit_set_t, AAT::LigatureSubtable<AAT::ObsoleteTypes> >(hb_bit_set_t&, unsigned int, AAT::LigatureSubtable<AAT::ObsoleteTypes> const&) const
Unexecuted instantiation: void AAT::StateTable<AAT::ObsoleteTypes, AAT::InsertionSubtable<AAT::ObsoleteTypes>::EntryData>::collect_initial_glyphs<hb_bit_set_t, AAT::InsertionSubtable<AAT::ObsoleteTypes> >(hb_bit_set_t&, unsigned int, AAT::InsertionSubtable<AAT::ObsoleteTypes> const&) const
984
985
  /* Collect the "completer" glyphs: glyphs whose class makes an *actionable*
986
   * transition from some reachable state.  Any action is triggered by the
987
   * current glyph via get_entry(state, class), so if the buffer contains none
988
   * of these, the machine can produce no action and the subtable is skippable.
989
   *
990
   * Returns true (second_set is a sufficient skip gate) only if that invariant
991
   * holds.  Returns false when an action can fire without a real completer glyph
992
   * in the buffer: on CLASS_END_OF_TEXT (end of buffer), CLASS_OUT_OF_BOUNDS
993
   * (unenumerable), on non-extended machines (mort: negative states), or OOM. */
994
  template <typename set_t, typename table_t>
995
  bool collect_second_glyphs (set_t &glyphs, unsigned num_glyphs, const table_t &table) const
996
0
  {
997
0
    if (!Types::extended)
998
0
      return false;
999
1000
0
    unsigned num_classes = nClasses;
1001
0
    if (unlikely (num_classes > hb_bit_page_t::BITS))
1002
0
      return false;
1003
1004
0
    hb_bit_page_t filter;
1005
0
    hb_set_t visited;
1006
0
    hb_vector_t<unsigned> queue;
1007
0
    visited.add (STATE_START_OF_TEXT);
1008
0
    queue.push (STATE_START_OF_TEXT);
1009
0
    if (unlikely (visited.in_error () || queue.in_error ()))
1010
0
      return false;
1011
1012
0
    while (queue.length)
1013
0
    {
1014
0
      unsigned s = queue.pop ();
1015
0
      for (unsigned k = 0; k < num_classes; k++)
1016
0
      {
1017
0
  const auto &entry = get_entry ((int) s, k);
1018
0
  if (table.is_actionable (entry))
1019
0
  {
1020
0
    if (k == CLASS_END_OF_TEXT || k == CLASS_OUT_OF_BOUNDS)
1021
0
      return false;
1022
0
    filter.add (k);
1023
0
  }
1024
0
  int ns = new_state (entry.newState);
1025
0
  if (ns >= 0 && !visited.has ((unsigned) ns))
1026
0
  {
1027
0
    visited.add ((unsigned) ns);
1028
0
    queue.push ((unsigned) ns);
1029
0
    if (unlikely (visited.in_error () || queue.in_error ()))
1030
0
      return false;
1031
0
  }
1032
0
      }
1033
0
    }
1034
1035
0
    if (filter (CLASS_DELETED_GLYPH))
1036
0
      glyphs.add (DELETED_GLYPH);
1037
0
    (this+classTable).collect_glyphs_filtered (glyphs, num_glyphs, filter);
1038
0
    return true;
1039
0
  }
Unexecuted instantiation: bool AAT::StateTable<AAT::ExtendedTypes, AAT::Format1Entry<true>::EntryData>::collect_second_glyphs<hb_bit_set_t, AAT::KerxSubTableFormat1<AAT::KerxSubTableHeader> >(hb_bit_set_t&, unsigned int, AAT::KerxSubTableFormat1<AAT::KerxSubTableHeader> const&) const
Unexecuted instantiation: bool AAT::StateTable<AAT::ExtendedTypes, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::EntryData>::collect_second_glyphs<hb_bit_set_t, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader> >(hb_bit_set_t&, unsigned int, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader> const&) const
Unexecuted instantiation: bool AAT::StateTable<AAT::ObsoleteTypes, void>::collect_second_glyphs<hb_bit_set_t, AAT::KerxSubTableFormat1<OT::KernOTSubTableHeader> >(hb_bit_set_t&, unsigned int, AAT::KerxSubTableFormat1<OT::KernOTSubTableHeader> const&) const
Unexecuted instantiation: bool AAT::StateTable<AAT::ObsoleteTypes, void>::collect_second_glyphs<hb_bit_set_t, AAT::KerxSubTableFormat1<OT::KernAATSubTableHeader> >(hb_bit_set_t&, unsigned int, AAT::KerxSubTableFormat1<OT::KernAATSubTableHeader> const&) const
Unexecuted instantiation: bool AAT::StateTable<AAT::ExtendedTypes, void>::collect_second_glyphs<hb_bit_set_t, AAT::RearrangementSubtable<AAT::ExtendedTypes> >(hb_bit_set_t&, unsigned int, AAT::RearrangementSubtable<AAT::ExtendedTypes> const&) const
Unexecuted instantiation: bool AAT::StateTable<AAT::ExtendedTypes, AAT::ContextualSubtable<AAT::ExtendedTypes>::EntryData>::collect_second_glyphs<hb_bit_set_t, AAT::ContextualSubtable<AAT::ExtendedTypes> >(hb_bit_set_t&, unsigned int, AAT::ContextualSubtable<AAT::ExtendedTypes> const&) const
Unexecuted instantiation: bool AAT::StateTable<AAT::ExtendedTypes, AAT::LigatureEntry<true>::EntryData>::collect_second_glyphs<hb_bit_set_t, AAT::LigatureSubtable<AAT::ExtendedTypes> >(hb_bit_set_t&, unsigned int, AAT::LigatureSubtable<AAT::ExtendedTypes> const&) const
Unexecuted instantiation: bool AAT::StateTable<AAT::ExtendedTypes, AAT::InsertionSubtable<AAT::ExtendedTypes>::EntryData>::collect_second_glyphs<hb_bit_set_t, AAT::InsertionSubtable<AAT::ExtendedTypes> >(hb_bit_set_t&, unsigned int, AAT::InsertionSubtable<AAT::ExtendedTypes> const&) const
Unexecuted instantiation: bool AAT::StateTable<AAT::ObsoleteTypes, void>::collect_second_glyphs<hb_bit_set_t, AAT::RearrangementSubtable<AAT::ObsoleteTypes> >(hb_bit_set_t&, unsigned int, AAT::RearrangementSubtable<AAT::ObsoleteTypes> const&) const
Unexecuted instantiation: bool AAT::StateTable<AAT::ObsoleteTypes, AAT::ContextualSubtable<AAT::ObsoleteTypes>::EntryData>::collect_second_glyphs<hb_bit_set_t, AAT::ContextualSubtable<AAT::ObsoleteTypes> >(hb_bit_set_t&, unsigned int, AAT::ContextualSubtable<AAT::ObsoleteTypes> const&) const
Unexecuted instantiation: bool AAT::StateTable<AAT::ObsoleteTypes, void>::collect_second_glyphs<hb_bit_set_t, AAT::LigatureSubtable<AAT::ObsoleteTypes> >(hb_bit_set_t&, unsigned int, AAT::LigatureSubtable<AAT::ObsoleteTypes> const&) const
Unexecuted instantiation: bool AAT::StateTable<AAT::ObsoleteTypes, AAT::InsertionSubtable<AAT::ObsoleteTypes>::EntryData>::collect_second_glyphs<hb_bit_set_t, AAT::InsertionSubtable<AAT::ObsoleteTypes> >(hb_bit_set_t&, unsigned int, AAT::InsertionSubtable<AAT::ObsoleteTypes> const&) const
1040
1041
  int new_state (unsigned int newState) const
1042
0
  { return Types::extended ? newState : ((int) newState - (int) stateArrayTable) / (int) nClasses; }
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::Format1Entry<true>::EntryData>::new_state(unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::EntryData>::new_state(unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, void>::new_state(unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, void>::new_state(unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::ContextualSubtable<AAT::ExtendedTypes>::EntryData>::new_state(unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::LigatureEntry<true>::EntryData>::new_state(unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::InsertionSubtable<AAT::ExtendedTypes>::EntryData>::new_state(unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, AAT::ContextualSubtable<AAT::ObsoleteTypes>::EntryData>::new_state(unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, AAT::InsertionSubtable<AAT::ObsoleteTypes>::EntryData>::new_state(unsigned int) const
1043
1044
  unsigned int get_class (hb_codepoint_t glyph_id,
1045
        unsigned int num_glyphs,
1046
        hb_aat_class_cache_t *cache = nullptr) const
1047
0
  {
1048
0
    unsigned klass;
1049
0
    if (cache && cache->get (glyph_id, &klass)) return klass;
1050
0
    if (unlikely (glyph_id == DELETED_GLYPH)) return CLASS_DELETED_GLYPH;
1051
0
    klass = (this+classTable).get_class (glyph_id, num_glyphs, CLASS_OUT_OF_BOUNDS);
1052
0
    if (cache) cache->set (glyph_id, klass);
1053
0
    return klass;
1054
0
  }
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, void>::get_class(unsigned int, unsigned int, hb_cache_t<16u, 8u, 8u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, void>::get_class(unsigned int, unsigned int, hb_cache_t<16u, 8u, 8u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::ContextualSubtable<AAT::ExtendedTypes>::EntryData>::get_class(unsigned int, unsigned int, hb_cache_t<16u, 8u, 8u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::LigatureEntry<true>::EntryData>::get_class(unsigned int, unsigned int, hb_cache_t<16u, 8u, 8u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::InsertionSubtable<AAT::ExtendedTypes>::EntryData>::get_class(unsigned int, unsigned int, hb_cache_t<16u, 8u, 8u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, AAT::ContextualSubtable<AAT::ObsoleteTypes>::EntryData>::get_class(unsigned int, unsigned int, hb_cache_t<16u, 8u, 8u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, AAT::InsertionSubtable<AAT::ObsoleteTypes>::EntryData>::get_class(unsigned int, unsigned int, hb_cache_t<16u, 8u, 8u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::Format1Entry<true>::EntryData>::get_class(unsigned int, unsigned int, hb_cache_t<16u, 8u, 8u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::EntryData>::get_class(unsigned int, unsigned int, hb_cache_t<16u, 8u, 8u, true>*) const
1055
1056
  const Entry<Extra> *get_entries () const
1057
0
  { return (this+entryTable).arrayZ; }
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::ContextualSubtable<AAT::ExtendedTypes>::EntryData>::get_entries() const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, AAT::ContextualSubtable<AAT::ObsoleteTypes>::EntryData>::get_entries() const
1058
1059
  const Entry<Extra> &get_entry (int state, unsigned int klass) const
1060
0
  {
1061
0
    unsigned n_classes = nClasses;
1062
0
    if (unlikely (klass >= n_classes))
1063
0
      klass = CLASS_OUT_OF_BOUNDS;
1064
1065
0
    const HBUSHORT *states = (this+stateArrayTable).arrayZ;
1066
0
    const Entry<Extra> *entries = (this+entryTable).arrayZ;
1067
1068
    /* State can be negative; see sanitize().  Keep the index signed. */
1069
0
    unsigned int entry = states[state * (int) n_classes + (int) klass];
1070
0
    DEBUG_MSG (APPLY, nullptr, "e%u", entry);
1071
1072
0
    return entries[entry];
1073
0
  }
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::Format1Entry<true>::EntryData>::get_entry(int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::EntryData>::get_entry(int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, void>::get_entry(int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, void>::get_entry(int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::ContextualSubtable<AAT::ExtendedTypes>::EntryData>::get_entry(int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::LigatureEntry<true>::EntryData>::get_entry(int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::InsertionSubtable<AAT::ExtendedTypes>::EntryData>::get_entry(int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, AAT::ContextualSubtable<AAT::ObsoleteTypes>::EntryData>::get_entry(int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, AAT::InsertionSubtable<AAT::ObsoleteTypes>::EntryData>::get_entry(int, unsigned int) const
1074
1075
  bool sanitize (hb_sanitize_context_t *c,
1076
     unsigned int *num_entries_out = nullptr) const
1077
0
  {
1078
0
    TRACE_SANITIZE (this);
1079
0
    if (unlikely (!(c->check_struct (this) &&
1080
0
        hb_barrier () &&
1081
0
        nClasses >= 4 /* Ensure pre-defined classes fit.  */ &&
1082
0
        classTable.sanitize (c, this)))) return_trace (false);
1083
1084
0
    const HBUSHORT *states = (this+stateArrayTable).arrayZ;
1085
0
    const Entry<Extra> *entries = (this+entryTable).arrayZ;
1086
1087
0
    unsigned int num_classes = nClasses;
1088
0
    if (unlikely (hb_unsigned_mul_overflows (num_classes, states[0].static_size)))
1089
0
      return_trace (false);
1090
0
    unsigned int row_stride = num_classes * states[0].static_size;
1091
1092
    /* Apple 'kern' table has this peculiarity:
1093
     *
1094
     * "Because the stateTableOffset in the state table header is (strictly
1095
     * speaking) redundant, some 'kern' tables use it to record an initial
1096
     * state where that should not be StartOfText. To determine if this is
1097
     * done, calculate what the stateTableOffset should be. If it's different
1098
     * from the actual stateTableOffset, use it as the initial state."
1099
     *
1100
     * We implement this by calling the initial state zero, but allow *negative*
1101
     * states if the start state indeed was not the first state.  Since the code
1102
     * is shared, this will also apply to 'mort' table.  The 'kerx' / 'morx'
1103
     * tables are not affected since those address states by index, not offset.
1104
     */
1105
1106
0
    int min_state = 0;
1107
0
    int max_state = 0;
1108
0
    unsigned int num_entries = 0;
1109
1110
0
    int state_pos = 0;
1111
0
    int state_neg = 0;
1112
0
    unsigned int entry = 0;
1113
0
    while (min_state < state_neg || state_pos <= max_state)
1114
0
    {
1115
0
      if (min_state < state_neg)
1116
0
      {
1117
  /* Negative states. */
1118
0
  unsigned int num_neg_states = -min_state;
1119
0
  if (unlikely (hb_unsigned_mul_overflows (num_neg_states, num_classes)))
1120
0
    return_trace (false);
1121
0
  if (unlikely (!c->check_range (states - num_neg_states * num_classes,
1122
0
               num_neg_states,
1123
0
               row_stride)))
1124
0
    return_trace (false);
1125
0
  if ((c->max_ops -= state_neg - min_state) <= 0)
1126
0
    return_trace (false);
1127
0
  { /* Sweep new states. */
1128
0
    const HBUSHORT *stop = states - num_neg_states * num_classes;
1129
0
    if (unlikely (stop > states))
1130
0
      return_trace (false);
1131
0
    for (const HBUSHORT *p = states; stop < p; p--)
1132
0
      num_entries = hb_max (num_entries, *(p - 1) + 1u);
1133
0
    state_neg = min_state;
1134
0
  }
1135
0
      }
1136
1137
0
      if (state_pos <= max_state)
1138
0
      {
1139
  /* Positive states. */
1140
0
  if (unlikely (!c->check_range (states,
1141
0
               max_state + 1,
1142
0
               row_stride)))
1143
0
    return_trace (false);
1144
0
  if ((c->max_ops -= max_state - state_pos + 1) <= 0)
1145
0
    return_trace (false);
1146
0
  { /* Sweep new states. */
1147
0
    if (unlikely (hb_unsigned_mul_overflows ((max_state + 1), num_classes)))
1148
0
      return_trace (false);
1149
0
    const HBUSHORT *stop = &states[(max_state + 1) * num_classes];
1150
0
    if (unlikely (stop < states))
1151
0
      return_trace (false);
1152
0
    for (const HBUSHORT *p = &states[state_pos * num_classes]; p < stop; p++)
1153
0
      num_entries = hb_max (num_entries, *p + 1u);
1154
0
    state_pos = max_state + 1;
1155
0
  }
1156
0
      }
1157
1158
0
      if (unlikely (!c->check_array (entries, num_entries)))
1159
0
  return_trace (false);
1160
0
      if ((c->max_ops -= num_entries - entry) <= 0)
1161
0
  return_trace (false);
1162
0
      { /* Sweep new entries. */
1163
0
  const Entry<Extra> *stop = &entries[num_entries];
1164
0
  for (const Entry<Extra> *p = &entries[entry]; p < stop; p++)
1165
0
  {
1166
0
    int newState = new_state (p->newState);
1167
0
    min_state = hb_min (min_state, newState);
1168
0
    max_state = hb_max (max_state, newState);
1169
0
  }
1170
0
  entry = num_entries;
1171
0
      }
1172
0
    }
1173
1174
0
    if (num_entries_out)
1175
0
      *num_entries_out = num_entries;
1176
1177
0
    return_trace (true);
1178
0
  }
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::Format1Entry<true>::EntryData>::sanitize(hb_sanitize_context_t*, unsigned int*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::EntryData>::sanitize(hb_sanitize_context_t*, unsigned int*) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, void>::sanitize(hb_sanitize_context_t*, unsigned int*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, void>::sanitize(hb_sanitize_context_t*, unsigned int*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::ContextualSubtable<AAT::ExtendedTypes>::EntryData>::sanitize(hb_sanitize_context_t*, unsigned int*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::LigatureEntry<true>::EntryData>::sanitize(hb_sanitize_context_t*, unsigned int*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::InsertionSubtable<AAT::ExtendedTypes>::EntryData>::sanitize(hb_sanitize_context_t*, unsigned int*) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, AAT::ContextualSubtable<AAT::ObsoleteTypes>::EntryData>::sanitize(hb_sanitize_context_t*, unsigned int*) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, AAT::InsertionSubtable<AAT::ObsoleteTypes>::EntryData>::sanitize(hb_sanitize_context_t*, unsigned int*) const
1179
1180
  protected:
1181
  HBUINT  nClasses; /* Number of classes, which is the number of indices
1182
         * in a single line in the state array. */
1183
  NNOffsetTo<ClassType, HBUINT>
1184
    classTable; /* Offset to the class table. */
1185
  NNOffsetTo<UnsizedArrayOf<HBUSHORT>, HBUINT>
1186
    stateArrayTable;/* Offset to the state array. */
1187
  NNOffsetTo<UnsizedArrayOf<Entry<Extra>>, HBUINT>
1188
    entryTable; /* Offset to the entry array. */
1189
1190
  public:
1191
  DEFINE_SIZE_STATIC (4 * sizeof (HBUINT));
1192
};
1193
1194
template <typename HBUCHAR>
1195
struct ClassTable
1196
{
1197
  unsigned int get_class (hb_codepoint_t glyph_id, unsigned int outOfRange) const
1198
0
  {
1199
0
    unsigned int i = glyph_id - firstGlyph;
1200
0
    return i >= classArray.len ? outOfRange : classArray.arrayZ[i];
1201
0
  }
Unexecuted instantiation: AAT::ClassTable<OT::NumType<true, unsigned char, 1u> >::get_class(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::ClassTable<OT::NumType<true, unsigned short, 2u> >::get_class(unsigned int, unsigned int) const
1202
  unsigned int get_class (hb_codepoint_t glyph_id,
1203
        unsigned int num_glyphs HB_UNUSED,
1204
        unsigned int outOfRange) const
1205
0
  {
1206
0
    return get_class (glyph_id, outOfRange);
1207
0
  }
Unexecuted instantiation: AAT::ClassTable<OT::NumType<true, unsigned char, 1u> >::get_class(unsigned int, unsigned int, unsigned int) const
Unexecuted instantiation: AAT::ClassTable<OT::NumType<true, unsigned short, 2u> >::get_class(unsigned int, unsigned int, unsigned int) const
1208
1209
  template <typename set_t>
1210
  void collect_glyphs (set_t &glyphs, unsigned num_glyphs) const
1211
0
  {
1212
0
    for (unsigned i = 0; i < classArray.len; i++)
1213
0
      if (classArray.arrayZ[i] != CLASS_OUT_OF_BOUNDS)
1214
0
  glyphs.add (firstGlyph + i);
1215
0
  }
Unexecuted instantiation: void AAT::ClassTable<OT::NumType<true, unsigned char, 1u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&, unsigned int) const
Unexecuted instantiation: void AAT::ClassTable<OT::NumType<true, unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&, unsigned int) const
1216
  template <typename set_t, typename filter_t>
1217
  void collect_glyphs_filtered (set_t &glyphs, unsigned num_glyphs, const filter_t &filter) const
1218
0
  {
1219
0
    for (unsigned i = 0; i < classArray.len; i++)
1220
0
      if (filter (classArray.arrayZ[i]))
1221
0
  glyphs.add (firstGlyph + i);
1222
0
  }
1223
1224
  bool sanitize (hb_sanitize_context_t *c) const
1225
0
  {
1226
0
    TRACE_SANITIZE (this);
1227
0
    return_trace (c->check_struct (this) && classArray.sanitize (c));
1228
0
  }
Unexecuted instantiation: AAT::ClassTable<OT::NumType<true, unsigned char, 1u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::ClassTable<OT::NumType<true, unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
1229
  protected:
1230
  HBGlyphID16   firstGlyph; /* First glyph index included in the trimmed array. */
1231
  Array16Of<HBUCHAR>  classArray; /* The class codes (indexed by glyph index minus
1232
           * firstGlyph). */
1233
  public:
1234
  DEFINE_SIZE_ARRAY (4, classArray);
1235
};
1236
1237
struct SubtableGlyphCoverage
1238
{
1239
  bool sanitize (hb_sanitize_context_t *c, unsigned subtable_count) const
1240
0
  {
1241
0
    TRACE_SANITIZE (this);
1242
1243
0
    if (unlikely (!c->check_array (&subtableOffsets, subtable_count)))
1244
0
      return_trace (false);
1245
1246
0
    unsigned bytes = (c->get_num_glyphs () + CHAR_BIT - 1) / CHAR_BIT;
1247
0
    for (unsigned i = 0; i < subtable_count; i++)
1248
0
    {
1249
0
      uint32_t offset = (uint32_t) subtableOffsets[i];
1250
      // A font file called SFNSDisplay.ttf has value 0xFFFFFFFF in the offsets.
1251
      // Just ignore it.
1252
0
      if (offset == 0 || offset == 0xFFFFFFFF)
1253
0
        continue;
1254
0
      if (unlikely (!subtableOffsets[i].sanitize (c, this, bytes)))
1255
0
        return_trace (false);
1256
0
    }
1257
1258
0
    return_trace (true);
1259
0
  }
1260
  protected:
1261
  UnsizedArrayOf<NNOffset32To<UnsizedArrayOf<HBUINT8>>> subtableOffsets;
1262
              /* Array of offsets from the beginning of the
1263
               * subtable glyph coverage table to the glyph
1264
               * coverage bitfield for a given subtable; there
1265
               * is one offset for each subtable in the chain */
1266
  /* UnsizedArrayOf<HBUINT8> coverageBitfields; *//* The individual coverage bitfields. */
1267
  public:
1268
  DEFINE_SIZE_ARRAY (0, subtableOffsets);
1269
};
1270
1271
struct ObsoleteTypes
1272
{
1273
  static constexpr bool extended = false;
1274
  typedef HBUINT16 HBUINT;
1275
  typedef HBUINT8 HBUSHORT;
1276
  typedef ClassTable<HBUINT8> ClassTypeNarrow;
1277
  typedef ClassTable<HBUINT16> ClassTypeWide;
1278
1279
  template <typename T>
1280
  static int offsetToIndex (int64_t offset,
1281
          const void *base,
1282
          const T *array)
1283
0
  {
1284
0
    int64_t array_offset = (const char *) array - (const char *) base;
1285
0
    int bad_index = INT_MAX / T::static_size;
1286
1287
    /* https://github.com/harfbuzz/harfbuzz/issues/3483 */
1288
    /* If offset is less than base, return an offset that would
1289
     * result in an address half a 32bit address-space away,
1290
     * to make sure sanitize fails even on 32bit builds. */
1291
0
    if (unlikely (offset < array_offset))
1292
0
      return bad_index;
1293
1294
    /* https://github.com/harfbuzz/harfbuzz/issues/2816 */
1295
0
    int64_t index = (offset - array_offset) / T::static_size;
1296
0
    if (unlikely (index > bad_index))
1297
0
      return bad_index;
1298
0
    return index;
1299
0
  }
Unexecuted instantiation: int AAT::ObsoleteTypes::offsetToIndex<OT::NumType<true, short, 2u> >(long, void const*, OT::NumType<true, short, 2u> const*)
Unexecuted instantiation: int AAT::ObsoleteTypes::offsetToIndex<OT::HBGlyphID16>(long, void const*, OT::HBGlyphID16 const*)
Unexecuted instantiation: int AAT::ObsoleteTypes::offsetToIndex<OT::NumType<true, unsigned int, 4u> >(long, void const*, OT::NumType<true, unsigned int, 4u> const*)
Unexecuted instantiation: int AAT::ObsoleteTypes::offsetToIndex<OT::NumType<true, unsigned short, 2u> >(long, void const*, OT::NumType<true, unsigned short, 2u> const*)
1300
  template <typename T>
1301
  static int byteOffsetToIndex (int64_t offset,
1302
        const void *base,
1303
        const T *array)
1304
0
  {
1305
0
    return offsetToIndex (offset, base, array);
1306
0
  }
1307
  template <typename T>
1308
  static int wordOffsetToIndex (int64_t offset,
1309
        const void *base,
1310
        const T *array)
1311
0
  {
1312
0
    return offsetToIndex (2 * offset, base, array);
1313
0
  }
Unexecuted instantiation: int AAT::ObsoleteTypes::wordOffsetToIndex<OT::HBGlyphID16>(long, void const*, OT::HBGlyphID16 const*)
Unexecuted instantiation: int AAT::ObsoleteTypes::wordOffsetToIndex<OT::NumType<true, unsigned short, 2u> >(long, void const*, OT::NumType<true, unsigned short, 2u> const*)
1314
};
1315
struct ExtendedTypes
1316
{
1317
  static constexpr bool extended = true;
1318
  typedef HBUINT32 HBUINT;
1319
  typedef HBUINT16 HBUSHORT;
1320
  typedef Lookup<HBUINT16> ClassTypeNarrow;
1321
  typedef Lookup<HBUINT16> ClassTypeWide;
1322
1323
  template <typename T>
1324
  static unsigned int offsetToIndex (unsigned int offset,
1325
             const void *base HB_UNUSED,
1326
             const T *array HB_UNUSED)
1327
0
  {
1328
0
    return offset;
1329
0
  }
Unexecuted instantiation: unsigned int AAT::ExtendedTypes::offsetToIndex<OT::NumType<true, unsigned int, 4u> >(unsigned int, void const*, OT::NumType<true, unsigned int, 4u> const*)
Unexecuted instantiation: unsigned int AAT::ExtendedTypes::offsetToIndex<OT::HBGlyphID16>(unsigned int, void const*, OT::HBGlyphID16 const*)
Unexecuted instantiation: unsigned int AAT::ExtendedTypes::offsetToIndex<OT::NumType<true, short, 2u> >(unsigned int, void const*, OT::NumType<true, short, 2u> const*)
1330
  template <typename T>
1331
  static unsigned int byteOffsetToIndex (unsigned int offset,
1332
           const void *base HB_UNUSED,
1333
           const T *array HB_UNUSED)
1334
0
  {
1335
0
    return offset / 2;
1336
0
  }
1337
  template <typename T>
1338
  static unsigned int wordOffsetToIndex (unsigned int offset,
1339
           const void *base HB_UNUSED,
1340
           const T *array HB_UNUSED)
1341
0
  {
1342
0
    return offset;
1343
0
  }
Unexecuted instantiation: unsigned int AAT::ExtendedTypes::wordOffsetToIndex<OT::NumType<true, unsigned short, 2u> >(unsigned int, void const*, OT::NumType<true, unsigned short, 2u> const*)
Unexecuted instantiation: unsigned int AAT::ExtendedTypes::wordOffsetToIndex<OT::HBGlyphID16>(unsigned int, void const*, OT::HBGlyphID16 const*)
1344
};
1345
1346
template <typename Types, typename EntryData, typename Flags>
1347
struct StateTableDriver
1348
{
1349
  using StateTableT = StateTable<Types, EntryData>;
1350
  using EntryT = Entry<EntryData>;
1351
1352
  StateTableDriver (const StateTableT &machine_,
1353
        hb_face_t *face_) :
1354
0
        machine (machine_),
1355
0
        num_glyphs (face_->get_num_glyphs ()) {}
Unexecuted instantiation: AAT::StateTableDriver<AAT::ExtendedTypes, void, AAT::RearrangementSubtable<AAT::ExtendedTypes>::Flags>::StateTableDriver(AAT::StateTable<AAT::ExtendedTypes, void> const&, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ExtendedTypes, AAT::ContextualSubtable<AAT::ExtendedTypes>::EntryData, AAT::ContextualSubtable<AAT::ExtendedTypes>::Flags>::StateTableDriver(AAT::StateTable<AAT::ExtendedTypes, AAT::ContextualSubtable<AAT::ExtendedTypes>::EntryData> const&, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ExtendedTypes, AAT::LigatureEntry<true>::EntryData, AAT::LigatureSubtable<AAT::ExtendedTypes>::Flags>::StateTableDriver(AAT::StateTable<AAT::ExtendedTypes, AAT::LigatureEntry<true>::EntryData> const&, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ExtendedTypes, AAT::InsertionSubtable<AAT::ExtendedTypes>::EntryData, AAT::InsertionSubtable<AAT::ExtendedTypes>::Flags>::StateTableDriver(AAT::StateTable<AAT::ExtendedTypes, AAT::InsertionSubtable<AAT::ExtendedTypes>::EntryData> const&, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ObsoleteTypes, void, AAT::RearrangementSubtable<AAT::ObsoleteTypes>::Flags>::StateTableDriver(AAT::StateTable<AAT::ObsoleteTypes, void> const&, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ObsoleteTypes, AAT::ContextualSubtable<AAT::ObsoleteTypes>::EntryData, AAT::ContextualSubtable<AAT::ObsoleteTypes>::Flags>::StateTableDriver(AAT::StateTable<AAT::ObsoleteTypes, AAT::ContextualSubtable<AAT::ObsoleteTypes>::EntryData> const&, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ObsoleteTypes, void, AAT::LigatureSubtable<AAT::ObsoleteTypes>::Flags>::StateTableDriver(AAT::StateTable<AAT::ObsoleteTypes, void> const&, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ObsoleteTypes, AAT::InsertionSubtable<AAT::ObsoleteTypes>::EntryData, AAT::InsertionSubtable<AAT::ObsoleteTypes>::Flags>::StateTableDriver(AAT::StateTable<AAT::ObsoleteTypes, AAT::InsertionSubtable<AAT::ObsoleteTypes>::EntryData> const&, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ExtendedTypes, AAT::Format1Entry<true>::EntryData, AAT::KerxSubTableFormat1<AAT::KerxSubTableHeader>::Flags>::StateTableDriver(AAT::StateTable<AAT::ExtendedTypes, AAT::Format1Entry<true>::EntryData> const&, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ExtendedTypes, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::EntryData, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::Flags>::StateTableDriver(AAT::StateTable<AAT::ExtendedTypes, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::EntryData> const&, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ObsoleteTypes, void, AAT::KerxSubTableFormat1<OT::KernOTSubTableHeader>::Flags>::StateTableDriver(AAT::StateTable<AAT::ObsoleteTypes, void> const&, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ObsoleteTypes, void, AAT::KerxSubTableFormat1<OT::KernAATSubTableHeader>::Flags>::StateTableDriver(AAT::StateTable<AAT::ObsoleteTypes, void> const&, hb_face_t*)
1356
1357
  template <typename context_t>
1358
  void drive (context_t *c, hb_aat_apply_context_t *ac)
1359
0
  {
1360
0
    hb_buffer_t *buffer = ac->buffer;
1361
1362
0
    if (!c->in_place)
1363
0
      buffer->clear_output ();
1364
1365
0
    int state = StateTableT::STATE_START_OF_TEXT;
1366
    // If there's only one range, we already checked the flag.
1367
0
    auto *last_range = ac->range_flags && (ac->range_flags->length > 1) ? &(*ac->range_flags)[0] : nullptr;
1368
0
    const bool start_state_safe_to_break_eot =
1369
0
      !c->table->is_actionable (machine.get_entry (StateTableT::STATE_START_OF_TEXT, CLASS_END_OF_TEXT));
1370
0
    for (buffer->idx = 0; buffer->successful;)
1371
0
    {
1372
0
      unsigned int klass = likely (buffer->idx < buffer->len) ?
1373
0
         machine.get_class (buffer->cur().codepoint, num_glyphs, ac->machine_class_cache) :
1374
0
         (unsigned) CLASS_END_OF_TEXT;
1375
0
    resume:
1376
0
      DEBUG_MSG (APPLY, nullptr, "c%u at %u", klass, buffer->idx);
1377
0
      const EntryT &entry = machine.get_entry (state, klass);
1378
0
      const int next_state = machine.new_state (entry.newState);
1379
1380
0
      bool is_not_epsilon_transition = !(entry.flags & Flags::DontAdvance);
1381
0
      bool is_not_actionable = !c->table->is_actionable (entry);
1382
1383
0
      if (unlikely (last_range))
1384
0
      {
1385
  /* This block is copied in NoncontextualSubtable::apply. Keep in sync. */
1386
0
  auto *range = last_range;
1387
0
  if (buffer->idx < buffer->len)
1388
0
  {
1389
    /* Ranges are sorted and cover all clusters, but clusters need not
1390
     * be monotonic: try the neighboring range, then search. */
1391
0
    unsigned cluster = buffer->cur().cluster;
1392
0
    int dir = range->cmp (cluster);
1393
0
    if (dir && (range += dir)->cmp (cluster))
1394
0
      range = ac->range_flags->bsearch (cluster, last_range);
1395
1396
0
    last_range = range;
1397
0
  }
1398
0
  if (!(range->flags & ac->subtable_flags))
1399
0
  {
1400
0
    if (buffer->idx == buffer->len)
1401
0
      break;
1402
1403
0
    state = StateTableT::STATE_START_OF_TEXT;
1404
0
    (void) buffer->next_glyph ();
1405
0
    continue;
1406
0
  }
1407
0
      }
1408
0
      else
1409
0
      {
1410
  // Fast path for when transitioning from start-state to start-state with
1411
  // no action and advancing. Do so as long as the class remains the same.
1412
  // This is common with runs of non-actionable glyphs.
1413
1414
0
  bool is_null_transition = state == StateTableT::STATE_START_OF_TEXT &&
1415
0
          next_state == StateTableT::STATE_START_OF_TEXT &&
1416
0
          start_state_safe_to_break_eot &&
1417
0
          is_not_actionable &&
1418
0
          is_not_epsilon_transition;
1419
1420
0
  if (is_null_transition)
1421
0
  {
1422
0
    unsigned old_klass = klass;
1423
0
    do
1424
0
    {
1425
0
      c->transition (buffer, this, entry);
1426
1427
0
      if (buffer->idx == buffer->len || !buffer->successful)
1428
0
        break;
1429
1430
0
      (void) buffer->next_glyph ();
1431
1432
0
      klass = likely (buffer->idx < buffer->len) ?
1433
0
         machine.get_class (buffer->cur().codepoint, num_glyphs, ac->machine_class_cache) :
1434
0
         (unsigned) CLASS_END_OF_TEXT;
1435
0
    } while (klass == old_klass);
1436
1437
0
    if (buffer->idx == buffer->len || !buffer->successful)
1438
0
      break;
1439
1440
0
    goto resume;
1441
0
  }
1442
0
      }
1443
1444
      /* Conditions under which it's guaranteed safe-to-break before current glyph:
1445
       *
1446
       * 1. There was no action in this transition; and
1447
       *
1448
       * 2. If we break before current glyph, the results will be the same. That
1449
       *    is guaranteed if:
1450
       *
1451
       *    2a. We were already in start-of-text state; or
1452
       *
1453
       *    2b. We are epsilon-transitioning to start-of-text state; or
1454
       *
1455
       *    2c. Starting from start-of-text state seeing current glyph:
1456
       *
1457
       *        2c'. There won't be any actions; and
1458
       *
1459
       *        2c". We would end up in the same state that we were going to end up
1460
       *             in now, including whether epsilon-transitioning.
1461
       *
1462
       *    and
1463
       *
1464
       * 3. If we break before current glyph, there won't be any end-of-text action
1465
       *    after previous glyph.
1466
       *
1467
       * This triples the transitions we need to look up, but is worth returning
1468
       * granular unsafe-to-break results. See eg.:
1469
       *
1470
       *   https://github.com/harfbuzz/harfbuzz/issues/2860
1471
       */
1472
0
      const EntryT *wouldbe_entry;
1473
0
      bool is_safe_to_break =
1474
0
      (
1475
          /* 1. */
1476
0
          !c->table->is_actionable (entry) &&
1477
1478
          /* 2. */
1479
          // This one is meh, I know...
1480
0
    (
1481
0
                 state == StateTableT::STATE_START_OF_TEXT
1482
0
              || ((entry.flags & Flags::DontAdvance) && next_state == StateTableT::STATE_START_OF_TEXT)
1483
0
              || (
1484
        /* 2c. */
1485
0
        wouldbe_entry = &machine.get_entry(StateTableT::STATE_START_OF_TEXT, klass)
1486
0
        ,
1487
        /* 2c'. */
1488
0
        !c->table->is_actionable (*wouldbe_entry) &&
1489
        /* 2c". */
1490
0
        (
1491
0
          next_state == machine.new_state(wouldbe_entry->newState) &&
1492
0
          (entry.flags & Flags::DontAdvance) == (wouldbe_entry->flags & Flags::DontAdvance)
1493
0
        )
1494
0
     )
1495
0
    ) &&
1496
1497
          /* 3. */
1498
0
          !c->table->is_actionable (machine.get_entry (state, CLASS_END_OF_TEXT))
1499
0
      );
1500
1501
0
      if (!is_safe_to_break && buffer->backtrack_len () && buffer->idx < buffer->len)
1502
0
  buffer->unsafe_to_break_from_outbuffer (buffer->backtrack_len () - 1, buffer->idx + 1);
1503
1504
0
      c->transition (buffer, this, entry);
1505
1506
0
      state = next_state;
1507
0
      DEBUG_MSG (APPLY, nullptr, "s%d", state);
1508
1509
0
      if (buffer->idx == buffer->len)
1510
0
  break;
1511
1512
0
      if (is_not_epsilon_transition)
1513
0
  (void) buffer->next_glyph ();
1514
0
      else if (unlikely (buffer->max_ops-- <= 0))
1515
0
      {
1516
  /* The machine keeps not advancing, and the buffer's work budget is
1517
   * spent.  Fail the buffer, as the OpenType lookups do when the
1518
   * budget runs out: the caller can then tell that the text was not
1519
   * shaped in full, and no other subtable runs. */
1520
0
  buffer->successful = false;
1521
0
  break;
1522
0
      }
1523
0
    }
1524
1525
0
    if (!c->in_place)
1526
0
      buffer->sync ();
1527
0
  }
Unexecuted instantiation: void AAT::StateTableDriver<AAT::ObsoleteTypes, void, AAT::KerxSubTableFormat1<OT::KernOTSubTableHeader>::Flags>::drive<AAT::KerxSubTableFormat1<OT::KernOTSubTableHeader>::driver_context_t>(AAT::KerxSubTableFormat1<OT::KernOTSubTableHeader>::driver_context_t*, AAT::hb_aat_apply_context_t*)
Unexecuted instantiation: void AAT::StateTableDriver<AAT::ObsoleteTypes, void, AAT::KerxSubTableFormat1<OT::KernAATSubTableHeader>::Flags>::drive<AAT::KerxSubTableFormat1<OT::KernAATSubTableHeader>::driver_context_t>(AAT::KerxSubTableFormat1<OT::KernAATSubTableHeader>::driver_context_t*, AAT::hb_aat_apply_context_t*)
Unexecuted instantiation: void AAT::StateTableDriver<AAT::ExtendedTypes, void, AAT::RearrangementSubtable<AAT::ExtendedTypes>::Flags>::drive<AAT::RearrangementSubtable<AAT::ExtendedTypes>::driver_context_t>(AAT::RearrangementSubtable<AAT::ExtendedTypes>::driver_context_t*, AAT::hb_aat_apply_context_t*)
Unexecuted instantiation: void AAT::StateTableDriver<AAT::ExtendedTypes, AAT::ContextualSubtable<AAT::ExtendedTypes>::EntryData, AAT::ContextualSubtable<AAT::ExtendedTypes>::Flags>::drive<AAT::ContextualSubtable<AAT::ExtendedTypes>::driver_context_t>(AAT::ContextualSubtable<AAT::ExtendedTypes>::driver_context_t*, AAT::hb_aat_apply_context_t*)
Unexecuted instantiation: void AAT::StateTableDriver<AAT::ExtendedTypes, AAT::LigatureEntry<true>::EntryData, AAT::LigatureSubtable<AAT::ExtendedTypes>::Flags>::drive<AAT::LigatureSubtable<AAT::ExtendedTypes>::driver_context_t>(AAT::LigatureSubtable<AAT::ExtendedTypes>::driver_context_t*, AAT::hb_aat_apply_context_t*)
Unexecuted instantiation: void AAT::StateTableDriver<AAT::ExtendedTypes, AAT::InsertionSubtable<AAT::ExtendedTypes>::EntryData, AAT::InsertionSubtable<AAT::ExtendedTypes>::Flags>::drive<AAT::InsertionSubtable<AAT::ExtendedTypes>::driver_context_t>(AAT::InsertionSubtable<AAT::ExtendedTypes>::driver_context_t*, AAT::hb_aat_apply_context_t*)
Unexecuted instantiation: void AAT::StateTableDriver<AAT::ObsoleteTypes, void, AAT::RearrangementSubtable<AAT::ObsoleteTypes>::Flags>::drive<AAT::RearrangementSubtable<AAT::ObsoleteTypes>::driver_context_t>(AAT::RearrangementSubtable<AAT::ObsoleteTypes>::driver_context_t*, AAT::hb_aat_apply_context_t*)
Unexecuted instantiation: void AAT::StateTableDriver<AAT::ObsoleteTypes, AAT::ContextualSubtable<AAT::ObsoleteTypes>::EntryData, AAT::ContextualSubtable<AAT::ObsoleteTypes>::Flags>::drive<AAT::ContextualSubtable<AAT::ObsoleteTypes>::driver_context_t>(AAT::ContextualSubtable<AAT::ObsoleteTypes>::driver_context_t*, AAT::hb_aat_apply_context_t*)
Unexecuted instantiation: void AAT::StateTableDriver<AAT::ObsoleteTypes, void, AAT::LigatureSubtable<AAT::ObsoleteTypes>::Flags>::drive<AAT::LigatureSubtable<AAT::ObsoleteTypes>::driver_context_t>(AAT::LigatureSubtable<AAT::ObsoleteTypes>::driver_context_t*, AAT::hb_aat_apply_context_t*)
Unexecuted instantiation: void AAT::StateTableDriver<AAT::ObsoleteTypes, AAT::InsertionSubtable<AAT::ObsoleteTypes>::EntryData, AAT::InsertionSubtable<AAT::ObsoleteTypes>::Flags>::drive<AAT::InsertionSubtable<AAT::ObsoleteTypes>::driver_context_t>(AAT::InsertionSubtable<AAT::ObsoleteTypes>::driver_context_t*, AAT::hb_aat_apply_context_t*)
Unexecuted instantiation: void AAT::StateTableDriver<AAT::ExtendedTypes, AAT::Format1Entry<true>::EntryData, AAT::KerxSubTableFormat1<AAT::KerxSubTableHeader>::Flags>::drive<AAT::KerxSubTableFormat1<AAT::KerxSubTableHeader>::driver_context_t>(AAT::KerxSubTableFormat1<AAT::KerxSubTableHeader>::driver_context_t*, AAT::hb_aat_apply_context_t*)
Unexecuted instantiation: void AAT::StateTableDriver<AAT::ExtendedTypes, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::EntryData, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::Flags>::drive<AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::driver_context_t>(AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::driver_context_t*, AAT::hb_aat_apply_context_t*)
1528
1529
  public:
1530
  const StateTableT &machine;
1531
  unsigned int num_glyphs;
1532
};
1533
1534
1535
} /* namespace AAT */
1536
1537
1538
#endif /* HB_AAT_LAYOUT_COMMON_HH */