Coverage Report

Created: 2023-06-07 06:14

/src/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-open-type.hh"
33
34
namespace OT {
35
struct GDEF;
36
};
37
38
namespace AAT {
39
40
using namespace OT;
41
42
43
struct ankr;
44
45
struct hb_aat_apply_context_t :
46
       hb_dispatch_context_t<hb_aat_apply_context_t, bool, HB_DEBUG_APPLY>
47
{
48
0
  const char *get_name () { return "APPLY"; }
49
  template <typename T>
50
45
  return_t dispatch (const T &obj) { return obj.apply (this); }
bool AAT::hb_aat_apply_context_t::dispatch<OT::KernOT>(OT::KernOT const&)
Line
Count
Source
50
9
  return_t dispatch (const T &obj) { return obj.apply (this); }
bool AAT::hb_aat_apply_context_t::dispatch<AAT::KerxSubTableFormat0<OT::KernOTSubTableHeader> >(AAT::KerxSubTableFormat0<OT::KernOTSubTableHeader> const&)
Line
Count
Source
50
36
  return_t dispatch (const T &obj) { return obj.apply (this); }
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>(OT::KernAAT 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&)
51
0
  static return_t default_return_value () { return false; }
52
0
  bool stop_sublookup_iteration (return_t r) const { return r; }
53
54
  const hb_ot_shape_plan_t *plan;
55
  hb_font_t *font;
56
  hb_face_t *face;
57
  hb_buffer_t *buffer;
58
  hb_sanitize_context_t sanitizer;
59
  const ankr *ankr_table;
60
  const OT::GDEF *gdef_table;
61
  const hb_sorted_vector_t<hb_aat_map_t::range_flags_t> *range_flags = nullptr;
62
  hb_mask_t subtable_flags = 0;
63
64
  /* Unused. For debug tracing only. */
65
  unsigned int lookup_index;
66
67
  HB_INTERNAL hb_aat_apply_context_t (const hb_ot_shape_plan_t *plan_,
68
              hb_font_t *font_,
69
              hb_buffer_t *buffer_,
70
              hb_blob_t *blob = const_cast<hb_blob_t *> (&Null (hb_blob_t)));
71
72
  HB_INTERNAL ~hb_aat_apply_context_t ();
73
74
  HB_INTERNAL void set_ankr_table (const AAT::ankr *ankr_table_);
75
76
45
  void set_lookup_index (unsigned int i) { lookup_index = i; }
77
};
78
79
80
/*
81
 * Lookup Table
82
 */
83
84
template <typename T> struct Lookup;
85
86
template <typename T>
87
struct LookupFormat0
88
{
89
  friend struct Lookup<T>;
90
91
  private:
92
  const T* get_value (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
93
0
  {
94
0
    if (unlikely (glyph_id >= num_glyphs)) return nullptr;
95
0
    return &arrayZ[glyph_id];
96
0
  }
Unexecuted instantiation: AAT::LookupFormat0<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, false> >::get_value(unsigned int, unsigned int) const
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::IntType<unsigned int, 4u> >::get_value(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::LookupFormat0<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::get_value(unsigned int, unsigned int) const
97
98
  bool sanitize (hb_sanitize_context_t *c) const
99
0
  {
100
0
    TRACE_SANITIZE (this);
101
0
    return_trace (arrayZ.sanitize (c, c->get_num_glyphs ()));
102
0
  }
Unexecuted instantiation: AAT::LookupFormat0<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat0<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat0<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
103
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
104
0
  {
105
0
    TRACE_SANITIZE (this);
106
0
    return_trace (arrayZ.sanitize (c, c->get_num_glyphs (), base));
107
0
  }
Unexecuted instantiation: AAT::LookupFormat0<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, 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>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat0<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
108
109
  protected:
110
  HBUINT16  format;   /* Format identifier--format = 0 */
111
  UnsizedArrayOf<T>
112
    arrayZ;   /* Array of lookup values, indexed by glyph index. */
113
  public:
114
  DEFINE_SIZE_UNBOUNDED (2);
115
};
116
117
118
template <typename T>
119
struct LookupSegmentSingle
120
{
121
  static constexpr unsigned TerminationWordCount = 2u;
122
123
  int cmp (hb_codepoint_t g) const
124
0
  { return g < first ? -1 : g <= last ? 0 : +1 ; }
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, false> >::cmp(unsigned int) const
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::IntType<unsigned int, 4u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::cmp(unsigned int) const
125
126
  bool sanitize (hb_sanitize_context_t *c) const
127
0
  {
128
0
    TRACE_SANITIZE (this);
129
0
    return_trace (c->check_struct (this) && value.sanitize (c));
130
0
  }
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
131
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
132
0
  {
133
0
    TRACE_SANITIZE (this);
134
0
    return_trace (c->check_struct (this) && value.sanitize (c, base));
135
0
  }
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, 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>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupSegmentSingle<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
136
137
  HBGlyphID16 last;   /* Last GlyphID in this segment */
138
  HBGlyphID16 first;    /* First GlyphID in this segment */
139
  T   value;    /* The lookup value (only one) */
140
  public:
141
  DEFINE_SIZE_STATIC (4 + T::static_size);
142
};
143
144
template <typename T>
145
struct LookupFormat2
146
{
147
  friend struct Lookup<T>;
148
149
  private:
150
  const T* get_value (hb_codepoint_t glyph_id) const
151
0
  {
152
0
    const LookupSegmentSingle<T> *v = segments.bsearch (glyph_id);
153
0
    return v ? &v->value : nullptr;
154
0
  }
Unexecuted instantiation: AAT::LookupFormat2<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, false> >::get_value(unsigned int) const
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::IntType<unsigned int, 4u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat2<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::get_value(unsigned int) const
155
156
  bool sanitize (hb_sanitize_context_t *c) const
157
0
  {
158
0
    TRACE_SANITIZE (this);
159
0
    return_trace (segments.sanitize (c));
160
0
  }
Unexecuted instantiation: AAT::LookupFormat2<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat2<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat2<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
161
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
162
0
  {
163
0
    TRACE_SANITIZE (this);
164
0
    return_trace (segments.sanitize (c, base));
165
0
  }
Unexecuted instantiation: AAT::LookupFormat2<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, 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>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat2<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
166
167
  protected:
168
  HBUINT16  format;   /* Format identifier--format = 2 */
169
  VarSizedBinSearchArrayOf<LookupSegmentSingle<T>>
170
    segments; /* The actual segments. These must already be sorted,
171
         * according to the first word in each one (the last
172
         * glyph in each segment). */
173
  public:
174
  DEFINE_SIZE_ARRAY (8, segments);
175
};
176
177
template <typename T>
178
struct LookupSegmentArray
179
{
180
  static constexpr unsigned TerminationWordCount = 2u;
181
182
  const T* get_value (hb_codepoint_t glyph_id, const void *base) const
183
0
  {
184
0
    return first <= glyph_id && glyph_id <= last ? &(base+valuesZ)[glyph_id - first] : nullptr;
185
0
  }
Unexecuted instantiation: AAT::LookupSegmentArray<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, false> >::get_value(unsigned int, void const*) const
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::IntType<unsigned int, 4u> >::get_value(unsigned int, void const*) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::get_value(unsigned int, void const*) const
186
187
  int cmp (hb_codepoint_t g) const
188
0
  { return g < first ? -1 : g <= last ? 0 : +1; }
Unexecuted instantiation: AAT::LookupSegmentArray<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, false> >::cmp(unsigned int) const
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::IntType<unsigned int, 4u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSegmentArray<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::cmp(unsigned int) const
189
190
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
191
0
  {
192
0
    TRACE_SANITIZE (this);
193
0
    return_trace (c->check_struct (this) &&
194
0
      first <= last &&
195
0
      valuesZ.sanitize (c, base, last - first + 1));
196
0
  }
Unexecuted instantiation: AAT::LookupSegmentArray<OT::IntType<unsigned short, 2u> >::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
Unexecuted instantiation: AAT::LookupSegmentArray<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*, void const*) const
197
  template <typename ...Ts>
198
  bool sanitize (hb_sanitize_context_t *c, const void *base, Ts&&... ds) const
199
0
  {
200
0
    TRACE_SANITIZE (this);
201
0
    return_trace (c->check_struct (this) &&
202
0
      first <= last &&
203
0
      valuesZ.sanitize (c, base, last - first + 1, std::forward<Ts> (ds)...));
204
0
  }
Unexecuted instantiation: bool AAT::LookupSegmentArray<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, 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>, 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>, true> >::sanitize<void const*&>(hb_sanitize_context_t*, void const*, void const*&) const
205
206
  HBGlyphID16 last;   /* Last GlyphID in this segment */
207
  HBGlyphID16 first;    /* First GlyphID in this segment */
208
  NNOffset16To<UnsizedArrayOf<T>>
209
    valuesZ;  /* A 16-bit offset from the start of
210
         * the table to the data. */
211
  public:
212
  DEFINE_SIZE_STATIC (6);
213
};
214
215
template <typename T>
216
struct LookupFormat4
217
{
218
  friend struct Lookup<T>;
219
220
  private:
221
  const T* get_value (hb_codepoint_t glyph_id) const
222
0
  {
223
0
    const LookupSegmentArray<T> *v = segments.bsearch (glyph_id);
224
0
    return v ? v->get_value (glyph_id, this) : nullptr;
225
0
  }
Unexecuted instantiation: AAT::LookupFormat4<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, false> >::get_value(unsigned int) const
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::IntType<unsigned int, 4u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat4<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::get_value(unsigned int) const
226
227
  bool sanitize (hb_sanitize_context_t *c) const
228
0
  {
229
0
    TRACE_SANITIZE (this);
230
0
    return_trace (segments.sanitize (c, this));
231
0
  }
Unexecuted instantiation: AAT::LookupFormat4<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat4<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat4<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
232
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
233
0
  {
234
0
    TRACE_SANITIZE (this);
235
0
    return_trace (segments.sanitize (c, this, base));
236
0
  }
Unexecuted instantiation: AAT::LookupFormat4<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, 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>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat4<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
237
238
  protected:
239
  HBUINT16  format;   /* Format identifier--format = 4 */
240
  VarSizedBinSearchArrayOf<LookupSegmentArray<T>>
241
    segments; /* The actual segments. These must already be sorted,
242
         * according to the first word in each one (the last
243
         * glyph in each segment). */
244
  public:
245
  DEFINE_SIZE_ARRAY (8, segments);
246
};
247
248
template <typename T>
249
struct LookupSingle
250
{
251
  static constexpr unsigned TerminationWordCount = 1u;
252
253
0
  int cmp (hb_codepoint_t g) const { return glyph.cmp (g); }
Unexecuted instantiation: AAT::LookupSingle<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, false> >::cmp(unsigned int) const
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::IntType<unsigned int, 4u> >::cmp(unsigned int) const
Unexecuted instantiation: AAT::LookupSingle<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::cmp(unsigned int) const
254
255
  bool sanitize (hb_sanitize_context_t *c) const
256
0
  {
257
0
    TRACE_SANITIZE (this);
258
0
    return_trace (c->check_struct (this) && value.sanitize (c));
259
0
  }
Unexecuted instantiation: AAT::LookupSingle<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupSingle<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupSingle<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
260
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
261
0
  {
262
0
    TRACE_SANITIZE (this);
263
0
    return_trace (c->check_struct (this) && value.sanitize (c, base));
264
0
  }
Unexecuted instantiation: AAT::LookupSingle<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, 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>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupSingle<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
265
266
  HBGlyphID16 glyph;    /* Last GlyphID */
267
  T   value;    /* The lookup value (only one) */
268
  public:
269
  DEFINE_SIZE_STATIC (2 + T::static_size);
270
};
271
272
template <typename T>
273
struct LookupFormat6
274
{
275
  friend struct Lookup<T>;
276
277
  private:
278
  const T* get_value (hb_codepoint_t glyph_id) const
279
0
  {
280
0
    const LookupSingle<T> *v = entries.bsearch (glyph_id);
281
0
    return v ? &v->value : nullptr;
282
0
  }
Unexecuted instantiation: AAT::LookupFormat6<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, false> >::get_value(unsigned int) const
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::IntType<unsigned int, 4u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat6<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::get_value(unsigned int) const
283
284
  bool sanitize (hb_sanitize_context_t *c) const
285
0
  {
286
0
    TRACE_SANITIZE (this);
287
0
    return_trace (entries.sanitize (c));
288
0
  }
Unexecuted instantiation: AAT::LookupFormat6<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat6<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat6<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
289
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
290
0
  {
291
0
    TRACE_SANITIZE (this);
292
0
    return_trace (entries.sanitize (c, base));
293
0
  }
Unexecuted instantiation: AAT::LookupFormat6<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, 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>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat6<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
294
295
  protected:
296
  HBUINT16  format;   /* Format identifier--format = 6 */
297
  VarSizedBinSearchArrayOf<LookupSingle<T>>
298
    entries;  /* The actual entries, sorted by glyph index. */
299
  public:
300
  DEFINE_SIZE_ARRAY (8, entries);
301
};
302
303
template <typename T>
304
struct LookupFormat8
305
{
306
  friend struct Lookup<T>;
307
308
  private:
309
  const T* get_value (hb_codepoint_t glyph_id) const
310
0
  {
311
0
    return firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount ?
312
0
     &valueArrayZ[glyph_id - firstGlyph] : nullptr;
313
0
  }
Unexecuted instantiation: AAT::LookupFormat8<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, false> >::get_value(unsigned int) const
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::IntType<unsigned int, 4u> >::get_value(unsigned int) const
Unexecuted instantiation: AAT::LookupFormat8<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::get_value(unsigned int) const
314
315
  bool sanitize (hb_sanitize_context_t *c) const
316
0
  {
317
0
    TRACE_SANITIZE (this);
318
0
    return_trace (c->check_struct (this) && valueArrayZ.sanitize (c, glyphCount));
319
0
  }
Unexecuted instantiation: AAT::LookupFormat8<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat8<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat8<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
320
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
321
0
  {
322
0
    TRACE_SANITIZE (this);
323
0
    return_trace (c->check_struct (this) && valueArrayZ.sanitize (c, glyphCount, base));
324
0
  }
Unexecuted instantiation: AAT::LookupFormat8<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, 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>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::LookupFormat8<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
325
326
  protected:
327
  HBUINT16  format;   /* Format identifier--format = 8 */
328
  HBGlyphID16 firstGlyph; /* First glyph index included in the trimmed array. */
329
  HBUINT16  glyphCount; /* Total number of glyphs (equivalent to the last
330
         * glyph minus the value of firstGlyph plus 1). */
331
  UnsizedArrayOf<T>
332
    valueArrayZ;  /* The lookup values (indexed by the glyph index
333
         * minus the value of firstGlyph). */
334
  public:
335
  DEFINE_SIZE_ARRAY (6, valueArrayZ);
336
};
337
338
template <typename T>
339
struct LookupFormat10
340
{
341
  friend struct Lookup<T>;
342
343
  private:
344
  const typename T::type get_value_or_null (hb_codepoint_t glyph_id) const
345
0
  {
346
0
    if (!(firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount))
347
0
      return Null (T);
348
349
0
    const HBUINT8 *p = &valueArrayZ[(glyph_id - firstGlyph) * valueSize];
350
351
0
    unsigned int v = 0;
352
0
    unsigned int count = valueSize;
353
0
    for (unsigned int i = 0; i < count; i++)
354
0
      v = (v << 8) | *p++;
355
356
0
    return v;
357
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
358
359
  bool sanitize (hb_sanitize_context_t *c) const
360
0
  {
361
0
    TRACE_SANITIZE (this);
362
0
    return_trace (c->check_struct (this) &&
363
0
      valueSize <= 4 &&
364
0
      valueArrayZ.sanitize (c, glyphCount * valueSize));
365
0
  }
Unexecuted instantiation: AAT::LookupFormat10<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat10<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::LookupFormat10<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
366
367
  protected:
368
  HBUINT16  format;   /* Format identifier--format = 8 */
369
  HBUINT16  valueSize;  /* Byte size of each value. */
370
  HBGlyphID16 firstGlyph; /* First glyph index included in the trimmed array. */
371
  HBUINT16  glyphCount; /* Total number of glyphs (equivalent to the last
372
         * glyph minus the value of firstGlyph plus 1). */
373
  UnsizedArrayOf<HBUINT8>
374
    valueArrayZ;  /* The lookup values (indexed by the glyph index
375
         * minus the value of firstGlyph). */
376
  public:
377
  DEFINE_SIZE_ARRAY (8, valueArrayZ);
378
};
379
380
template <typename T>
381
struct Lookup
382
{
383
  const T* get_value (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
384
0
  {
385
0
    switch (u.format) {
386
0
    case 0: return u.format0.get_value (glyph_id, num_glyphs);
387
0
    case 2: return u.format2.get_value (glyph_id);
388
0
    case 4: return u.format4.get_value (glyph_id);
389
0
    case 6: return u.format6.get_value (glyph_id);
390
0
    case 8: return u.format8.get_value (glyph_id);
391
0
    default:return nullptr;
392
0
    }
393
0
  }
Unexecuted instantiation: AAT::Lookup<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, false> >::get_value(unsigned int, unsigned int) const
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::IntType<unsigned int, 4u> >::get_value(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::Lookup<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::get_value(unsigned int, unsigned int) const
394
395
  const typename T::type get_value_or_null (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
396
0
  {
397
0
    switch (u.format) {
398
      /* Format 10 cannot return a pointer. */
399
0
      case 10: return u.format10.get_value_or_null (glyph_id);
400
0
      default:
401
0
      const T *v = get_value (glyph_id, num_glyphs);
402
0
      return v ? *v : Null (T);
403
0
    }
404
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
405
406
  typename T::type get_class (hb_codepoint_t glyph_id,
407
            unsigned int num_glyphs,
408
            unsigned int outOfRange) const
409
0
  {
410
0
    const T *v = get_value (glyph_id, num_glyphs);
411
0
    return v ? *v : outOfRange;
412
0
  }
413
414
  bool sanitize (hb_sanitize_context_t *c) const
415
0
  {
416
0
    TRACE_SANITIZE (this);
417
0
    if (!u.format.sanitize (c)) return_trace (false);
418
0
    switch (u.format) {
419
0
    case 0: return_trace (u.format0.sanitize (c));
420
0
    case 2: return_trace (u.format2.sanitize (c));
421
0
    case 4: return_trace (u.format4.sanitize (c));
422
0
    case 6: return_trace (u.format6.sanitize (c));
423
0
    case 8: return_trace (u.format8.sanitize (c));
424
0
    case 10: return_trace (u.format10.sanitize (c));
425
0
    default:return_trace (true);
426
0
    }
427
0
  }
Unexecuted instantiation: AAT::Lookup<OT::IntType<unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::Lookup<OT::IntType<unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: AAT::Lookup<OT::HBGlyphID16>::sanitize(hb_sanitize_context_t*) const
428
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
429
0
  {
430
0
    TRACE_SANITIZE (this);
431
0
    if (!u.format.sanitize (c)) return_trace (false);
432
0
    switch (u.format) {
433
0
    case 0: return_trace (u.format0.sanitize (c, base));
434
0
    case 2: return_trace (u.format2.sanitize (c, base));
435
0
    case 4: return_trace (u.format4.sanitize (c, base));
436
0
    case 6: return_trace (u.format6.sanitize (c, base));
437
0
    case 8: return_trace (u.format8.sanitize (c, base));
438
0
    case 10: return_trace (false); /* We don't support format10 here currently. */
439
0
    default:return_trace (true);
440
0
    }
441
0
  }
Unexecuted instantiation: AAT::Lookup<OT::OffsetTo<OT::ArrayOf<AAT::Anchor, OT::IntType<unsigned int, 4u> >, OT::IntType<unsigned short, 2u>, 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>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: AAT::Lookup<OT::OffsetTo<AAT::OpticalBounds, OT::IntType<unsigned short, 2u>, true> >::sanitize(hb_sanitize_context_t*, void const*) const
442
443
  protected:
444
  union {
445
  HBUINT16    format;   /* Format identifier */
446
  LookupFormat0<T>  format0;
447
  LookupFormat2<T>  format2;
448
  LookupFormat4<T>  format4;
449
  LookupFormat6<T>  format6;
450
  LookupFormat8<T>  format8;
451
  LookupFormat10<T> format10;
452
  } u;
453
  public:
454
  DEFINE_SIZE_UNION (2, format);
455
};
456
DECLARE_NULL_NAMESPACE_BYTES_TEMPLATE1 (AAT, Lookup, 2);
457
458
enum { DELETED_GLYPH = 0xFFFF };
459
460
/*
461
 * (Extended) State Table
462
 */
463
464
template <typename T>
465
struct Entry
466
{
467
  // This does seem like it's ever called.
468
  bool sanitize (hb_sanitize_context_t *c) const
469
  {
470
    TRACE_SANITIZE (this);
471
    /* Note, we don't recurse-sanitize data because we don't access it.
472
     * That said, in our DEFINE_SIZE_STATIC we access T::static_size,
473
     * which ensures that data has a simple sanitize(). To be determined
474
     * if I need to remove that as well.
475
     *
476
     * HOWEVER! Because we are a template, our DEFINE_SIZE_STATIC
477
     * assertion wouldn't be checked, hence the line below. */
478
    static_assert (T::static_size, "");
479
480
    return_trace (c->check_struct (this));
481
  }
482
483
  public:
484
  HBUINT16  newState; /* Byte offset from beginning of state table
485
         * to the new state. Really?!?! Or just state
486
         * number?  The latter in morx for sure. */
487
  HBUINT16  flags;    /* Table specific. */
488
  T   data;   /* Optional offsets to per-glyph tables. */
489
  public:
490
  DEFINE_SIZE_STATIC (4 + T::static_size);
491
};
492
493
template <>
494
struct Entry<void>
495
{
496
  // This does seem like it's ever called.
497
  bool sanitize (hb_sanitize_context_t *c) const
498
0
  {
499
0
    TRACE_SANITIZE (this);
500
0
    return_trace (c->check_struct (this));
501
0
  }
502
503
  public:
504
  HBUINT16  newState; /* Byte offset from beginning of state table to the new state. */
505
  HBUINT16  flags;    /* Table specific. */
506
  public:
507
  DEFINE_SIZE_STATIC (4);
508
};
509
510
template <typename Types, typename Extra>
511
struct StateTable
512
{
513
  typedef typename Types::HBUINT HBUINT;
514
  typedef typename Types::HBUSHORT HBUSHORT;
515
  typedef typename Types::ClassTypeNarrow ClassType;
516
517
  enum State
518
  {
519
    STATE_START_OF_TEXT = 0,
520
    STATE_START_OF_LINE = 1,
521
  };
522
  enum Class
523
  {
524
    CLASS_END_OF_TEXT = 0,
525
    CLASS_OUT_OF_BOUNDS = 1,
526
    CLASS_DELETED_GLYPH = 2,
527
    CLASS_END_OF_LINE = 3,
528
  };
529
530
  int new_state (unsigned int newState) const
531
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
532
533
  unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
534
0
  {
535
0
    if (unlikely (glyph_id == DELETED_GLYPH)) return CLASS_DELETED_GLYPH;
536
0
    return (this+classTable).get_class (glyph_id, num_glyphs, 1);
537
0
  }
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, void>::get_class(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, void>::get_class(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::ContextualSubtable<AAT::ExtendedTypes>::EntryData>::get_class(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::LigatureEntry<true>::EntryData>::get_class(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::InsertionSubtable<AAT::ExtendedTypes>::EntryData>::get_class(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, AAT::ContextualSubtable<AAT::ObsoleteTypes>::EntryData>::get_class(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ObsoleteTypes, AAT::InsertionSubtable<AAT::ObsoleteTypes>::EntryData>::get_class(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::Format1Entry<true>::EntryData>::get_class(unsigned int, unsigned int) const
Unexecuted instantiation: AAT::StateTable<AAT::ExtendedTypes, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::EntryData>::get_class(unsigned int, unsigned int) const
538
539
  const Entry<Extra> *get_entries () const
540
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
541
542
  const Entry<Extra> &get_entry (int state, unsigned int klass) const
543
0
  {
544
0
    if (unlikely (klass >= nClasses))
545
0
      klass = StateTable::CLASS_OUT_OF_BOUNDS;
546
547
0
    const HBUSHORT *states = (this+stateArrayTable).arrayZ;
548
0
    const Entry<Extra> *entries = (this+entryTable).arrayZ;
549
550
0
    unsigned int entry = states[state * nClasses + klass];
551
0
    DEBUG_MSG (APPLY, nullptr, "e%u", entry);
552
553
0
    return entries[entry];
554
0
  }
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
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
555
556
  bool sanitize (hb_sanitize_context_t *c,
557
     unsigned int *num_entries_out = nullptr) const
558
0
  {
559
0
    TRACE_SANITIZE (this);
560
0
    if (unlikely (!(c->check_struct (this) &&
561
0
        nClasses >= 4 /* Ensure pre-defined classes fit.  */ &&
562
0
        classTable.sanitize (c, this)))) return_trace (false);
563
564
0
    const HBUSHORT *states = (this+stateArrayTable).arrayZ;
565
0
    const Entry<Extra> *entries = (this+entryTable).arrayZ;
566
567
0
    unsigned int num_classes = nClasses;
568
0
    if (unlikely (hb_unsigned_mul_overflows (num_classes, states[0].static_size)))
569
0
      return_trace (false);
570
0
    unsigned int row_stride = num_classes * states[0].static_size;
571
572
    /* Apple 'kern' table has this peculiarity:
573
     *
574
     * "Because the stateTableOffset in the state table header is (strictly
575
     * speaking) redundant, some 'kern' tables use it to record an initial
576
     * state where that should not be StartOfText. To determine if this is
577
     * done, calculate what the stateTableOffset should be. If it's different
578
     * from the actual stateTableOffset, use it as the initial state."
579
     *
580
     * We implement this by calling the initial state zero, but allow *negative*
581
     * states if the start state indeed was not the first state.  Since the code
582
     * is shared, this will also apply to 'mort' table.  The 'kerx' / 'morx'
583
     * tables are not affected since those address states by index, not offset.
584
     */
585
586
0
    int min_state = 0;
587
0
    int max_state = 0;
588
0
    unsigned int num_entries = 0;
589
590
0
    int state_pos = 0;
591
0
    int state_neg = 0;
592
0
    unsigned int entry = 0;
593
0
    while (min_state < state_neg || state_pos <= max_state)
594
0
    {
595
0
      if (min_state < state_neg)
596
0
      {
597
  /* Negative states. */
598
0
  if (unlikely (hb_unsigned_mul_overflows (min_state, num_classes)))
599
0
    return_trace (false);
600
0
  if (unlikely (!c->check_range (&states[min_state * num_classes],
601
0
               -min_state,
602
0
               row_stride)))
603
0
    return_trace (false);
604
0
  if ((c->max_ops -= state_neg - min_state) <= 0)
605
0
    return_trace (false);
606
0
  { /* Sweep new states. */
607
0
    const HBUSHORT *stop = &states[min_state * num_classes];
608
0
    if (unlikely (stop > states))
609
0
      return_trace (false);
610
0
    for (const HBUSHORT *p = states; stop < p; p--)
611
0
      num_entries = hb_max (num_entries, *(p - 1) + 1u);
612
0
    state_neg = min_state;
613
0
  }
614
0
      }
615
616
0
      if (state_pos <= max_state)
617
0
      {
618
  /* Positive states. */
619
0
  if (unlikely (!c->check_range (states,
620
0
               max_state + 1,
621
0
               row_stride)))
622
0
    return_trace (false);
623
0
  if ((c->max_ops -= max_state - state_pos + 1) <= 0)
624
0
    return_trace (false);
625
0
  { /* Sweep new states. */
626
0
    if (unlikely (hb_unsigned_mul_overflows ((max_state + 1), num_classes)))
627
0
      return_trace (false);
628
0
    const HBUSHORT *stop = &states[(max_state + 1) * num_classes];
629
0
    if (unlikely (stop < states))
630
0
      return_trace (false);
631
0
    for (const HBUSHORT *p = &states[state_pos * num_classes]; p < stop; p++)
632
0
      num_entries = hb_max (num_entries, *p + 1u);
633
0
    state_pos = max_state + 1;
634
0
  }
635
0
      }
636
637
0
      if (unlikely (!c->check_array (entries, num_entries)))
638
0
  return_trace (false);
639
0
      if ((c->max_ops -= num_entries - entry) <= 0)
640
0
  return_trace (false);
641
0
      { /* Sweep new entries. */
642
0
  const Entry<Extra> *stop = &entries[num_entries];
643
0
  for (const Entry<Extra> *p = &entries[entry]; p < stop; p++)
644
0
  {
645
0
    int newState = new_state (p->newState);
646
0
    min_state = hb_min (min_state, newState);
647
0
    max_state = hb_max (max_state, newState);
648
0
  }
649
0
  entry = num_entries;
650
0
      }
651
0
    }
652
653
0
    if (num_entries_out)
654
0
      *num_entries_out = num_entries;
655
656
0
    return_trace (true);
657
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
658
659
  protected:
660
  HBUINT  nClasses; /* Number of classes, which is the number of indices
661
         * in a single line in the state array. */
662
  NNOffsetTo<ClassType, HBUINT>
663
    classTable; /* Offset to the class table. */
664
  NNOffsetTo<UnsizedArrayOf<HBUSHORT>, HBUINT>
665
    stateArrayTable;/* Offset to the state array. */
666
  NNOffsetTo<UnsizedArrayOf<Entry<Extra>>, HBUINT>
667
    entryTable; /* Offset to the entry array. */
668
669
  public:
670
  DEFINE_SIZE_STATIC (4 * sizeof (HBUINT));
671
};
672
673
template <typename HBUCHAR>
674
struct ClassTable
675
{
676
  unsigned int get_class (hb_codepoint_t glyph_id, unsigned int outOfRange) const
677
0
  {
678
0
    unsigned int i = glyph_id - firstGlyph;
679
0
    return i >= classArray.len ? outOfRange : classArray.arrayZ[i];
680
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
681
  unsigned int get_class (hb_codepoint_t glyph_id,
682
        unsigned int num_glyphs HB_UNUSED,
683
        unsigned int outOfRange) const
684
0
  {
685
0
    return get_class (glyph_id, outOfRange);
686
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
687
  bool sanitize (hb_sanitize_context_t *c) const
688
0
  {
689
0
    TRACE_SANITIZE (this);
690
0
    return_trace (c->check_struct (this) && classArray.sanitize (c));
691
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
692
  protected:
693
  HBGlyphID16   firstGlyph; /* First glyph index included in the trimmed array. */
694
  Array16Of<HBUCHAR>  classArray; /* The class codes (indexed by glyph index minus
695
           * firstGlyph). */
696
  public:
697
  DEFINE_SIZE_ARRAY (4, classArray);
698
};
699
700
struct ObsoleteTypes
701
{
702
  static constexpr bool extended = false;
703
  typedef HBUINT16 HBUINT;
704
  typedef HBUINT8 HBUSHORT;
705
  typedef ClassTable<HBUINT8> ClassTypeNarrow;
706
  typedef ClassTable<HBUINT16> ClassTypeWide;
707
708
  template <typename T>
709
  static unsigned int offsetToIndex (unsigned int offset,
710
             const void *base,
711
             const T *array)
712
0
  {
713
    /* https://github.com/harfbuzz/harfbuzz/issues/3483 */
714
    /* If offset is less than base, return an offset that would
715
     * result in an address half a 32bit address-space away,
716
     * to make sure sanitize fails even on 32bit builds. */
717
0
    if (unlikely (offset < unsigned ((const char *) array - (const char *) base)))
718
0
      return INT_MAX / T::static_size;
719
720
    /* https://github.com/harfbuzz/harfbuzz/issues/2816 */
721
0
    return (offset - unsigned ((const char *) array - (const char *) base)) / T::static_size;
722
0
  }
Unexecuted instantiation: unsigned int AAT::ObsoleteTypes::offsetToIndex<OT::IntType<short, 2u> >(unsigned int, void const*, OT::IntType<short, 2u> const*)
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*)
723
  template <typename T>
724
  static unsigned int byteOffsetToIndex (unsigned int offset,
725
           const void *base,
726
           const T *array)
727
0
  {
728
0
    return offsetToIndex (offset, base, array);
729
0
  }
730
  template <typename T>
731
  static unsigned int wordOffsetToIndex (unsigned int offset,
732
           const void *base,
733
           const T *array)
734
0
  {
735
0
    return offsetToIndex (2 * offset, base, array);
736
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*)
737
};
738
struct ExtendedTypes
739
{
740
  static constexpr bool extended = true;
741
  typedef HBUINT32 HBUINT;
742
  typedef HBUINT16 HBUSHORT;
743
  typedef Lookup<HBUINT16> ClassTypeNarrow;
744
  typedef Lookup<HBUINT16> ClassTypeWide;
745
746
  template <typename T>
747
  static unsigned int offsetToIndex (unsigned int offset,
748
             const void *base HB_UNUSED,
749
             const T *array HB_UNUSED)
750
0
  {
751
0
    return offset;
752
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*)
753
  template <typename T>
754
  static unsigned int byteOffsetToIndex (unsigned int offset,
755
           const void *base HB_UNUSED,
756
           const T *array HB_UNUSED)
757
0
  {
758
0
    return offset / 2;
759
0
  }
760
  template <typename T>
761
  static unsigned int wordOffsetToIndex (unsigned int offset,
762
           const void *base HB_UNUSED,
763
           const T *array HB_UNUSED)
764
0
  {
765
0
    return offset;
766
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*)
767
};
768
769
template <typename Types, typename EntryData>
770
struct StateTableDriver
771
{
772
  using StateTableT = StateTable<Types, EntryData>;
773
  using EntryT = Entry<EntryData>;
774
775
  StateTableDriver (const StateTableT &machine_,
776
        hb_buffer_t *buffer_,
777
        hb_face_t *face_) :
778
        machine (machine_),
779
        buffer (buffer_),
780
0
        num_glyphs (face_->get_num_glyphs ()) {}
Unexecuted instantiation: AAT::StateTableDriver<AAT::ExtendedTypes, void>::StateTableDriver(AAT::StateTable<AAT::ExtendedTypes, void> const&, hb_buffer_t*, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ExtendedTypes, AAT::ContextualSubtable<AAT::ExtendedTypes>::EntryData>::StateTableDriver(AAT::StateTable<AAT::ExtendedTypes, AAT::ContextualSubtable<AAT::ExtendedTypes>::EntryData> const&, hb_buffer_t*, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ExtendedTypes, AAT::LigatureEntry<true>::EntryData>::StateTableDriver(AAT::StateTable<AAT::ExtendedTypes, AAT::LigatureEntry<true>::EntryData> const&, hb_buffer_t*, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ExtendedTypes, AAT::InsertionSubtable<AAT::ExtendedTypes>::EntryData>::StateTableDriver(AAT::StateTable<AAT::ExtendedTypes, AAT::InsertionSubtable<AAT::ExtendedTypes>::EntryData> const&, hb_buffer_t*, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ObsoleteTypes, void>::StateTableDriver(AAT::StateTable<AAT::ObsoleteTypes, void> const&, hb_buffer_t*, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ObsoleteTypes, AAT::ContextualSubtable<AAT::ObsoleteTypes>::EntryData>::StateTableDriver(AAT::StateTable<AAT::ObsoleteTypes, AAT::ContextualSubtable<AAT::ObsoleteTypes>::EntryData> const&, hb_buffer_t*, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ObsoleteTypes, AAT::InsertionSubtable<AAT::ObsoleteTypes>::EntryData>::StateTableDriver(AAT::StateTable<AAT::ObsoleteTypes, AAT::InsertionSubtable<AAT::ObsoleteTypes>::EntryData> const&, hb_buffer_t*, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ExtendedTypes, AAT::Format1Entry<true>::EntryData>::StateTableDriver(AAT::StateTable<AAT::ExtendedTypes, AAT::Format1Entry<true>::EntryData> const&, hb_buffer_t*, hb_face_t*)
Unexecuted instantiation: AAT::StateTableDriver<AAT::ExtendedTypes, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::EntryData>::StateTableDriver(AAT::StateTable<AAT::ExtendedTypes, AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::EntryData> const&, hb_buffer_t*, hb_face_t*)
781
782
  template <typename context_t>
783
  void drive (context_t *c, hb_aat_apply_context_t *ac)
784
0
  {
785
0
    if (!c->in_place)
786
0
      buffer->clear_output ();
787
788
0
    int state = StateTableT::STATE_START_OF_TEXT;
789
    // If there's only one range, we already checked the flag.
790
0
    auto *last_range = ac->range_flags && (ac->range_flags->length > 1) ? &(*ac->range_flags)[0] : nullptr;
791
0
    for (buffer->idx = 0; buffer->successful;)
792
0
    {
793
      /* This block is copied in NoncontextualSubtable::apply. Keep in sync. */
794
0
      if (last_range)
795
0
      {
796
0
  auto *range = last_range;
797
0
  if (buffer->idx < buffer->len)
798
0
  {
799
0
    unsigned cluster = buffer->cur().cluster;
800
0
    while (cluster < range->cluster_first)
801
0
      range--;
802
0
    while (cluster > range->cluster_last)
803
0
      range++;
804
805
806
0
    last_range = range;
807
0
  }
808
0
  if (!(range->flags & ac->subtable_flags))
809
0
  {
810
0
    if (buffer->idx == buffer->len || unlikely (!buffer->successful))
811
0
      break;
812
813
0
    state = StateTableT::STATE_START_OF_TEXT;
814
0
    (void) buffer->next_glyph ();
815
0
    continue;
816
0
  }
817
0
      }
818
819
0
      unsigned int klass = buffer->idx < buffer->len ?
820
0
         machine.get_class (buffer->cur().codepoint, num_glyphs) :
821
0
         (unsigned) StateTableT::CLASS_END_OF_TEXT;
822
0
      DEBUG_MSG (APPLY, nullptr, "c%u at %u", klass, buffer->idx);
823
0
      const EntryT &entry = machine.get_entry (state, klass);
824
0
      const int next_state = machine.new_state (entry.newState);
825
826
      /* Conditions under which it's guaranteed safe-to-break before current glyph:
827
       *
828
       * 1. There was no action in this transition; and
829
       *
830
       * 2. If we break before current glyph, the results will be the same. That
831
       *    is guaranteed if:
832
       *
833
       *    2a. We were already in start-of-text state; or
834
       *
835
       *    2b. We are epsilon-transitioning to start-of-text state; or
836
       *
837
       *    2c. Starting from start-of-text state seeing current glyph:
838
       *
839
       *        2c'. There won't be any actions; and
840
       *
841
       *        2c". We would end up in the same state that we were going to end up
842
       *             in now, including whether epsilon-transitioning.
843
       *
844
       *    and
845
       *
846
       * 3. If we break before current glyph, there won't be any end-of-text action
847
       *    after previous glyph.
848
       *
849
       * This triples the transitions we need to look up, but is worth returning
850
       * granular unsafe-to-break results. See eg.:
851
       *
852
       *   https://github.com/harfbuzz/harfbuzz/issues/2860
853
       */
854
0
      const EntryT *wouldbe_entry;
855
0
      bool safe_to_break =
856
  /* 1. */
857
0
  !c->is_actionable (this, entry)
858
0
      &&
859
  /* 2. */
860
0
  (
861
    /* 2a. */
862
0
    state == StateTableT::STATE_START_OF_TEXT
863
0
  ||
864
    /* 2b. */
865
0
    (
866
0
      (entry.flags & context_t::DontAdvance) &&
867
0
      next_state == StateTableT::STATE_START_OF_TEXT
868
0
    )
869
0
  ||
870
    /* 2c. */
871
0
    (
872
0
      wouldbe_entry = &machine.get_entry (StateTableT::STATE_START_OF_TEXT, klass)
873
0
    ,
874
      /* 2c'. */
875
0
      !c->is_actionable (this, *wouldbe_entry)
876
0
    &&
877
      /* 2c". */
878
0
      (
879
0
        next_state == machine.new_state (wouldbe_entry->newState)
880
0
      &&
881
0
        (entry.flags & context_t::DontAdvance) == (wouldbe_entry->flags & context_t::DontAdvance)
882
0
      )
883
0
    )
884
0
  )
885
0
      &&
886
  /* 3. */
887
0
  !c->is_actionable (this, machine.get_entry (state, StateTableT::CLASS_END_OF_TEXT))
888
0
      ;
889
890
0
      if (!safe_to_break && buffer->backtrack_len () && buffer->idx < buffer->len)
891
0
  buffer->unsafe_to_break_from_outbuffer (buffer->backtrack_len () - 1, buffer->idx + 1);
892
893
0
      c->transition (this, entry);
894
895
0
      state = next_state;
896
0
      DEBUG_MSG (APPLY, nullptr, "s%d", state);
897
898
0
      if (buffer->idx == buffer->len || unlikely (!buffer->successful))
899
0
  break;
900
901
0
      if (!(entry.flags & context_t::DontAdvance) || buffer->max_ops-- <= 0)
902
0
  (void) buffer->next_glyph ();
903
0
    }
904
905
0
    if (!c->in_place)
906
0
      buffer->sync ();
907
0
  }
Unexecuted instantiation: void AAT::StateTableDriver<AAT::ObsoleteTypes, void>::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>::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>::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>::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>::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>::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>::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>::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>::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>::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>::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>::drive<AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::driver_context_t>(AAT::KerxSubTableFormat4<AAT::KerxSubTableHeader>::driver_context_t*, AAT::hb_aat_apply_context_t*)
908
909
  public:
910
  const StateTableT &machine;
911
  hb_buffer_t *buffer;
912
  unsigned int num_glyphs;
913
};
914
915
916
} /* namespace AAT */
917
918
919
#endif /* HB_AAT_LAYOUT_COMMON_HH */