Coverage Report

Created: 2025-07-07 10:01

/work/workdir/UnpackedTarball/harfbuzz/src/hb-aat-layout-common.hh
Line
Count
Source (jump to first uncovered line)
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-bit-page.hh"
38
39
40
namespace OT {
41
struct GDEF;
42
};
43
44
namespace AAT {
45
46
using namespace OT;
47
48
struct ankr;
49
50
using hb_aat_class_cache_t = hb_cache_t<15, 8, 7>;
51
static_assert (sizeof (hb_aat_class_cache_t) == 256, "");
52
53
struct hb_aat_scratch_t
54
{
55
480
  hb_aat_scratch_t () = default;
56
  hb_aat_scratch_t (const hb_aat_scratch_t &) = delete;
57
58
  hb_aat_scratch_t (hb_aat_scratch_t &&o)
59
0
  {
60
0
    buffer_glyph_set.set_relaxed (o.buffer_glyph_set.get_relaxed ());
61
0
    o.buffer_glyph_set.set_relaxed (nullptr);
62
0
  }
63
  hb_aat_scratch_t & operator = (hb_aat_scratch_t &&o)
64
120
  {
65
120
    buffer_glyph_set.set_relaxed (o.buffer_glyph_set.get_relaxed ());
66
120
    o.buffer_glyph_set.set_relaxed (nullptr);
67
120
    return *this;
68
120
  }
69
  ~hb_aat_scratch_t ()
70
120
  {
71
120
    auto *s = buffer_glyph_set.get_relaxed ();
72
120
    if (unlikely (!s))
73
120
      return;
74
0
    s->fini ();
75
0
    hb_free (s);
76
0
  }
77
78
  hb_bit_set_t *create_buffer_glyph_set () const
79
23.7M
  {
80
23.7M
    hb_bit_set_t *s = buffer_glyph_set.get_acquire ();
81
23.7M
    if (s && buffer_glyph_set.cmpexch (s, nullptr))
82
23.7M
      return s;
83
84
60
    s = (hb_bit_set_t *) hb_calloc (1, sizeof (hb_bit_set_t));
85
60
    if (unlikely (!s))
86
0
      return nullptr;
87
60
    s->init ();
88
89
60
    return s;
90
60
  }
91
  void destroy_buffer_glyph_set (hb_bit_set_t *s) const
92
23.7M
  {
93
23.7M
    if (unlikely (!s))
94
0
      return;
95
23.7M
    if (buffer_glyph_set.cmpexch (nullptr, s))
96
23.7M
      return;
97
0
    s->fini ();
98
0
    hb_free (s);
99
0
  }
100
101
  mutable hb_atomic_t<hb_bit_set_t *> buffer_glyph_set;
102
};
103
104
enum { DELETED_GLYPH = 0xFFFF };
105
106
0
#define HB_BUFFER_SCRATCH_FLAG_AAT_HAS_DELETED HB_BUFFER_SCRATCH_FLAG_SHAPER0
107
108
struct hb_aat_apply_context_t :
109
       hb_dispatch_context_t<hb_aat_apply_context_t, bool, HB_DEBUG_APPLY>
110
{
111
0
  const char *get_name () { return "APPLY"; }
112
  template <typename T, typename ...Ts>
113
  return_t dispatch (const T &obj, Ts&&... ds)
114
26.2M
  { return obj.apply (this, std::forward<Ts> (ds)...); }
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&)
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
114
23.7M
  { 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
114
2.46M
  { 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&)
115
0
  static return_t default_return_value () { return false; }
116
0
  bool stop_sublookup_iteration (return_t r) const { return r; }
117
118
  const hb_ot_shape_plan_t *plan;
119
  hb_font_t *font;
120
  hb_face_t *face;
121
  hb_buffer_t *buffer;
122
  hb_sanitize_context_t sanitizer;
123
  const ankr *ankr_table;
124
  const OT::GDEF &gdef;
125
  bool has_glyph_classes;
126
  const hb_sorted_vector_t<hb_aat_map_t::range_flags_t> *range_flags = nullptr;
127
  bool using_buffer_glyph_set = false;
128
  hb_bit_set_t *buffer_glyph_set = nullptr;
129
  const hb_bit_set_t *left_set = nullptr;
130
  const hb_bit_set_t *right_set = nullptr;
131
  const hb_bit_set_t *machine_glyph_set = nullptr;
132
  hb_aat_class_cache_t *machine_class_cache = nullptr;
133
  hb_mask_t subtable_flags = 0;
134
135
  /* Unused. For debug tracing only. */
136
  unsigned int lookup_index;
137
138
  HB_INTERNAL hb_aat_apply_context_t (const hb_ot_shape_plan_t *plan_,
139
              hb_font_t *font_,
140
              hb_buffer_t *buffer_,
141
              hb_blob_t *blob = const_cast<hb_blob_t *> (&Null (hb_blob_t)));
142
143
  HB_INTERNAL ~hb_aat_apply_context_t ();
144
145
  HB_INTERNAL void set_ankr_table (const AAT::ankr *ankr_table_);
146
147
47.5M
  void set_lookup_index (unsigned int i) { lookup_index = i; }
148
149
  void setup_buffer_glyph_set ()
150
23.7M
  {
151
23.7M
    using_buffer_glyph_set = buffer->len >= 4 && buffer_glyph_set;
152
153
23.7M
    if (likely (using_buffer_glyph_set))
154
2.86M
      buffer->collect_codepoints (*buffer_glyph_set);
155
23.7M
  }
156
  bool buffer_intersects_machine () const
157
22.0M
  {
158
22.0M
    if (likely (using_buffer_glyph_set))
159
2.78M
      return buffer_glyph_set->intersects (*machine_glyph_set);
160
161
    // Faster for shorter buffers.
162
40.6M
    for (unsigned i = 0; i < buffer->len; i++)
163
22.7M
      if (machine_glyph_set->has (buffer->info[i].codepoint))
164
1.33M
  return true;
165
17.9M
    return false;
166
19.2M
  }
167
168
  template <typename T>
169
  HB_NODISCARD bool output_glyphs (unsigned int count,
170
           const T *glyphs)
171
0
  {
172
0
    if (likely (using_buffer_glyph_set))
173
0
      buffer_glyph_set->add_array (glyphs, count);
174
0
    for (unsigned int i = 0; i < count; i++)
175
0
    {
176
0
      if (glyphs[i] == DELETED_GLYPH)
177
0
      {
178
0
        buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_AAT_HAS_DELETED;
179
0
  _hb_glyph_info_set_aat_deleted (&buffer->cur());
180
0
      }
181
0
      else
182
0
      {
183
0
#ifndef HB_NO_OT_LAYOUT
184
0
  if (has_glyph_classes)
185
0
    _hb_glyph_info_set_glyph_props (&buffer->cur(),
186
0
            gdef.get_glyph_props (glyphs[i]));
187
0
#endif
188
0
      }
189
0
      if (unlikely (!buffer->output_glyph (glyphs[i]))) return false;
190
0
    }
191
0
    return true;
192
0
  }
193
194
  HB_NODISCARD bool replace_glyph (hb_codepoint_t glyph)
195
0
  {
196
0
    if (glyph == DELETED_GLYPH)
197
0
    {
198
0
      buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_AAT_HAS_DELETED;
199
0
      _hb_glyph_info_set_aat_deleted (&buffer->cur());
200
0
    }
201
202
0
    if (likely (using_buffer_glyph_set))
203
0
      buffer_glyph_set->add (glyph);
204
0
#ifndef HB_NO_OT_LAYOUT
205
0
    if (has_glyph_classes)
206
0
      _hb_glyph_info_set_glyph_props (&buffer->cur(),
207
0
              gdef.get_glyph_props (glyph));
208
0
#endif
209
0
    return buffer->replace_glyph (glyph);
210
0
  }
211
212
  HB_NODISCARD bool delete_glyph ()
213
0
  {
214
0
    buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_AAT_HAS_DELETED;
215
0
    _hb_glyph_info_set_aat_deleted (&buffer->cur());
216
0
    return buffer->replace_glyph (DELETED_GLYPH);
217
0
  }
218
219
  void replace_glyph_inplace (unsigned i, hb_codepoint_t glyph)
220
0
  {
221
0
    buffer->info[i].codepoint = glyph;
222
0
    if (likely (using_buffer_glyph_set))
223
0
      buffer_glyph_set->add (glyph);
224
0
#ifndef HB_NO_OT_LAYOUT
225
0
    if (has_glyph_classes)
226
0
      _hb_glyph_info_set_glyph_props (&buffer->info[i],
227
0
              gdef.get_glyph_props (glyph));
228
0
#endif
229
0
  }
230
};
231
232
233
/*
234
 * Lookup Table
235
 */
236
237
template <typename T> struct Lookup;
238
239
template <typename T>
240
struct LookupFormat0
241
{
242
  friend struct Lookup<T>;
243
244
  private:
245
  const T* get_value (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
246
0
  {
247
0
    if (unlikely (glyph_id >= num_glyphs)) return nullptr;
248
0
    return &arrayZ[glyph_id];
249
0
  }
Unexecuted instantiation: AAT::LookupFormat0<OT::IntType<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::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::get_value(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::LookupFormat0<OT::IntType<unsigned int, 4u> >::get_value(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::LookupFormat0<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::get_value(unsigned int, unsigned int) const
250
251
  template <typename set_t>
252
  void collect_glyphs (set_t &glyphs, unsigned num_glyphs) const
253
0
  {
254
0
    glyphs.add_range (0, num_glyphs - 1);
255
0
  }
Unexecuted instantiation: void AAT::LookupFormat0<OT::IntType<unsigned short, 2u> >::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
Unexecuted instantiation: void AAT::LookupFormat0<OT::IntType<unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&, unsigned int) const
256
  template <typename set_t, typename filter_t>
257
  void collect_glyphs_filtered (set_t &glyphs, unsigned num_glyphs, const filter_t &filter) const
258
0
  {
259
0
    for (unsigned i = 0; i < num_glyphs; i++)
260
0
      if (filter (arrayZ[i]))
261
0
  glyphs.add (i);
262
0
  }
263
264
  bool sanitize (hb_sanitize_context_t *c) const
265
0
  {
266
0
    TRACE_SANITIZE (this);
267
0
    return_trace (arrayZ.sanitize (c, c->get_num_glyphs ()));
268
0
  }
Unexecuted instantiation: AAT::LookupFormat0<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat0<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat0<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
269
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
270
0
  {
271
0
    TRACE_SANITIZE (this);
272
0
    return_trace (arrayZ.sanitize (c, c->get_num_glyphs (), base));
273
0
  }
Unexecuted instantiation: AAT::LookupFormat0<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat0<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat0<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
274
275
  protected:
276
  HBUINT16  format;   /* Format identifier--format = 0 */
277
  UnsizedArrayOf<T>
278
    arrayZ;   /* Array of lookup values, indexed by glyph index. */
279
  public:
280
  DEFINE_SIZE_UNBOUNDED (2);
281
};
282
283
284
template <typename T>
285
struct LookupSegmentSingle
286
{
287
  static constexpr unsigned TerminationWordCount = 2u;
288
289
  int cmp (hb_codepoint_t g) const
290
0
  { return g < first ? -1 : g <= last ? 0 : +1 ; }
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::IntType<unsigned short, 2u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::HBGlyphID16>::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::IntType<unsigned int, 4u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::cmp(unsigned int) const
291
292
  template <typename set_t>
293
  void collect_glyphs (set_t &glyphs) const
294
0
  {
295
0
    if (first == DELETED_GLYPH) return;
296
0
    glyphs.add_range (first, last);
297
0
  }
Unexecuted instantiation: void AAT::LookupSegmentSingle<OT::IntType<unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupSegmentSingle<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupSegmentSingle<OT::IntType<unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
298
  template <typename set_t, typename filter_t>
299
  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
300
0
  {
301
0
    if (first == DELETED_GLYPH) return;
302
0
    if (!filter (value)) return;
303
0
    glyphs.add_range (first, last);
304
0
  }
305
306
  bool sanitize (hb_sanitize_context_t *c) const
307
0
  {
308
0
    TRACE_SANITIZE (this);
309
0
    return_trace (c->check_struct (this) && value.sanitize (c));
310
0
  }
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
311
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
312
0
  {
313
0
    TRACE_SANITIZE (this);
314
0
    return_trace (c->check_struct (this) && value.sanitize (c, base));
315
0
  }
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
316
317
  HBGlyphID16 last;   /* Last GlyphID in this segment */
318
  HBGlyphID16 first;    /* First GlyphID in this segment */
319
  T   value;    /* The lookup value (only one) */
320
  public:
321
  DEFINE_SIZE_STATIC (4 + T::static_size);
322
};
323
324
template <typename T>
325
struct LookupFormat2
326
{
327
  friend struct Lookup<T>;
328
329
  private:
330
  const T* get_value (hb_codepoint_t glyph_id) const
331
0
  {
332
0
    const LookupSegmentSingle<T> *v = segments.bsearch (glyph_id);
333
0
    return v ? &v->value : nullptr;
334
0
  }
Unexecuted instantiation: AAT::LookupFormat2<OT::IntType<unsigned short, 2u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat2<OT::HBGlyphID16>::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat2<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat2<OT::IntType<unsigned int, 4u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat2<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::get_value(unsigned int) const
335
336
  template <typename set_t>
337
  void collect_glyphs (set_t &glyphs) const
338
0
  {
339
0
    unsigned count = segments.get_length ();
340
0
    for (unsigned int i = 0; i < count; i++)
341
0
      segments[i].collect_glyphs (glyphs);
342
0
  }
Unexecuted instantiation: void AAT::LookupFormat2<OT::IntType<unsigned short, 2u> >::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
Unexecuted instantiation: void AAT::LookupFormat2<OT::IntType<unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
343
  template <typename set_t, typename filter_t>
344
  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
345
0
  {
346
0
    unsigned count = segments.get_length ();
347
0
    for (unsigned int i = 0; i < count; i++)
348
0
      segments[i].collect_glyphs_filtered (glyphs, filter);
349
0
  }
350
351
  bool sanitize (hb_sanitize_context_t *c) const
352
0
  {
353
0
    TRACE_SANITIZE (this);
354
0
    return_trace (segments.sanitize (c));
355
0
  }
Unexecuted instantiation: AAT::LookupFormat2<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat2<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat2<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
356
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
357
0
  {
358
0
    TRACE_SANITIZE (this);
359
0
    return_trace (segments.sanitize (c, base));
360
0
  }
Unexecuted instantiation: AAT::LookupFormat2<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat2<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat2<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
361
362
  protected:
363
  HBUINT16  format;   /* Format identifier--format = 2 */
364
  VarSizedBinSearchArrayOf<LookupSegmentSingle<T>>
365
    segments; /* The actual segments. These must already be sorted,
366
         * according to the first word in each one (the last
367
         * glyph in each segment). */
368
  public:
369
  DEFINE_SIZE_ARRAY (8, segments);
370
};
371
372
template <typename T>
373
struct LookupSegmentArray
374
{
375
  static constexpr unsigned TerminationWordCount = 2u;
376
377
  const T* get_value (hb_codepoint_t glyph_id, const void *base) const
378
0
  {
379
0
    return first <= glyph_id && glyph_id <= last ? &(base+valuesZ)[glyph_id - first] : nullptr;
380
0
  }
Unexecuted instantiation: AAT::LookupSegmentArray<OT::IntType<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::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::get_value(unsigned int, void const*) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::IntType<unsigned int, 4u> >::get_value(unsigned int, void const*) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::get_value(unsigned int, void const*) const
381
382
  template <typename set_t>
383
  void collect_glyphs (set_t &glyphs) const
384
0
  {
385
0
    if (first == DELETED_GLYPH) return;
386
0
    glyphs.add_range (first, last);
387
0
  }
Unexecuted instantiation: void AAT::LookupSegmentArray<OT::IntType<unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupSegmentArray<OT::HBGlyphID16>::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
Unexecuted instantiation: void AAT::LookupSegmentArray<OT::IntType<unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
388
  template <typename set_t, typename filter_t>
389
  void collect_glyphs_filtered (set_t &glyphs, const void *base, const filter_t &filter) const
390
0
  {
391
0
    if (first == DELETED_GLYPH) return;
392
0
    const auto &values = base+valuesZ;
393
0
    for (hb_codepoint_t i = first; i <= last; i++)
394
0
      if (filter (values[i - first]))
395
0
  glyphs.add (i);
396
0
  }
397
398
  int cmp (hb_codepoint_t g) const
399
0
  { return g < first ? -1 : g <= last ? 0 : +1; }
Unexecuted instantiation: AAT::LookupSegmentArray<OT::IntType<unsigned short, 2u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::HBGlyphID16>::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::IntType<unsigned int, 4u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::cmp(unsigned int) const
400
401
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
402
0
  {
403
0
    TRACE_SANITIZE (this);
404
0
    return_trace (c->check_struct (this) &&
405
0
      hb_barrier () &&
406
0
      first <= last &&
407
0
      valuesZ.sanitize (c, base, last - first + 1));
408
0
  }
Unexecuted instantiation: AAT::LookupSegmentArray<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*, void const*) const
409
  template <typename ...Ts>
410
  bool sanitize (hb_sanitize_context_t *c, const void *base, Ts&&... ds) const
411
0
  {
412
0
    TRACE_SANITIZE (this);
413
0
    return_trace (c->check_struct (this) &&
414
0
      hb_barrier () &&
415
0
      first <= last &&
416
0
      valuesZ.sanitize (c, base, last - first + 1, std::forward<Ts> (ds)...));
417
0
  }
Unexecuted instantiation: bool AAT::LookupSegmentArray<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<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::IntType<unsigned int, 4u> >, OT::IntType<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::IntType<unsigned short, 2u>, void, true> >::sanitize<void const*&>(hb_sanitize_context_t*, void const*, void const*&) const
418
419
  HBGlyphID16 last;   /* Last GlyphID in this segment */
420
  HBGlyphID16 first;    /* First GlyphID in this segment */
421
  NNOffset16To<UnsizedArrayOf<T>>
422
    valuesZ;  /* A 16-bit offset from the start of
423
         * the table to the data. */
424
  public:
425
  DEFINE_SIZE_STATIC (6);
426
};
427
428
template <typename T>
429
struct LookupFormat4
430
{
431
  friend struct Lookup<T>;
432
433
  private:
434
  const T* get_value (hb_codepoint_t glyph_id) const
435
0
  {
436
0
    const LookupSegmentArray<T> *v = segments.bsearch (glyph_id);
437
0
    return v ? v->get_value (glyph_id, this) : nullptr;
438
0
  }
Unexecuted instantiation: AAT::LookupFormat4<OT::IntType<unsigned short, 2u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat4<OT::HBGlyphID16>::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat4<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat4<OT::IntType<unsigned int, 4u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat4<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::get_value(unsigned int) const
439
440
  template <typename set_t>
441
  void collect_glyphs (set_t &glyphs) const
442
0
  {
443
0
    unsigned count = segments.get_length ();
444
0
    for (unsigned i = 0; i < count; i++)
445
0
      segments[i].collect_glyphs (glyphs);
446
0
  }
Unexecuted instantiation: void AAT::LookupFormat4<OT::IntType<unsigned short, 2u> >::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
Unexecuted instantiation: void AAT::LookupFormat4<OT::IntType<unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
447
  template <typename set_t, typename filter_t>
448
  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
449
0
  {
450
0
    unsigned count = segments.get_length ();
451
0
    for (unsigned i = 0; i < count; i++)
452
0
      segments[i].collect_glyphs_filtered (glyphs, this, filter);
453
0
  }
454
455
  bool sanitize (hb_sanitize_context_t *c) const
456
0
  {
457
0
    TRACE_SANITIZE (this);
458
0
    return_trace (segments.sanitize (c, this));
459
0
  }
Unexecuted instantiation: AAT::LookupFormat4<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat4<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat4<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
460
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
461
0
  {
462
0
    TRACE_SANITIZE (this);
463
0
    return_trace (segments.sanitize (c, this, base));
464
0
  }
Unexecuted instantiation: AAT::LookupFormat4<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat4<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat4<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
465
466
  protected:
467
  HBUINT16  format;   /* Format identifier--format = 4 */
468
  VarSizedBinSearchArrayOf<LookupSegmentArray<T>>
469
    segments; /* The actual segments. These must already be sorted,
470
         * according to the first word in each one (the last
471
         * glyph in each segment). */
472
  public:
473
  DEFINE_SIZE_ARRAY (8, segments);
474
};
475
476
template <typename T>
477
struct LookupSingle
478
{
479
  static constexpr unsigned TerminationWordCount = 1u;
480
481
0
  int cmp (hb_codepoint_t g) const { return glyph.cmp (g); }
Unexecuted instantiation: AAT::LookupSingle<OT::IntType<unsigned short, 2u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSingle<OT::HBGlyphID16>::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSingle<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSingle<OT::IntType<unsigned int, 4u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSingle<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::cmp(unsigned int) const
482
483
  template <typename set_t>
484
  void collect_glyphs (set_t &glyphs) const
485
0
  {
486
0
    if (glyph == DELETED_GLYPH) return;
487
0
    glyphs.add (glyph);
488
0
  }
Unexecuted instantiation: void AAT::LookupSingle<OT::IntType<unsigned short, 2u> >::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
Unexecuted instantiation: void AAT::LookupSingle<OT::IntType<unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
489
  template <typename set_t, typename filter_t>
490
  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
491
0
  {
492
0
    if (glyph == DELETED_GLYPH) return;
493
0
    if (!filter (value)) return;
494
0
    glyphs.add (glyph);
495
0
  }
496
497
  bool sanitize (hb_sanitize_context_t *c) const
498
0
  {
499
0
    TRACE_SANITIZE (this);
500
0
    return_trace (c->check_struct (this) && value.sanitize (c));
501
0
  }
Unexecuted instantiation: AAT::LookupSingle<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupSingle<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupSingle<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
502
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
503
0
  {
504
0
    TRACE_SANITIZE (this);
505
0
    return_trace (c->check_struct (this) && value.sanitize (c, base));
506
0
  }
Unexecuted instantiation: AAT::LookupSingle<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupSingle<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupSingle<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
507
508
  HBGlyphID16 glyph;    /* Last GlyphID */
509
  T   value;    /* The lookup value (only one) */
510
  public:
511
  DEFINE_SIZE_STATIC (2 + T::static_size);
512
};
513
514
template <typename T>
515
struct LookupFormat6
516
{
517
  friend struct Lookup<T>;
518
519
  private:
520
  const T* get_value (hb_codepoint_t glyph_id) const
521
0
  {
522
0
    const LookupSingle<T> *v = entries.bsearch (glyph_id);
523
0
    return v ? &v->value : nullptr;
524
0
  }
Unexecuted instantiation: AAT::LookupFormat6<OT::IntType<unsigned short, 2u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat6<OT::HBGlyphID16>::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat6<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat6<OT::IntType<unsigned int, 4u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat6<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::get_value(unsigned int) const
525
526
  template <typename set_t>
527
  void collect_glyphs (set_t &glyphs) const
528
0
  {
529
0
    unsigned count = entries.get_length ();
530
0
    for (unsigned i = 0; i < count; i++)
531
0
      entries[i].collect_glyphs (glyphs);
532
0
  }
Unexecuted instantiation: void AAT::LookupFormat6<OT::IntType<unsigned short, 2u> >::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
Unexecuted instantiation: void AAT::LookupFormat6<OT::IntType<unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
533
  template <typename set_t, typename filter_t>
534
  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
535
0
  {
536
0
    unsigned count = entries.get_length ();
537
0
    for (unsigned i = 0; i < count; i++)
538
0
      entries[i].collect_glyphs_filtered (glyphs, filter);
539
0
  }
540
541
  bool sanitize (hb_sanitize_context_t *c) const
542
0
  {
543
0
    TRACE_SANITIZE (this);
544
0
    return_trace (entries.sanitize (c));
545
0
  }
Unexecuted instantiation: AAT::LookupFormat6<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat6<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat6<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
546
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
547
0
  {
548
0
    TRACE_SANITIZE (this);
549
0
    return_trace (entries.sanitize (c, base));
550
0
  }
Unexecuted instantiation: AAT::LookupFormat6<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat6<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat6<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
551
552
  protected:
553
  HBUINT16  format;   /* Format identifier--format = 6 */
554
  VarSizedBinSearchArrayOf<LookupSingle<T>>
555
    entries;  /* The actual entries, sorted by glyph index. */
556
  public:
557
  DEFINE_SIZE_ARRAY (8, entries);
558
};
559
560
template <typename T>
561
struct LookupFormat8
562
{
563
  friend struct Lookup<T>;
564
565
  private:
566
  const T* get_value (hb_codepoint_t glyph_id) const
567
0
  {
568
0
    return firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount ?
569
0
     &valueArrayZ[glyph_id - firstGlyph] : nullptr;
570
0
  }
Unexecuted instantiation: AAT::LookupFormat8<OT::IntType<unsigned short, 2u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat8<OT::HBGlyphID16>::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat8<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat8<OT::IntType<unsigned int, 4u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat8<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::get_value(unsigned int) const
571
572
  template <typename set_t>
573
  void collect_glyphs (set_t &glyphs) const
574
0
  {
575
0
    if (unlikely (!glyphCount)) return;
576
0
    if (firstGlyph == DELETED_GLYPH) return;
577
0
    glyphs.add_range (firstGlyph, firstGlyph + glyphCount - 1);
578
0
  }
Unexecuted instantiation: void AAT::LookupFormat8<OT::IntType<unsigned short, 2u> >::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
Unexecuted instantiation: void AAT::LookupFormat8<OT::IntType<unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
579
  template <typename set_t, typename filter_t>
580
  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
581
0
  {
582
0
    if (unlikely (!glyphCount)) return;
583
0
    if (firstGlyph == DELETED_GLYPH) return;
584
0
    const T *p = valueArrayZ.arrayZ;
585
0
    for (unsigned i = 0; i < glyphCount; i++)
586
0
      if (filter (p[i]))
587
0
  glyphs.add (firstGlyph + i);
588
0
  }
589
590
  bool sanitize (hb_sanitize_context_t *c) const
591
0
  {
592
0
    TRACE_SANITIZE (this);
593
0
    return_trace (c->check_struct (this) && valueArrayZ.sanitize (c, glyphCount));
594
0
  }
Unexecuted instantiation: AAT::LookupFormat8<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat8<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat8<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
595
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
596
0
  {
597
0
    TRACE_SANITIZE (this);
598
0
    return_trace (c->check_struct (this) && valueArrayZ.sanitize (c, glyphCount, base));
599
0
  }
Unexecuted instantiation: AAT::LookupFormat8<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat8<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat8<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
600
601
  protected:
602
  HBUINT16  format;   /* Format identifier--format = 8 */
603
  HBGlyphID16 firstGlyph; /* First glyph index included in the trimmed array. */
604
  HBUINT16  glyphCount; /* Total number of glyphs (equivalent to the last
605
         * glyph minus the value of firstGlyph plus 1). */
606
  UnsizedArrayOf<T>
607
    valueArrayZ;  /* The lookup values (indexed by the glyph index
608
         * minus the value of firstGlyph). */
609
  public:
610
  DEFINE_SIZE_ARRAY (6, valueArrayZ);
611
};
612
613
template <typename T>
614
struct LookupFormat10
615
{
616
  friend struct Lookup<T>;
617
618
  private:
619
  const typename T::type get_value_or_null (hb_codepoint_t glyph_id) const
620
0
  {
621
0
    if (!(firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount))
622
0
      return Null (T);
623
624
0
    const HBUINT8 *p = &valueArrayZ[(glyph_id - firstGlyph) * valueSize];
625
626
0
    unsigned int v = 0;
627
0
    unsigned int count = valueSize;
628
0
    for (unsigned int i = 0; i < count; i++)
629
0
      v = (v << 8) | *p++;
630
631
0
    return v;
632
0
  }
Unexecuted instantiation: AAT::LookupFormat10<OT::IntType<unsigned int, 4u> >::get_value_or_null(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat10<OT::IntType<unsigned short, 2u> >::get_value_or_null(unsigned int) const
633
634
  template <typename set_t>
635
  void collect_glyphs (set_t &glyphs) const
636
0
  {
637
0
    if (unlikely (!glyphCount)) return;
638
0
    if (firstGlyph == DELETED_GLYPH) return;
639
0
    glyphs.add_range (firstGlyph, firstGlyph + glyphCount - 1);
640
0
  }
Unexecuted instantiation: void AAT::LookupFormat10<OT::IntType<unsigned short, 2u> >::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
Unexecuted instantiation: void AAT::LookupFormat10<OT::IntType<unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&) const
641
642
  bool sanitize (hb_sanitize_context_t *c) const
643
0
  {
644
0
    TRACE_SANITIZE (this);
645
0
    return_trace (c->check_struct (this) &&
646
0
      hb_barrier () &&
647
0
      valueSize <= 4 &&
648
0
      valueArrayZ.sanitize (c, glyphCount * valueSize));
649
0
  }
Unexecuted instantiation: AAT::LookupFormat10<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat10<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat10<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
650
651
  protected:
652
  HBUINT16  format;   /* Format identifier--format = 8 */
653
  HBUINT16  valueSize;  /* Byte size of each value. */
654
  HBGlyphID16 firstGlyph; /* First glyph index included in the trimmed array. */
655
  HBUINT16  glyphCount; /* Total number of glyphs (equivalent to the last
656
         * glyph minus the value of firstGlyph plus 1). */
657
  UnsizedArrayOf<HBUINT8>
658
    valueArrayZ;  /* The lookup values (indexed by the glyph index
659
         * minus the value of firstGlyph). */
660
  public:
661
  DEFINE_SIZE_ARRAY (8, valueArrayZ);
662
};
663
664
template <typename T>
665
struct Lookup
666
{
667
  const T* get_value (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
668
0
  {
669
0
    switch (u.format) {
670
0
    case 0: hb_barrier (); return u.format0.get_value (glyph_id, num_glyphs);
671
0
    case 2: hb_barrier (); return u.format2.get_value (glyph_id);
672
0
    case 4: hb_barrier (); return u.format4.get_value (glyph_id);
673
0
    case 6: hb_barrier (); return u.format6.get_value (glyph_id);
674
0
    case 8: hb_barrier (); return u.format8.get_value (glyph_id);
675
0
    default:return nullptr;
676
0
    }
677
0
  }
Unexecuted instantiation: AAT::Lookup<OT::IntType<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::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::get_value(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::Lookup<OT::IntType<unsigned int, 4u> >::get_value(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::Lookup<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::get_value(unsigned int, unsigned int) const
678
679
  const typename T::type get_value_or_null (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
680
0
  {
681
0
    switch (u.format) {
682
      /* Format 10 cannot return a pointer. */
683
0
      case 10: hb_barrier (); return u.format10.get_value_or_null (glyph_id);
684
0
      default:
685
0
      const T *v = get_value (glyph_id, num_glyphs);
686
0
      return v ? *v : Null (T);
687
0
    }
688
0
  }
Unexecuted instantiation: AAT::Lookup<OT::IntType<unsigned int, 4u> >::get_value_or_null(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::Lookup<OT::IntType<unsigned short, 2u> >::get_value_or_null(unsigned int, unsigned int) const
689
690
  template <typename set_t>
691
  void collect_glyphs (set_t &glyphs, unsigned int num_glyphs) const
692
0
  {
693
0
    switch (u.format) {
694
0
    case 0: hb_barrier (); u.format0.collect_glyphs (glyphs, num_glyphs); return;
695
0
    case 2: hb_barrier (); u.format2.collect_glyphs (glyphs); return;
696
0
    case 4: hb_barrier (); u.format4.collect_glyphs (glyphs); return;
697
0
    case 6: hb_barrier (); u.format6.collect_glyphs (glyphs); return;
698
0
    case 8: hb_barrier (); u.format8.collect_glyphs (glyphs); return;
699
0
    case 10: hb_barrier (); u.format10.collect_glyphs (glyphs); return;
700
0
    default:return;
701
0
    }
702
0
  }
Unexecuted instantiation: void AAT::Lookup<OT::IntType<unsigned short, 2u> >::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
Unexecuted instantiation: void AAT::Lookup<OT::IntType<unsigned int, 4u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&, unsigned int) const
703
  template <typename set_t, typename filter_t>
704
  void collect_glyphs_filtered (set_t &glyphs, unsigned num_glyphs, const filter_t &filter) const
705
0
  {
706
0
    switch (u.format) {
707
0
    case 0: hb_barrier (); u.format0.collect_glyphs_filtered (glyphs, num_glyphs, filter); return;
708
0
    case 2: hb_barrier (); u.format2.collect_glyphs_filtered (glyphs, filter); return;
709
0
    case 4: hb_barrier (); u.format4.collect_glyphs_filtered (glyphs, filter); return;
710
0
    case 6: hb_barrier (); u.format6.collect_glyphs_filtered (glyphs, filter); return;
711
0
    case 8: hb_barrier (); u.format8.collect_glyphs_filtered (glyphs, filter); return;
712
0
    default:return;
713
0
    }
714
0
  }
715
716
  typename T::type get_class (hb_codepoint_t glyph_id,
717
            unsigned int num_glyphs,
718
            unsigned int outOfRange) const
719
0
  {
720
0
    const T *v = get_value (glyph_id, num_glyphs);
721
0
    return v ? *v : outOfRange;
722
0
  }
723
724
  bool sanitize (hb_sanitize_context_t *c) const
725
0
  {
726
0
    TRACE_SANITIZE (this);
727
0
    if (!u.format.sanitize (c)) return_trace (false);
728
0
    hb_barrier ();
729
0
    switch (u.format) {
730
0
    case 0: hb_barrier (); return_trace (u.format0.sanitize (c));
731
0
    case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
732
0
    case 4: hb_barrier (); return_trace (u.format4.sanitize (c));
733
0
    case 6: hb_barrier (); return_trace (u.format6.sanitize (c));
734
0
    case 8: hb_barrier (); return_trace (u.format8.sanitize (c));
735
0
    case 10: hb_barrier (); return_trace (u.format10.sanitize (c));
736
0
    default:return_trace (true);
737
0
    }
738
0
  }
Unexecuted instantiation: AAT::Lookup<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::Lookup<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::Lookup<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
739
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
740
0
  {
741
0
    TRACE_SANITIZE (this);
742
0
    if (!u.format.sanitize (c)) return_trace (false);
743
0
    hb_barrier ();
744
0
    switch (u.format) {
745
0
    case 0: hb_barrier (); return_trace (u.format0.sanitize (c, base));
746
0
    case 2: hb_barrier (); return_trace (u.format2.sanitize (c, base));
747
0
    case 4: hb_barrier (); return_trace (u.format4.sanitize (c, base));
748
0
    case 6: hb_barrier (); return_trace (u.format6.sanitize (c, base));
749
0
    case 8: hb_barrier (); return_trace (u.format8.sanitize (c, base));
750
0
    case 10: return_trace (false); /* We don't support format10 here currently. */
751
0
    default:return_trace (true);
752
0
    }
753
0
  }
Unexecuted instantiation: AAT::Lookup<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, false> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::Lookup<OT::OffsetTo<OT::ArrayOf<AAT::WidthDeltaPair, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::Lookup<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, void, true> >::sanitize(hb_sanitize_context_t*, void const*) const
754
755
  protected:
756
  union {
757
  HBUINT16    format;   /* Format identifier */
758
  LookupFormat0<T>  format0;
759
  LookupFormat2<T>  format2;
760
  LookupFormat4<T>  format4;
761
  LookupFormat6<T>  format6;
762
  LookupFormat8<T>  format8;
763
  LookupFormat10<T> format10;
764
  } u;
765
  public:
766
  DEFINE_SIZE_UNION (2, format);
767
};
768
DECLARE_NULL_NAMESPACE_BYTES_TEMPLATE1 (AAT, Lookup, 2);
769
770
/*
771
 * (Extended) State Table
772
 */
773
774
template <typename T>
775
struct Entry
776
{
777
  // This doesn't seem like it's ever called.
778
  bool sanitize (hb_sanitize_context_t *c) const
779
  {
780
    TRACE_SANITIZE (this);
781
    /* Note, we don't recurse-sanitize data because we don't access it.
782
     * That said, in our DEFINE_SIZE_STATIC we access T::static_size,
783
     * which ensures that data has a simple sanitize(). To be determined
784
     * if I need to remove that as well.
785
     *
786
     * HOWEVER! Because we are a template, our DEFINE_SIZE_STATIC
787
     * assertion wouldn't be checked, hence the line below. */
788
    static_assert (T::static_size, "");
789
790
    return_trace (c->check_struct (this));
791
  }
792
793
  public:
794
  HBUINT16  newState; /* Byte offset from beginning of state table
795
         * to the new state. Really?!?! Or just state
796
         * number?  The latter in morx for sure. */
797
  HBUINT16  flags;    /* Table specific. */
798
  T   data;   /* Optional offsets to per-glyph tables. */
799
  public:
800
  DEFINE_SIZE_STATIC (4 + T::static_size);
801
};
802
803
template <>
804
struct Entry<void>
805
{
806
  // This does seem like it's ever called.
807
  bool sanitize (hb_sanitize_context_t *c) const
808
0
  {
809
0
    TRACE_SANITIZE (this);
810
0
    return_trace (c->check_struct (this));
811
0
  }
812
813
  public:
814
  HBUINT16  newState; /* Byte offset from beginning of state table to the new state. */
815
  HBUINT16  flags;    /* Table specific. */
816
  public:
817
  DEFINE_SIZE_STATIC (4);
818
};
819
820
enum Class
821
{
822
  CLASS_END_OF_TEXT = 0,
823
  CLASS_OUT_OF_BOUNDS = 1,
824
  CLASS_DELETED_GLYPH = 2,
825
  CLASS_END_OF_LINE = 3,
826
};
827
828
template <typename Types, typename Extra>
829
struct StateTable
830
{
831
  typedef typename Types::HBUINT HBUINT;
832
  typedef typename Types::HBUSHORT HBUSHORT;
833
  typedef typename Types::ClassTypeNarrow ClassType;
834
835
  enum State
836
  {
837
    STATE_START_OF_TEXT = 0,
838
    STATE_START_OF_LINE = 1,
839
  };
840
841
  template <typename set_t>
842
  void collect_glyphs (set_t &glyphs, unsigned num_glyphs) const
843
  {
844
    (this+classTable).collect_glyphs (glyphs, num_glyphs);
845
  }
846
  template <typename set_t, typename table_t>
847
  void collect_initial_glyphs (set_t &glyphs, unsigned num_glyphs, const table_t &table) const
848
0
  {
849
0
    unsigned num_classes = nClasses;
850
851
0
    if (unlikely (num_classes > hb_bit_page_t::BITS))
852
0
    {
853
0
      (this+classTable).collect_glyphs (glyphs, num_glyphs);
854
0
      return;
855
0
    }
856
857
    // Collect all classes going out from the start state.
858
0
    hb_bit_page_t filter;
859
860
0
    for (unsigned i = 0; i < num_classes; i++)
861
0
    {
862
0
      const auto &entry = get_entry (STATE_START_OF_TEXT, i);
863
0
      if (new_state (entry.newState) == STATE_START_OF_TEXT &&
864
0
    !table.is_action_initiable (entry) && !table.is_actionable (entry))
865
0
  continue;
866
867
0
      filter.add (i);
868
0
    }
869
870
    // And glyphs in those classes.
871
872
0
    if (filter (CLASS_DELETED_GLYPH))
873
0
      glyphs.add (DELETED_GLYPH);
874
875
0
    (this+classTable).collect_glyphs_filtered (glyphs, num_glyphs, filter);
876
0
  }
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
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
877
878
  int new_state (unsigned int newState) const
879
0
  { return Types::extended ? newState : ((int) newState - (int) stateArrayTable) / (int) nClasses; }
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, void>::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
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
880
881
  unsigned int get_class (hb_codepoint_t glyph_id,
882
        unsigned int num_glyphs,
883
        hb_aat_class_cache_t *cache = nullptr) const
884
0
  {
885
0
    unsigned klass;
886
0
    if (cache && cache->get (glyph_id, &klass)) return klass;
887
0
    if (unlikely (glyph_id == DELETED_GLYPH)) return CLASS_DELETED_GLYPH;
888
0
    klass = (this+classTable).get_class (glyph_id, num_glyphs, CLASS_OUT_OF_BOUNDS);
889
0
    if (cache) cache->set (glyph_id, klass);
890
0
    return klass;
891
0
  }
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, void>::get_class(unsigned int, unsigned int, hb_cache_t<15u, 8u, 7u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::ContextualSubtable<AAT::ExtendedTypes>::EntryData>::get_class(unsigned int, unsigned int, hb_cache_t<15u, 8u, 7u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::LigatureEntry<true>::EntryData>::get_class(unsigned int, unsigned int, hb_cache_t<15u, 8u, 7u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::InsertionSubtable<AAT::ExtendedTypes>::EntryData>::get_class(unsigned int, unsigned int, hb_cache_t<15u, 8u, 7u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, void>::get_class(unsigned int, unsigned int, hb_cache_t<15u, 8u, 7u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, AAT::ContextualSubtable<AAT::ObsoleteTypes>::EntryData>::get_class(unsigned int, unsigned int, hb_cache_t<15u, 8u, 7u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, AAT::InsertionSubtable<AAT::ObsoleteTypes>::EntryData>::get_class(unsigned int, unsigned int, hb_cache_t<15u, 8u, 7u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::Format1Entry<true>::EntryData>::get_class(unsigned int, unsigned int, hb_cache_t<15u, 8u, 7u, true>*) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::EntryData>::get_class(unsigned int, unsigned int, hb_cache_t<15u, 8u, 7u, true>*) const
892
893
  const Entry<Extra> *get_entries () const
894
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
895
896
  const Entry<Extra> &get_entry (int state, unsigned int klass) const
897
0
  {
898
0
    unsigned n_classes = nClasses;
899
0
    if (unlikely (klass >= n_classes))
900
0
      klass = CLASS_OUT_OF_BOUNDS;
901
902
0
    const HBUSHORT *states = (this+stateArrayTable).arrayZ;
903
0
    const Entry<Extra> *entries = (this+entryTable).arrayZ;
904
905
0
    unsigned int entry = states[state * n_classes + klass];
906
0
    DEBUG_MSG (APPLY, nullptr, "e%u", entry);
907
908
0
    return entries[entry];
909
0
  }
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, void>::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
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
910
911
  bool sanitize (hb_sanitize_context_t *c,
912
     unsigned int *num_entries_out = nullptr) const
913
0
  {
914
0
    TRACE_SANITIZE (this);
915
0
    if (unlikely (!(c->check_struct (this) &&
916
0
        hb_barrier () &&
917
0
        nClasses >= 4 /* Ensure pre-defined classes fit.  */ &&
918
0
        classTable.sanitize (c, this)))) return_trace (false);
919
920
0
    const HBUSHORT *states = (this+stateArrayTable).arrayZ;
921
0
    const Entry<Extra> *entries = (this+entryTable).arrayZ;
922
923
0
    unsigned int num_classes = nClasses;
924
0
    if (unlikely (hb_unsigned_mul_overflows (num_classes, states[0].static_size)))
925
0
      return_trace (false);
926
0
    unsigned int row_stride = num_classes * states[0].static_size;
927
928
    /* Apple 'kern' table has this peculiarity:
929
     *
930
     * "Because the stateTableOffset in the state table header is (strictly
931
     * speaking) redundant, some 'kern' tables use it to record an initial
932
     * state where that should not be StartOfText. To determine if this is
933
     * done, calculate what the stateTableOffset should be. If it's different
934
     * from the actual stateTableOffset, use it as the initial state."
935
     *
936
     * We implement this by calling the initial state zero, but allow *negative*
937
     * states if the start state indeed was not the first state.  Since the code
938
     * is shared, this will also apply to 'mort' table.  The 'kerx' / 'morx'
939
     * tables are not affected since those address states by index, not offset.
940
     */
941
942
0
    int min_state = 0;
943
0
    int max_state = 0;
944
0
    unsigned int num_entries = 0;
945
946
0
    int state_pos = 0;
947
0
    int state_neg = 0;
948
0
    unsigned int entry = 0;
949
0
    while (min_state < state_neg || state_pos <= max_state)
950
0
    {
951
0
      if (min_state < state_neg)
952
0
      {
953
  /* Negative states. */
954
0
  if (unlikely (hb_unsigned_mul_overflows (min_state, num_classes)))
955
0
    return_trace (false);
956
0
  if (unlikely (!c->check_range (&states[min_state * num_classes],
957
0
               -min_state,
958
0
               row_stride)))
959
0
    return_trace (false);
960
0
  if ((c->max_ops -= state_neg - min_state) <= 0)
961
0
    return_trace (false);
962
0
  { /* Sweep new states. */
963
0
    const HBUSHORT *stop = &states[min_state * num_classes];
964
0
    if (unlikely (stop > states))
965
0
      return_trace (false);
966
0
    for (const HBUSHORT *p = states; stop < p; p--)
967
0
      num_entries = hb_max (num_entries, *(p - 1) + 1u);
968
0
    state_neg = min_state;
969
0
  }
970
0
      }
971
972
0
      if (state_pos <= max_state)
973
0
      {
974
  /* Positive states. */
975
0
  if (unlikely (!c->check_range (states,
976
0
               max_state + 1,
977
0
               row_stride)))
978
0
    return_trace (false);
979
0
  if ((c->max_ops -= max_state - state_pos + 1) <= 0)
980
0
    return_trace (false);
981
0
  { /* Sweep new states. */
982
0
    if (unlikely (hb_unsigned_mul_overflows ((max_state + 1), num_classes)))
983
0
      return_trace (false);
984
0
    const HBUSHORT *stop = &states[(max_state + 1) * num_classes];
985
0
    if (unlikely (stop < states))
986
0
      return_trace (false);
987
0
    for (const HBUSHORT *p = &states[state_pos * num_classes]; p < stop; p++)
988
0
      num_entries = hb_max (num_entries, *p + 1u);
989
0
    state_pos = max_state + 1;
990
0
  }
991
0
      }
992
993
0
      if (unlikely (!c->check_array (entries, num_entries)))
994
0
  return_trace (false);
995
0
      if ((c->max_ops -= num_entries - entry) <= 0)
996
0
  return_trace (false);
997
0
      { /* Sweep new entries. */
998
0
  const Entry<Extra> *stop = &entries[num_entries];
999
0
  for (const Entry<Extra> *p = &entries[entry]; p < stop; p++)
1000
0
  {
1001
0
    int newState = new_state (p->newState);
1002
0
    min_state = hb_min (min_state, newState);
1003
0
    max_state = hb_max (max_state, newState);
1004
0
  }
1005
0
  entry = num_entries;
1006
0
      }
1007
0
    }
1008
1009
0
    if (num_entries_out)
1010
0
      *num_entries_out = num_entries;
1011
1012
0
    return_trace (true);
1013
0
  }
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, void>::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
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
1014
1015
  protected:
1016
  HBUINT  nClasses; /* Number of classes, which is the number of indices
1017
         * in a single line in the state array. */
1018
  NNOffsetTo<ClassType, HBUINT>
1019
    classTable; /* Offset to the class table. */
1020
  NNOffsetTo<UnsizedArrayOf<HBUSHORT>, HBUINT>
1021
    stateArrayTable;/* Offset to the state array. */
1022
  NNOffsetTo<UnsizedArrayOf<Entry<Extra>>, HBUINT>
1023
    entryTable; /* Offset to the entry array. */
1024
1025
  public:
1026
  DEFINE_SIZE_STATIC (4 * sizeof (HBUINT));
1027
};
1028
1029
template <typename HBUCHAR>
1030
struct ClassTable
1031
{
1032
  unsigned int get_class (hb_codepoint_t glyph_id, unsigned int outOfRange) const
1033
0
  {
1034
0
    unsigned int i = glyph_id - firstGlyph;
1035
0
    return i >= classArray.len ? outOfRange : classArray.arrayZ[i];
1036
0
  }
Unexecuted instantiation: AAT::ClassTable<OT::IntType<unsigned char, 1u> >::get_class(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::ClassTable<OT::IntType<unsigned short, 2u> >::get_class(unsigned int, unsigned int) const
1037
  unsigned int get_class (hb_codepoint_t glyph_id,
1038
        unsigned int num_glyphs HB_UNUSED,
1039
        unsigned int outOfRange) const
1040
0
  {
1041
0
    return get_class (glyph_id, outOfRange);
1042
0
  }
Unexecuted instantiation: AAT::ClassTable<OT::IntType<unsigned char, 1u> >::get_class(unsigned int, unsigned int, unsigned int) const
Unexecuted instantiation: AAT::ClassTable<OT::IntType<unsigned short, 2u> >::get_class(unsigned int, unsigned int, unsigned int) const
1043
1044
  template <typename set_t>
1045
  void collect_glyphs (set_t &glyphs, unsigned num_glyphs) const
1046
0
  {
1047
0
    for (unsigned i = 0; i < classArray.len; i++)
1048
0
      if (classArray.arrayZ[i] != CLASS_OUT_OF_BOUNDS)
1049
0
  glyphs.add (firstGlyph + i);
1050
0
  }
Unexecuted instantiation: void AAT::ClassTable<OT::IntType<unsigned char, 1u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&, unsigned int) const
Unexecuted instantiation: void AAT::ClassTable<OT::IntType<unsigned short, 2u> >::collect_glyphs<hb_bit_set_t>(hb_bit_set_t&, unsigned int) const
1051
  template <typename set_t, typename filter_t>
1052
  void collect_glyphs_filtered (set_t &glyphs, unsigned num_glyphs, const filter_t &filter) const
1053
0
  {
1054
0
    for (unsigned i = 0; i < classArray.len; i++)
1055
0
      if (filter (classArray.arrayZ[i]))
1056
0
  glyphs.add (firstGlyph + i);
1057
0
  }
1058
1059
  bool sanitize (hb_sanitize_context_t *c) const
1060
0
  {
1061
0
    TRACE_SANITIZE (this);
1062
0
    return_trace (c->check_struct (this) && classArray.sanitize (c));
1063
0
  }
Unexecuted instantiation: AAT::ClassTable<OT::IntType<unsigned char, 1u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::ClassTable<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
1064
  protected:
1065
  HBGlyphID16   firstGlyph; /* First glyph index included in the trimmed array. */
1066
  Array16Of<HBUCHAR>  classArray; /* The class codes (indexed by glyph index minus
1067
           * firstGlyph). */
1068
  public:
1069
  DEFINE_SIZE_ARRAY (4, classArray);
1070
};
1071
1072
struct SubtableGlyphCoverage
1073
{
1074
  bool sanitize (hb_sanitize_context_t *c, unsigned subtable_count) const
1075
0
  {
1076
0
    TRACE_SANITIZE (this);
1077
1078
0
    if (unlikely (!c->check_array (&subtableOffsets, subtable_count)))
1079
0
      return_trace (false);
1080
1081
0
    unsigned bytes = (c->get_num_glyphs () + CHAR_BIT - 1) / CHAR_BIT;
1082
0
    for (unsigned i = 0; i < subtable_count; i++)
1083
0
    {
1084
0
      uint32_t offset = (uint32_t) subtableOffsets[i];
1085
0
      if (offset == 0 || offset == 0xFFFFFFFF)
1086
0
        continue;
1087
0
      if (unlikely (!subtableOffsets[i].sanitize (c, this, bytes)))
1088
0
        return_trace (false);
1089
0
    }
1090
1091
0
    return_trace (true);
1092
0
  }
1093
  protected:
1094
  UnsizedArrayOf<NNOffset32To<UnsizedArrayOf<HBUINT8>>> subtableOffsets;
1095
              /* Array of offsets from the beginning of the
1096
               * subtable glyph coverage table to the glyph
1097
               * coverage bitfield for a given subtable; there
1098
               * is one offset for each subtable in the chain */
1099
  /* UnsizedArrayOf<HBUINT8> coverageBitfields; *//* The individual coverage bitfields. */
1100
  public:
1101
  DEFINE_SIZE_ARRAY (0, subtableOffsets);
1102
};
1103
1104
struct ObsoleteTypes
1105
{
1106
  static constexpr bool extended = false;
1107
  typedef HBUINT16 HBUINT;
1108
  typedef HBUINT8 HBUSHORT;
1109
  typedef ClassTable<HBUINT8> ClassTypeNarrow;
1110
  typedef ClassTable<HBUINT16> ClassTypeWide;
1111
1112
  template <typename T>
1113
  static unsigned int offsetToIndex (unsigned int offset,
1114
             const void *base,
1115
             const T *array)
1116
0
  {
1117
    /* https://github.com/harfbuzz/harfbuzz/issues/3483 */
1118
    /* If offset is less than base, return an offset that would
1119
     * result in an address half a 32bit address-space away,
1120
     * to make sure sanitize fails even on 32bit builds. */
1121
0
    if (unlikely (offset < unsigned ((const char *) array - (const char *) base)))
1122
0
      return INT_MAX / T::static_size;
1123
1124
    /* https://github.com/harfbuzz/harfbuzz/issues/2816 */
1125
0
    return (offset - unsigned ((const char *) array - (const char *) base)) / T::static_size;
1126
0
  }
Unexecuted instantiation: unsigned int AAT::ObsoleteTypes::offsetToIndex<OT::HBGlyphID16>(unsigned int, void const*, OT::HBGlyphID16 const*)
Unexecuted instantiation: unsigned int AAT::ObsoleteTypes::offsetToIndex<OT::IntType<unsigned int, 4u> >(unsigned int, void const*, OT::IntType<unsigned int, 4u> const*)
Unexecuted instantiation: unsigned int AAT::ObsoleteTypes::offsetToIndex<OT::IntType<unsigned short, 2u> >(unsigned int, void const*, OT::IntType<unsigned short, 2u> const*)
Unexecuted instantiation: unsigned int AAT::ObsoleteTypes::offsetToIndex<OT::IntType<short, 2u> >(unsigned int, void const*, OT::IntType<short, 2u> const*)
1127
  template <typename T>
1128
  static unsigned int byteOffsetToIndex (unsigned int offset,
1129
           const void *base,
1130
           const T *array)
1131
0
  {
1132
0
    return offsetToIndex (offset, base, array);
1133
0
  }
1134
  template <typename T>
1135
  static unsigned int wordOffsetToIndex (unsigned int offset,
1136
           const void *base,
1137
           const T *array)
1138
0
  {
1139
0
    return offsetToIndex (2 * offset, base, array);
1140
0
  }
Unexecuted instantiation: unsigned int AAT::ObsoleteTypes::wordOffsetToIndex<OT::HBGlyphID16>(unsigned int, void const*, OT::HBGlyphID16 const*)
Unexecuted instantiation: unsigned int AAT::ObsoleteTypes::wordOffsetToIndex<OT::IntType<unsigned short, 2u> >(unsigned int, void const*, OT::IntType<unsigned short, 2u> const*)
1141
};
1142
struct ExtendedTypes
1143
{
1144
  static constexpr bool extended = true;
1145
  typedef HBUINT32 HBUINT;
1146
  typedef HBUINT16 HBUSHORT;
1147
  typedef Lookup<HBUINT16> ClassTypeNarrow;
1148
  typedef Lookup<HBUINT16> ClassTypeWide;
1149
1150
  template <typename T>
1151
  static unsigned int offsetToIndex (unsigned int offset,
1152
             const void *base HB_UNUSED,
1153
             const T *array HB_UNUSED)
1154
0
  {
1155
0
    return offset;
1156
0
  }
Unexecuted instantiation: unsigned int AAT::ExtendedTypes::offsetToIndex<OT::IntType<unsigned int, 4u> >(unsigned int, void const*, OT::IntType<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::IntType<short, 2u> >(unsigned int, void const*, OT::IntType<short, 2u> const*)
1157
  template <typename T>
1158
  static unsigned int byteOffsetToIndex (unsigned int offset,
1159
           const void *base HB_UNUSED,
1160
           const T *array HB_UNUSED)
1161
0
  {
1162
0
    return offset / 2;
1163
0
  }
1164
  template <typename T>
1165
  static unsigned int wordOffsetToIndex (unsigned int offset,
1166
           const void *base HB_UNUSED,
1167
           const T *array HB_UNUSED)
1168
0
  {
1169
0
    return offset;
1170
0
  }
Unexecuted instantiation: unsigned int AAT::ExtendedTypes::wordOffsetToIndex<OT::IntType<unsigned short, 2u> >(unsigned int, void const*, OT::IntType<unsigned short, 2u> const*)
Unexecuted instantiation: unsigned int AAT::ExtendedTypes::wordOffsetToIndex<OT::HBGlyphID16>(unsigned int, void const*, OT::HBGlyphID16 const*)
1171
};
1172
1173
template <typename Types, typename EntryData, typename Flags>
1174
struct StateTableDriver
1175
{
1176
  using StateTableT = StateTable<Types, EntryData>;
1177
  using EntryT = Entry<EntryData>;
1178
1179
  StateTableDriver (const StateTableT &machine_,
1180
        hb_face_t *face_) :
1181
0
        machine (machine_),
1182
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*)
1183
1184
  template <typename context_t>
1185
  void drive (context_t *c, hb_aat_apply_context_t *ac)
1186
0
  {
1187
0
    hb_buffer_t *buffer = ac->buffer;
1188
1189
0
    if (!c->in_place)
1190
0
      buffer->clear_output ();
1191
1192
0
    int state = StateTableT::STATE_START_OF_TEXT;
1193
    // If there's only one range, we already checked the flag.
1194
0
    auto *last_range = ac->range_flags && (ac->range_flags->length > 1) ? &(*ac->range_flags)[0] : nullptr;
1195
0
    for (buffer->idx = 0; buffer->successful;)
1196
0
    {
1197
      /* This block is copied in NoncontextualSubtable::apply. Keep in sync. */
1198
0
      if (last_range)
1199
0
      {
1200
0
  auto *range = last_range;
1201
0
  if (buffer->idx < buffer->len)
1202
0
  {
1203
0
    unsigned cluster = buffer->cur().cluster;
1204
0
    while (cluster < range->cluster_first)
1205
0
      range--;
1206
0
    while (cluster > range->cluster_last)
1207
0
      range++;
1208
1209
1210
0
    last_range = range;
1211
0
  }
1212
0
  if (!(range->flags & ac->subtable_flags))
1213
0
  {
1214
0
    if (buffer->idx == buffer->len || unlikely (!buffer->successful))
1215
0
      break;
1216
1217
0
    state = StateTableT::STATE_START_OF_TEXT;
1218
0
    (void) buffer->next_glyph ();
1219
0
    continue;
1220
0
  }
1221
0
      }
1222
1223
0
      unsigned int klass = likely (buffer->idx < buffer->len) ?
1224
0
         machine.get_class (buffer->cur().codepoint, num_glyphs, ac->machine_class_cache) :
1225
0
         (unsigned) CLASS_END_OF_TEXT;
1226
0
      DEBUG_MSG (APPLY, nullptr, "c%u at %u", klass, buffer->idx);
1227
0
      const EntryT &entry = machine.get_entry (state, klass);
1228
0
      const int next_state = machine.new_state (entry.newState);
1229
1230
      /* Conditions under which it's guaranteed safe-to-break before current glyph:
1231
       *
1232
       * 1. There was no action in this transition; and
1233
       *
1234
       * 2. If we break before current glyph, the results will be the same. That
1235
       *    is guaranteed if:
1236
       *
1237
       *    2a. We were already in start-of-text state; or
1238
       *
1239
       *    2b. We are epsilon-transitioning to start-of-text state; or
1240
       *
1241
       *    2c. Starting from start-of-text state seeing current glyph:
1242
       *
1243
       *        2c'. There won't be any actions; and
1244
       *
1245
       *        2c". We would end up in the same state that we were going to end up
1246
       *             in now, including whether epsilon-transitioning.
1247
       *
1248
       *    and
1249
       *
1250
       * 3. If we break before current glyph, there won't be any end-of-text action
1251
       *    after previous glyph.
1252
       *
1253
       * This triples the transitions we need to look up, but is worth returning
1254
       * granular unsafe-to-break results. See eg.:
1255
       *
1256
       *   https://github.com/harfbuzz/harfbuzz/issues/2860
1257
       */
1258
0
      const EntryT *wouldbe_entry;
1259
0
      bool is_safe_to_break =
1260
0
      (
1261
          /* 1. */
1262
0
          !c->table->is_actionable (entry) &&
1263
1264
          /* 2. */
1265
          // This one is meh, I know...
1266
0
    (
1267
0
                 state == StateTableT::STATE_START_OF_TEXT
1268
0
              || ((entry.flags & Flags::DontAdvance) && next_state == StateTableT::STATE_START_OF_TEXT)
1269
0
              || (
1270
        /* 2c. */
1271
0
        wouldbe_entry = &machine.get_entry(StateTableT::STATE_START_OF_TEXT, klass)
1272
0
        ,
1273
        /* 2c'. */
1274
0
        !c->table->is_actionable (*wouldbe_entry) &&
1275
        /* 2c". */
1276
0
        (
1277
0
          next_state == machine.new_state(wouldbe_entry->newState) &&
1278
0
          (entry.flags & Flags::DontAdvance) == (wouldbe_entry->flags & Flags::DontAdvance)
1279
0
        )
1280
0
     )
1281
0
    ) &&
1282
1283
          /* 3. */
1284
0
          !c->table->is_actionable (machine.get_entry (state, CLASS_END_OF_TEXT))
1285
0
      );
1286
1287
0
      if (!is_safe_to_break && buffer->backtrack_len () && buffer->idx < buffer->len)
1288
0
  buffer->unsafe_to_break_from_outbuffer (buffer->backtrack_len () - 1, buffer->idx + 1);
1289
1290
0
      c->transition (buffer, this, entry);
1291
1292
0
      state = next_state;
1293
0
      DEBUG_MSG (APPLY, nullptr, "s%d", state);
1294
1295
0
      if (buffer->idx == buffer->len || unlikely (!buffer->successful))
1296
0
  break;
1297
1298
0
      if (!(entry.flags & Flags::DontAdvance) || buffer->max_ops-- <= 0)
1299
0
  (void) buffer->next_glyph ();
1300
0
    }
1301
1302
0
    if (!c->in_place)
1303
0
      buffer->sync ();
1304
0
  }
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*)
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*)
1305
1306
  public:
1307
  const StateTableT &machine;
1308
  unsigned int num_glyphs;
1309
};
1310
1311
1312
} /* namespace AAT */
1313
1314
1315
#endif /* HB_AAT_LAYOUT_COMMON_HH */