Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/work/workdir/UnpackedTarball/harfbuzz/src/hb-ot-layout-gsubgpos.hh
Line
Count
Source
1
/*
2
 * Copyright © 2007,2008,2009,2010  Red Hat, Inc.
3
 * Copyright © 2010,2012  Google, Inc.
4
 *
5
 *  This is part of HarfBuzz, a text shaping library.
6
 *
7
 * Permission is hereby granted, without written agreement and without
8
 * license or royalty fees, to use, copy, modify, and distribute this
9
 * software and its documentation for any purpose, provided that the
10
 * above copyright notice and the following two paragraphs appear in
11
 * all copies of this software.
12
 *
13
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
17
 * DAMAGE.
18
 *
19
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
22
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24
 *
25
 * Red Hat Author(s): Behdad Esfahbod
26
 * Google Author(s): Behdad Esfahbod
27
 */
28
29
#ifndef HB_OT_LAYOUT_GSUBGPOS_HH
30
#define HB_OT_LAYOUT_GSUBGPOS_HH
31
32
#include "hb.hh"
33
#include "hb-buffer.hh"
34
#include "hb-map.hh"
35
#include "hb-set.hh"
36
#include "hb-ot-map.hh"
37
#include "hb-ot-layout-common.hh"
38
#include "hb-ot-layout-gdef-table.hh"
39
40
41
namespace OT {
42
43
44
struct hb_intersects_context_t :
45
       hb_dispatch_context_t<hb_intersects_context_t, bool>
46
{
47
  template <typename T>
48
0
  return_t dispatch (const T &obj) { return obj.intersects (this->glyphs); }
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::Layout::GPOS_impl::SinglePosFormat1 const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::Layout::GPOS_impl::SinglePosFormat2 const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::Layout::GPOS_impl::CursivePosFormat1 const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
49
0
  static return_t default_return_value () { return false; }
50
0
  bool stop_sublookup_iteration (return_t r) const { return r; }
51
52
  const hb_set_t *glyphs;
53
54
  hb_intersects_context_t (const hb_set_t *glyphs_) :
55
0
                            glyphs (glyphs_) {}
56
};
57
58
struct hb_have_non_1to1_context_t :
59
       hb_dispatch_context_t<hb_have_non_1to1_context_t, bool>
60
{
61
  template <typename T>
62
0
  return_t dispatch (const T &obj) { return obj.may_have_non_1to1 (); }
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
63
0
  static return_t default_return_value () { return false; }
64
0
  bool stop_sublookup_iteration (return_t r) const { return r; }
65
};
66
67
struct hb_closure_context_t :
68
       hb_dispatch_context_t<hb_closure_context_t>
69
{
70
  typedef return_t (*recurse_func_t) (hb_closure_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indicies, unsigned seq_index, unsigned end_index);
71
  template <typename T>
72
0
  return_t dispatch (const T &obj) { obj.closure (this); return hb_empty_t (); }
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
73
0
  static return_t default_return_value () { return hb_empty_t (); }
74
  void recurse (unsigned lookup_index, hb_set_t *covered_seq_indicies, unsigned seq_index, unsigned end_index)
75
0
  {
76
0
    if (unlikely (nesting_level_left == 0 || !recurse_func))
77
0
      return;
78
79
0
    nesting_level_left--;
80
0
    recurse_func (this, lookup_index, covered_seq_indicies, seq_index, end_index);
81
0
    nesting_level_left++;
82
0
  }
83
84
  void reset_lookup_visit_count ()
85
0
  { lookup_count = 0; }
86
87
  bool lookup_limit_exceeded ()
88
0
  { return lookup_count > HB_MAX_LOOKUP_VISIT_COUNT; }
89
90
  bool should_visit_lookup (unsigned int lookup_index)
91
0
  {
92
0
    if (lookup_count++ > HB_MAX_LOOKUP_VISIT_COUNT)
93
0
      return false;
94
95
0
    if (is_lookup_done (lookup_index))
96
0
      return false;
97
98
0
    return true;
99
0
  }
100
101
  bool is_lookup_done (unsigned int lookup_index)
102
0
  {
103
0
    if (unlikely (done_lookups_glyph_count->in_error () ||
104
0
      done_lookups_glyph_set->in_error ()))
105
0
      return true;
106
107
    /* Have we visited this lookup with the current set of glyphs? */
108
0
    if (done_lookups_glyph_count->get (lookup_index) != glyphs->get_population ())
109
0
    {
110
0
      done_lookups_glyph_count->set (lookup_index, glyphs->get_population ());
111
112
0
      if (!done_lookups_glyph_set->has (lookup_index))
113
0
      {
114
0
  if (unlikely (!done_lookups_glyph_set->set (lookup_index, hb::unique_ptr<hb_set_t> {hb_set_create ()})))
115
0
    return true;
116
0
      }
117
118
0
      done_lookups_glyph_set->get (lookup_index)->clear ();
119
0
    }
120
121
0
    hb_set_t *covered_glyph_set = done_lookups_glyph_set->get (lookup_index);
122
0
    if (unlikely (covered_glyph_set->in_error ()))
123
0
      return true;
124
0
    if (parent_active_glyphs ().is_subset (*covered_glyph_set))
125
0
      return true;
126
127
0
    covered_glyph_set->union_ (parent_active_glyphs ());
128
0
    return false;
129
0
  }
130
131
0
  const hb_set_t& previous_parent_active_glyphs () {
132
0
    if (active_glyphs_stack.length <= 1)
133
0
      return *glyphs;
134
135
0
    return active_glyphs_stack[active_glyphs_stack.length - 2];
136
0
  }
137
138
  const hb_set_t& parent_active_glyphs ()
139
0
  {
140
0
    if (!active_glyphs_stack)
141
0
      return *glyphs;
142
143
0
    return active_glyphs_stack.tail ();
144
0
  }
145
146
  hb_set_t* push_cur_active_glyphs ()
147
0
  {
148
0
    hb_set_t *s = active_glyphs_stack.push ();
149
0
    if (unlikely (active_glyphs_stack.in_error ()))
150
0
      return nullptr;
151
0
    return s;
152
0
  }
153
154
  bool pop_cur_done_glyphs ()
155
0
  {
156
0
    if (!active_glyphs_stack)
157
0
      return false;
158
159
0
    active_glyphs_stack.pop ();
160
0
    return true;
161
0
  }
162
163
  hb_face_t *face;
164
  hb_set_t *glyphs;
165
  hb_set_t output[1];
166
  hb_vector_t<hb_set_t> active_glyphs_stack;
167
  recurse_func_t recurse_func = nullptr;
168
  unsigned int nesting_level_left;
169
170
  hb_closure_context_t (hb_face_t *face_,
171
      hb_set_t *glyphs_,
172
      hb_map_t *done_lookups_glyph_count_,
173
      hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *done_lookups_glyph_set_,
174
      unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
175
0
        face (face_),
176
0
        glyphs (glyphs_),
177
0
        nesting_level_left (nesting_level_left_),
178
0
        done_lookups_glyph_count (done_lookups_glyph_count_),
179
0
        done_lookups_glyph_set (done_lookups_glyph_set_)
180
0
  {}
181
182
0
  ~hb_closure_context_t () { flush (); }
183
184
0
  void set_recurse_func (recurse_func_t func) { recurse_func = func; }
185
186
  void flush ()
187
0
  {
188
0
    output->del_range (face->get_num_glyphs (), HB_SET_VALUE_INVALID);  /* Remove invalid glyphs. */
189
0
    glyphs->union_ (*output);
190
0
    output->clear ();
191
0
    active_glyphs_stack.pop ();
192
0
    active_glyphs_stack.reset ();
193
0
  }
194
195
  private:
196
  hb_map_t *done_lookups_glyph_count;
197
  hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *done_lookups_glyph_set;
198
  unsigned int lookup_count = 0;
199
};
200
201
202
203
struct hb_closure_lookups_context_t :
204
       hb_dispatch_context_t<hb_closure_lookups_context_t>
205
{
206
  typedef return_t (*recurse_func_t) (hb_closure_lookups_context_t *c, unsigned lookup_index);
207
  template <typename T>
208
0
  return_t dispatch (const T &obj) { obj.closure_lookups (this); return hb_empty_t (); }
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::Layout::GPOS_impl::SinglePosFormat1 const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::Layout::GPOS_impl::SinglePosFormat2 const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::Layout::GPOS_impl::CursivePosFormat1 const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
209
0
  static return_t default_return_value () { return hb_empty_t (); }
210
  void recurse (unsigned lookup_index)
211
0
  {
212
0
    if (unlikely (nesting_level_left == 0 || !recurse_func))
213
0
      return;
214
215
    /* Return if new lookup was recursed to before. */
216
0
    if (lookup_limit_exceeded ()
217
0
        || visited_lookups->in_error ()
218
0
        || visited_lookups->has (lookup_index))
219
      // Don't increment lookup count here, that will be done in the call to closure_lookups()
220
      // made by recurse_func.
221
0
      return;
222
223
0
    nesting_level_left--;
224
0
    recurse_func (this, lookup_index);
225
0
    nesting_level_left++;
226
0
  }
227
228
  void set_lookup_visited (unsigned lookup_index)
229
0
  { visited_lookups->add (lookup_index); }
230
231
  void set_lookup_inactive (unsigned lookup_index)
232
0
  { inactive_lookups->add (lookup_index); }
233
234
  bool lookup_limit_exceeded ()
235
0
  {
236
0
    bool ret = lookup_count > HB_MAX_LOOKUP_VISIT_COUNT;
237
0
    if (ret)
238
0
      DEBUG_MSG (SUBSET, nullptr, "lookup visit count limit exceeded in lookup closure!");
239
0
    return ret; }
240
241
  bool is_lookup_visited (unsigned lookup_index)
242
0
  {
243
0
    if (unlikely (lookup_count++ > HB_MAX_LOOKUP_VISIT_COUNT))
244
0
    {
245
0
      DEBUG_MSG (SUBSET, nullptr, "total visited lookup count %u exceeds max limit, lookup %u is dropped.",
246
0
                 lookup_count, lookup_index);
247
0
      return true;
248
0
    }
249
250
0
    if (unlikely (visited_lookups->in_error ()))
251
0
      return true;
252
253
0
    return visited_lookups->has (lookup_index);
254
0
  }
255
256
  hb_face_t *face;
257
  const hb_set_t *glyphs;
258
  recurse_func_t recurse_func;
259
  unsigned int nesting_level_left;
260
261
  hb_closure_lookups_context_t (hb_face_t *face_,
262
        const hb_set_t *glyphs_,
263
        hb_set_t *visited_lookups_,
264
        hb_set_t *inactive_lookups_,
265
        unsigned nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
266
0
        face (face_),
267
0
        glyphs (glyphs_),
268
0
        recurse_func (nullptr),
269
0
        nesting_level_left (nesting_level_left_),
270
0
        visited_lookups (visited_lookups_),
271
0
        inactive_lookups (inactive_lookups_),
272
0
        lookup_count (0) {}
273
274
0
  void set_recurse_func (recurse_func_t func) { recurse_func = func; }
275
276
  private:
277
  hb_set_t *visited_lookups;
278
  hb_set_t *inactive_lookups;
279
  unsigned int lookup_count;
280
};
281
282
struct hb_would_apply_context_t :
283
       hb_dispatch_context_t<hb_would_apply_context_t, bool>
284
{
285
  template <typename T>
286
0
  return_t dispatch (const T &obj) { return obj.would_apply (this); }
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
287
0
  static return_t default_return_value () { return false; }
288
0
  bool stop_sublookup_iteration (return_t r) const { return r; }
289
290
  hb_face_t *face;
291
  const hb_codepoint_t *glyphs;
292
  unsigned int len;
293
  bool zero_context;
294
295
  hb_would_apply_context_t (hb_face_t *face_,
296
          const hb_codepoint_t *glyphs_,
297
          unsigned int len_,
298
          bool zero_context_) :
299
0
            face (face_),
300
0
            glyphs (glyphs_),
301
0
            len (len_),
302
0
            zero_context (zero_context_) {}
303
};
304
305
struct hb_collect_glyphs_context_t :
306
       hb_dispatch_context_t<hb_collect_glyphs_context_t>
307
{
308
  typedef return_t (*recurse_func_t) (hb_collect_glyphs_context_t *c, unsigned int lookup_index);
309
  template <typename T>
310
0
  return_t dispatch (const T &obj) { obj.collect_glyphs (this); return hb_empty_t (); }
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::Layout::GPOS_impl::SinglePosFormat1 const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::Layout::GPOS_impl::SinglePosFormat2 const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::Layout::GPOS_impl::CursivePosFormat1 const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
311
0
  static return_t default_return_value () { return hb_empty_t (); }
312
  void recurse (unsigned int lookup_index)
313
0
  {
314
0
    if (unlikely (nesting_level_left == 0 || !recurse_func))
315
0
      return;
316
317
    /* Note that GPOS sets recurse_func to nullptr already, so it doesn't get
318
     * past the previous check.  For GSUB, we only want to collect the output
319
     * glyphs in the recursion.  If output is not requested, we can go home now.
320
     *
321
     * Note further, that the above is not exactly correct.  A recursed lookup
322
     * is allowed to match input that is not matched in the context, but that's
323
     * not how most fonts are built.  It's possible to relax that and recurse
324
     * with all sets here if it proves to be an issue.
325
     */
326
327
0
    if (output == hb_set_get_empty ())
328
0
      return;
329
330
    /* Return if new lookup was recursed to before. */
331
0
    if (recursed_lookups->has (lookup_index))
332
0
      return;
333
334
0
    hb_set_t *old_before = before;
335
0
    hb_set_t *old_input  = input;
336
0
    hb_set_t *old_after  = after;
337
0
    before = input = after = hb_set_get_empty ();
338
339
0
    nesting_level_left--;
340
0
    recurse_func (this, lookup_index);
341
0
    nesting_level_left++;
342
343
0
    before = old_before;
344
0
    input  = old_input;
345
0
    after  = old_after;
346
347
0
    recursed_lookups->add (lookup_index);
348
0
  }
349
350
  hb_face_t *face;
351
  hb_set_t *before;
352
  hb_set_t *input;
353
  hb_set_t *after;
354
  hb_set_t *output;
355
  recurse_func_t recurse_func;
356
  hb_set_t *recursed_lookups;
357
  unsigned int nesting_level_left;
358
359
  hb_collect_glyphs_context_t (hb_face_t *face_,
360
             hb_set_t  *glyphs_before, /* OUT.  May be NULL */
361
             hb_set_t  *glyphs_input,  /* OUT.  May be NULL */
362
             hb_set_t  *glyphs_after,  /* OUT.  May be NULL */
363
             hb_set_t  *glyphs_output, /* OUT.  May be NULL */
364
             unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
365
0
            face (face_),
366
0
            before (glyphs_before ? glyphs_before : hb_set_get_empty ()),
367
0
            input  (glyphs_input  ? glyphs_input  : hb_set_get_empty ()),
368
0
            after  (glyphs_after  ? glyphs_after  : hb_set_get_empty ()),
369
0
            output (glyphs_output ? glyphs_output : hb_set_get_empty ()),
370
0
            recurse_func (nullptr),
371
0
            recursed_lookups (hb_set_create ()),
372
0
            nesting_level_left (nesting_level_left_) {}
373
0
  ~hb_collect_glyphs_context_t () { hb_set_destroy (recursed_lookups); }
374
375
0
  void set_recurse_func (recurse_func_t func) { recurse_func = func; }
376
};
377
378
379
380
template <typename set_t>
381
struct hb_collect_coverage_context_t :
382
       hb_dispatch_context_t<hb_collect_coverage_context_t<set_t>, const Coverage &>
383
{
384
  typedef const Coverage &return_t; // Stoopid that we have to dupe this here.
385
  template <typename T>
386
  return_t dispatch (const T &obj) { return obj.get_coverage (); }
387
  static return_t default_return_value () { return Null (Coverage); }
388
  bool stop_sublookup_iteration (return_t r) const
389
  {
390
    r.collect_coverage (set);
391
    return false;
392
  }
393
394
  hb_collect_coverage_context_t (set_t *set_) :
395
           set (set_) {}
396
397
  set_t *set;
398
};
399
400
struct matcher_t
401
{
402
  typedef bool (*match_func_t) (hb_glyph_info_t &info, unsigned value, const void *data);
403
404
  template <typename context_t>
405
  void init (const context_t *c, bool context_match = false)
406
144M
  {
407
144M
    set_match_func (nullptr, nullptr);
408
144M
    lookup_props = c->lookup_props;
409
    /* Ignore ZWNJ if we are matching GPOS, or matching GSUB context and asked to. */
410
144M
    ignore_zwnj = c->table_index == 1 || (context_match && c->auto_zwnj);
411
    /* Ignore ZWJ if we are matching context, or asked to. */
412
144M
    ignore_zwj = context_match || c->auto_zwj;
413
    /* Ignore hidden glyphs (like CGJ) during GPOS. */
414
144M
    ignore_hidden = c->table_index == 1;
415
144M
    mask = context_match ? -1 : c->lookup_mask;
416
    /* Per syllable matching is only for GSUB. */
417
144M
    per_syllable = c->table_index == 0 && c->per_syllable;
418
144M
    syllable = 0;
419
144M
  }
420
421
  void set_match_func (match_func_t match_func_,
422
           const void *match_data_)
423
147M
  { match_func = match_func_; match_data = match_data_; }
424
425
  enum may_match_t {
426
    MATCH_NO,
427
    MATCH_YES,
428
    MATCH_MAYBE
429
  };
430
431
#ifndef HB_OPTIMIZE_SIZE
432
  HB_ALWAYS_INLINE
433
#endif
434
  may_match_t may_match (hb_glyph_info_t &info,
435
       hb_codepoint_t glyph_data) const
436
21.0M
  {
437
21.0M
    if (!(info.mask & mask) ||
438
21.0M
  (per_syllable && syllable && syllable != info.syllable ()))
439
0
      return MATCH_NO;
440
441
21.0M
    if (match_func)
442
1.31M
      return match_func (info, glyph_data, match_data) ? MATCH_YES : MATCH_NO;
443
444
19.7M
    return MATCH_MAYBE;
445
21.0M
  }
446
447
  enum may_skip_t {
448
    SKIP_NO,
449
    SKIP_YES,
450
    SKIP_MAYBE
451
  };
452
453
  template <typename context_t>
454
#ifndef HB_OPTIMIZE_SIZE
455
  HB_ALWAYS_INLINE
456
#endif
457
  may_skip_t may_skip (const context_t *c,
458
           const hb_glyph_info_t &info) const
459
21.1M
  {
460
21.1M
    if (!c->check_glyph_property (&info, lookup_props))
461
124k
      return SKIP_YES;
462
463
21.0M
    if (unlikely (_hb_glyph_info_is_default_ignorable (&info) &&
464
21.0M
      (ignore_zwnj || !_hb_glyph_info_is_zwnj (&info)) &&
465
21.0M
      (ignore_zwj || !_hb_glyph_info_is_zwj (&info)) &&
466
21.0M
      (ignore_hidden || !_hb_glyph_info_is_hidden (&info))))
467
13.6k
      return SKIP_MAYBE;
468
469
21.0M
    return SKIP_NO;
470
21.0M
  }
471
472
  public:
473
  unsigned int lookup_props = 0;
474
  hb_mask_t mask = -1;
475
  bool ignore_zwnj = false;
476
  bool ignore_zwj = false;
477
  bool ignore_hidden = false;
478
  bool per_syllable = false;
479
  uint8_t syllable = 0;
480
  match_func_t match_func = nullptr;
481
  const void *match_data = nullptr;
482
};
483
484
template <typename context_t>
485
struct skipping_iterator_t
486
{
487
  void init (context_t *c_, bool context_match = false)
488
144M
  {
489
144M
    c = c_;
490
144M
    end = c->buffer->len;
491
144M
    match_glyph_data16 = nullptr;
492
#ifndef HB_NO_BEYOND_64K
493
    match_glyph_data24 = nullptr;
494
#endif
495
144M
    matcher.init (c, context_match);
496
144M
  }
497
  void set_lookup_props (unsigned int lookup_props)
498
595k
  {
499
595k
    matcher.lookup_props = lookup_props;
500
595k
  }
501
  void set_match_func (matcher_t::match_func_t match_func_,
502
           const void *match_data_)
503
2.26M
  {
504
2.26M
    matcher.set_match_func (match_func_, match_data_);
505
2.26M
  }
506
  void set_glyph_data (const HBUINT16 glyph_data[])
507
2.26M
  {
508
2.26M
    match_glyph_data16 = glyph_data;
509
#ifndef HB_NO_BEYOND_64K
510
    match_glyph_data24 = nullptr;
511
#endif
512
2.26M
  }
513
#ifndef HB_NO_BEYOND_64K
514
  void set_glyph_data (const HBUINT24 glyph_data[])
515
  {
516
    match_glyph_data16 = nullptr;
517
    match_glyph_data24 = glyph_data;
518
  }
519
#endif
520
521
#ifndef HB_OPTIMIZE_SIZE
522
  HB_ALWAYS_INLINE
523
#endif
524
  void reset (unsigned int start_index_)
525
1.40M
  {
526
    // For GSUB forward iterator
527
1.40M
    idx = start_index_;
528
1.40M
    end = c->buffer->len;
529
1.40M
    matcher.syllable = c->buffer->cur().syllable();
530
1.40M
  }
531
  void reset_back (unsigned int start_index_, bool from_out_buffer = false)
532
861k
  {
533
    // For GSUB backward iterator
534
861k
    idx = start_index_;
535
861k
    matcher.syllable = c->buffer->cur().syllable();
536
861k
  }
537
538
#ifndef HB_OPTIMIZE_SIZE
539
  HB_ALWAYS_INLINE
540
#endif
541
  void reset_fast (unsigned int start_index_)
542
21.3M
  {
543
    // Doesn't set end or syllable. Used by GPOS which doesn't care / change.
544
21.3M
    idx = start_index_;
545
21.3M
  }
546
547
#ifndef HB_OPTIMIZE_SIZE
548
  HB_ALWAYS_INLINE
549
#endif
550
  matcher_t::may_skip_t may_skip (const hb_glyph_info_t &info) const
551
33.2k
  { return matcher.may_skip (c, info); }
552
553
  enum match_t {
554
    MATCH,
555
    NOT_MATCH,
556
    SKIP
557
  };
558
559
#ifndef HB_OPTIMIZE_SIZE
560
  HB_ALWAYS_INLINE
561
#endif
562
  match_t match (hb_glyph_info_t &info)
563
21.1M
  {
564
21.1M
    matcher_t::may_skip_t skip = matcher.may_skip (c, info);
565
21.1M
    if (unlikely (skip == matcher_t::SKIP_YES))
566
124k
      return SKIP;
567
568
21.0M
    matcher_t::may_match_t match = matcher.may_match (info, get_glyph_data ());
569
21.0M
    if (match == matcher_t::MATCH_YES ||
570
20.7M
  (match == matcher_t::MATCH_MAYBE &&
571
19.7M
   skip == matcher_t::SKIP_NO))
572
20.0M
      return MATCH;
573
574
994k
    if (skip == matcher_t::SKIP_NO)
575
980k
      return NOT_MATCH;
576
577
13.5k
    return SKIP;
578
994k
  }
579
580
#ifndef HB_OPTIMIZE_SIZE
581
  HB_ALWAYS_INLINE
582
#endif
583
  bool next (unsigned *unsafe_to = nullptr)
584
22.5M
  {
585
22.5M
    auto *info = c->buffer->info;
586
22.5M
    const signed stop = (signed) end - 1;
587
22.5M
    while ((signed) idx < stop)
588
20.0M
    {
589
20.0M
      idx++;
590
20.0M
      switch (match (info[idx]))
591
20.0M
      {
592
19.4M
  case MATCH:
593
19.4M
  {
594
19.4M
    advance_glyph_data ();
595
19.4M
    return true;
596
0
  }
597
460k
  case NOT_MATCH:
598
460k
  {
599
460k
    if (unsafe_to)
600
460k
      *unsafe_to = idx + 1;
601
460k
    return false;
602
0
  }
603
73.4k
  case SKIP:
604
73.4k
    continue;
605
20.0M
      }
606
20.0M
    }
607
2.57M
    if (unsafe_to)
608
2.57M
      *unsafe_to = end;
609
2.57M
    return false;
610
22.5M
  }
611
#ifndef HB_OPTIMIZE_SIZE
612
  HB_ALWAYS_INLINE
613
#endif
614
  bool prev (unsigned *unsafe_from = nullptr)
615
1.15M
  {
616
1.15M
    auto *out_info = c->buffer->out_info;
617
1.15M
    const unsigned stop = 0;
618
1.15M
    while (idx > stop)
619
804k
    {
620
804k
      idx--;
621
804k
      switch (match (out_info[idx]))
622
804k
      {
623
282k
  case MATCH:
624
282k
  {
625
282k
    advance_glyph_data ();
626
282k
    return true;
627
0
  }
628
520k
  case NOT_MATCH:
629
520k
  {
630
520k
    if (unsafe_from)
631
520k
      *unsafe_from = hb_max (1u, idx) - 1u;
632
520k
    return false;
633
0
  }
634
1.24k
  case SKIP:
635
1.24k
    continue;
636
804k
      }
637
804k
    }
638
353k
    if (unsafe_from)
639
353k
      *unsafe_from = 0;
640
353k
    return false;
641
1.15M
  }
642
643
  HB_ALWAYS_INLINE
644
  hb_codepoint_t
645
  get_glyph_data ()
646
21.0M
  {
647
21.0M
    if (match_glyph_data16) return *match_glyph_data16;
648
#ifndef HB_NO_BEYOND_64K
649
    else
650
    if (match_glyph_data24) return *match_glyph_data24;
651
#endif
652
19.7M
    return 0;
653
21.0M
  }
654
  HB_ALWAYS_INLINE
655
  void
656
  advance_glyph_data ()
657
19.7M
  {
658
19.7M
    if (match_glyph_data16) match_glyph_data16++;
659
#ifndef HB_NO_BEYOND_64K
660
    else
661
    if (match_glyph_data24) match_glyph_data24++;
662
#endif
663
19.7M
  }
664
665
  unsigned int idx;
666
  protected:
667
  context_t *c;
668
  matcher_t matcher;
669
  const HBUINT16 *match_glyph_data16;
670
#ifndef HB_NO_BEYOND_64K
671
  const HBUINT24 *match_glyph_data24;
672
#endif
673
674
  unsigned int end;
675
};
676
677
struct hb_ot_apply_context_t :
678
       hb_dispatch_context_t<hb_ot_apply_context_t, bool, HB_DEBUG_APPLY>
679
{
680
0
  const char *get_name () { return "APPLY"; }
681
  typedef return_t (*recurse_func_t) (hb_ot_apply_context_t *c, unsigned int lookup_index);
682
683
  template <typename T>
684
  static inline auto apply_ (const T &obj, hb_ot_apply_context_t *c, hb_priority<1>) HB_RETURN (return_t, obj.apply (c, nullptr) )
685
  template <typename T>
686
  static inline auto apply_ (const T &obj, hb_ot_apply_context_t *c, hb_priority<0>) HB_RETURN (return_t, obj.apply (c) )
687
  template <typename T>
688
0
  return_t dispatch (const T &obj) { return apply_(obj, this, hb_prioritize); }
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::Layout::GPOS_impl::SinglePosFormat1 const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::Layout::GPOS_impl::SinglePosFormat2 const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::Layout::GPOS_impl::CursivePosFormat1 const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
689
690
0
  static return_t default_return_value () { return false; }
691
0
  bool stop_sublookup_iteration (return_t r) const { return r; }
692
  return_t recurse (unsigned int sub_lookup_index)
693
8.56k
  {
694
8.56k
    assert (recurse_func);
695
8.56k
    if (unlikely (nesting_level_left == 0))
696
0
    {
697
0
      buffer->successful = false;
698
0
      return default_return_value ();
699
0
    }
700
701
8.56k
    buffer->max_ops--;
702
8.56k
    if (unlikely (buffer->max_ops < 0))
703
0
    {
704
0
      buffer->successful = false;
705
0
      return default_return_value ();
706
0
    }
707
708
8.56k
    nesting_level_left--;
709
8.56k
    bool ret = recurse_func (this, sub_lookup_index);
710
8.56k
    nesting_level_left++;
711
8.56k
    return ret;
712
8.56k
  }
713
714
  skipping_iterator_t<hb_ot_apply_context_t> iter_input, iter_context;
715
716
  unsigned int table_index; /* GSUB/GPOS */
717
  hb_font_t *font;
718
  hb_face_t *face;
719
  hb_buffer_t *buffer;
720
  hb_sanitize_context_t sanitizer;
721
  recurse_func_t recurse_func = nullptr;
722
  const GDEF &gdef;
723
  const GDEF::accelerator_t &gdef_accel;
724
  const hb_ot_layout_lookup_accelerator_t *lookup_accel = nullptr;
725
  const ItemVariationStore &var_store;
726
  hb_scalar_cache_t *var_store_cache;
727
728
  hb_direction_t direction;
729
  hb_mask_t lookup_mask = 1;
730
  unsigned int lookup_index = (unsigned) -1;
731
  unsigned int lookup_props = 0;
732
  unsigned int nesting_level_left = HB_MAX_NESTING_LEVEL;
733
734
  bool has_glyph_classes;
735
  bool auto_zwnj = true;
736
  bool auto_zwj = true;
737
  bool per_syllable = false;
738
  bool random = false;
739
  unsigned new_syllables = (unsigned) -1;
740
741
  signed last_base = -1; // GPOS uses
742
  unsigned last_base_until = 0; // GPOS uses
743
744
  hb_vector_t<uint32_t> match_positions;
745
  uint32_t stack_match_positions[8];
746
#ifndef HB_NO_BUFFER_MESSAGE
747
  hb_buffer_t::changed_func_t orig_changed_func = nullptr;
748
  void *orig_changed_data = nullptr;
749
#endif
750
751
  hb_ot_apply_context_t (unsigned int table_index_,
752
       hb_font_t *font_,
753
       hb_buffer_t *buffer_,
754
       hb_blob_t *table_blob_,
755
       hb_scalar_cache_t *var_store_cache_ = nullptr) :
756
63.3M
      table_index (table_index_),
757
63.3M
      font (font_), face (font->face), buffer (buffer_),
758
63.3M
      sanitizer (table_blob_),
759
      gdef (
760
#ifndef HB_NO_OT_LAYOUT
761
63.3M
            *face->table.GDEF->table
762
#else
763
            Null (GDEF)
764
#endif
765
           ),
766
      gdef_accel (
767
#ifndef HB_NO_OT_LAYOUT
768
63.3M
            *face->table.GDEF
769
#else
770
            Null (GDEF::accelerator_t)
771
#endif
772
           ),
773
63.3M
      var_store (gdef.get_var_store ()),
774
63.3M
      var_store_cache (var_store_cache_),
775
63.3M
      direction (buffer_->props.direction),
776
63.3M
      has_glyph_classes (gdef.has_glyph_classes ())
777
63.3M
  {
778
63.3M
    init_iters ();
779
63.3M
    match_positions.set_storage (stack_match_positions);
780
781
63.3M
#ifndef HB_NO_BUFFER_MESSAGE
782
63.3M
    if (buffer->messaging ())
783
0
    {
784
0
      assert (buffer->changed_func == nullptr ||
785
0
        buffer->changed_func == buffer_changed_trampoline);
786
0
      orig_changed_func = buffer->changed_func;
787
0
      orig_changed_data = buffer->changed_data;
788
0
      buffer->changed_func = buffer_changed_trampoline;
789
0
      buffer->changed_data = this;
790
0
    }
791
63.3M
#endif
792
63.3M
  }
793
  ~hb_ot_apply_context_t ()
794
63.3M
  {
795
63.3M
#ifndef HB_NO_BUFFER_MESSAGE
796
63.3M
    if (buffer->messaging ())
797
0
    {
798
0
      assert (buffer->changed_func == buffer_changed_trampoline);
799
0
      assert (buffer->changed_data == this);
800
0
      buffer->changed_func = orig_changed_func;
801
0
      buffer->changed_data = orig_changed_data;
802
0
    }
803
63.3M
#endif
804
63.3M
  }
805
806
  void init_iters ()
807
72.3M
  {
808
72.3M
    iter_input.init (this, false);
809
72.3M
    iter_context.init (this, true);
810
72.3M
  }
811
812
8.32M
  void set_lookup_mask (hb_mask_t mask, bool init = true) { lookup_mask = mask; last_base = -1; last_base_until = 0; if (init) init_iters (); }
813
7.61M
  void set_auto_zwj (bool auto_zwj_, bool init = true) { auto_zwj = auto_zwj_; if (init) init_iters (); }
814
7.61M
  void set_auto_zwnj (bool auto_zwnj_, bool init = true) { auto_zwnj = auto_zwnj_; if (init) init_iters (); }
815
7.61M
  void set_per_syllable (bool per_syllable_, bool init = true) { per_syllable = per_syllable_; if (init) init_iters (); }
816
7.61M
  void set_random (bool random_) { random = random_; }
817
61.9M
  void set_recurse_func (recurse_func_t func) { recurse_func = func; }
818
7.63M
  void set_lookup_index (unsigned int lookup_index_) { lookup_index = lookup_index_; }
819
  void set_lookup_props (unsigned int lookup_props_)
820
8.34M
  {
821
8.34M
    lookup_props = gdef_accel.sanitize_lookup_props (lookup_props_);
822
8.34M
    init_iters ();
823
8.34M
  }
824
825
  uint32_t random_number ()
826
0
  {
827
    /* http://www.cplusplus.com/reference/random/minstd_rand/ */
828
0
    buffer->random_state = buffer->random_state * 48271 % 2147483647;
829
0
    return buffer->random_state;
830
0
  }
831
832
  static void buffer_changed_trampoline (hb_buffer_t *buffer HB_UNUSED, void *user_data)
833
0
  {
834
0
    ((hb_ot_apply_context_t *) user_data)->buffer_changed ();
835
0
  }
836
  void buffer_changed ()
837
0
  {
838
0
    buffer->update_digest ();
839
0
    if (likely (has_glyph_classes))
840
0
      for (unsigned i = 0; i < buffer->len; i++)
841
0
  _set_glyph_class_props (buffer->info[i]);
842
0
  }
843
844
  HB_ALWAYS_INLINE
845
  HB_HOT
846
  bool match_properties_mark (const hb_glyph_info_t *info,
847
            unsigned int    glyph_props,
848
            unsigned int    match_props) const
849
1.36M
  {
850
    /* If using mark filtering sets, the high short of
851
     * match_props has the set index.
852
     */
853
1.36M
    if (match_props & LookupFlag::UseMarkFilteringSet)
854
0
      return gdef_accel.mark_set_covers (match_props >> 16, info->codepoint);
855
856
    /* The second byte of match_props has the meaning
857
     * "ignore marks of attachment type different than
858
     * the attachment type specified."
859
     */
860
1.36M
    if (match_props & LookupFlag::MarkAttachmentType)
861
151
      return (match_props & LookupFlag::MarkAttachmentType) == (glyph_props & LookupFlag::MarkAttachmentType);
862
863
1.36M
    return true;
864
1.36M
  }
865
866
#ifndef HB_OPTIMIZE_SIZE
867
  HB_ALWAYS_INLINE
868
#endif
869
  bool check_glyph_property (const hb_glyph_info_t *info,
870
           unsigned match_props) const
871
183M
  {
872
183M
    unsigned int glyph_props = _hb_glyph_info_get_glyph_props (info);
873
874
    /* Not covered, if, for example, glyph class is ligature and
875
     * match_props includes LookupFlags::IgnoreLigatures
876
     */
877
183M
    if (glyph_props & match_props & LookupFlag::IgnoreFlags)
878
123k
      return false;
879
880
183M
    if (glyph_props & HB_OT_LAYOUT_GLYPH_PROPS_MARK)
881
1.36M
      return match_properties_mark (info, glyph_props, match_props);
882
883
182M
    return true;
884
183M
  }
885
886
  void _set_glyph_class (hb_codepoint_t glyph_index,
887
        unsigned int class_guess = 0,
888
        bool ligature = false,
889
        bool component = false)
890
29.0k
  {
891
29.0k
    buffer->digest.add (glyph_index);
892
893
29.0k
    if (new_syllables != (unsigned) -1)
894
0
      buffer->cur().syllable() = new_syllables;
895
896
29.0k
    unsigned int props = _hb_glyph_info_get_glyph_props (&buffer->cur());
897
29.0k
    props |= HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED;
898
29.0k
    if (ligature)
899
29.0k
    {
900
29.0k
      props |= HB_OT_LAYOUT_GLYPH_PROPS_LIGATED;
901
      /* In the only place that the MULTIPLIED bit is used, Uniscribe
902
       * seems to only care about the "last" transformation between
903
       * Ligature and Multiple substitutions.  Ie. if you ligate, expand,
904
       * and ligate again, it forgives the multiplication and acts as
905
       * if only ligation happened.  As such, clear MULTIPLIED bit.
906
       */
907
29.0k
      props &= ~HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED;
908
29.0k
    }
909
29.0k
    if (component)
910
0
      props |= HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED;
911
29.0k
    if (likely (has_glyph_classes))
912
29.0k
    {
913
29.0k
      _set_glyph_class_props (buffer->cur(), props, glyph_index);
914
29.0k
    }
915
0
    else if (class_guess)
916
0
    {
917
0
      props &= HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE;
918
0
      _hb_glyph_info_set_glyph_props (&buffer->cur(), props | class_guess);
919
0
    }
920
0
    else
921
0
      _hb_glyph_info_set_glyph_props (&buffer->cur(), props);
922
29.0k
  }
923
  void _set_glyph_class_props (hb_glyph_info_t &info,
924
             unsigned int props,
925
             hb_codepoint_t glyph_index)
926
29.0k
  {
927
29.0k
    props &= HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE;
928
29.0k
    _hb_glyph_info_set_glyph_props (&info, props | gdef_accel.get_glyph_props (glyph_index));
929
29.0k
  }
930
  void _set_glyph_class_props (hb_glyph_info_t &info)
931
0
  {
932
0
    _set_glyph_class_props (info,
933
0
          _hb_glyph_info_get_glyph_props (&info),
934
0
          info.codepoint);
935
0
  }
936
937
  void replace_glyph (hb_codepoint_t glyph_index)
938
0
  {
939
0
    _set_glyph_class (glyph_index);
940
0
    (void) buffer->replace_glyph (glyph_index);
941
0
  }
942
  void replace_glyph_inplace (hb_codepoint_t glyph_index)
943
0
  {
944
0
    _set_glyph_class (glyph_index);
945
0
    buffer->cur().codepoint = glyph_index;
946
0
  }
947
  void replace_glyph_with_ligature (hb_codepoint_t glyph_index,
948
            unsigned int class_guess)
949
29.0k
  {
950
29.0k
    _set_glyph_class (glyph_index, class_guess, true);
951
29.0k
    (void) buffer->replace_glyph (glyph_index);
952
29.0k
  }
953
  void output_glyph_for_component (hb_codepoint_t glyph_index,
954
           unsigned int class_guess)
955
0
  {
956
0
    _set_glyph_class (glyph_index, class_guess, false, true);
957
0
    (void) buffer->output_glyph (glyph_index);
958
0
  }
959
};
960
961
enum class hb_ot_subtable_cache_op_t
962
{
963
  ENTER,
964
  LEAVE,
965
};
966
967
struct hb_accelerate_subtables_context_t :
968
       hb_dispatch_context_t<hb_accelerate_subtables_context_t>
969
{
970
  template <typename T>
971
  static inline auto apply_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<1>) HB_RETURN (bool, obj->apply (c, external_cache) )
972
  template <typename T>
973
  static inline auto apply_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<0>) HB_RETURN (bool, obj->apply (c) )
974
  template <typename T>
975
  static inline bool apply_to (const void *obj, hb_ot_apply_context_t *c, void *external_cache)
976
163M
  {
977
163M
    const T *typed_obj = (const T *) obj;
978
163M
    return apply_ (typed_obj, c, external_cache, hb_prioritize);
979
163M
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::SinglePosFormat1>(void const*, OT::hb_ot_apply_context_t*, void*)
Line
Count
Source
976
1.02k
  {
977
1.02k
    const T *typed_obj = (const T *) obj;
978
1.02k
    return apply_ (typed_obj, c, external_cache, hb_prioritize);
979
1.02k
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::SinglePosFormat2>(void const*, OT::hb_ot_apply_context_t*, void*)
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Line
Count
Source
976
160M
  {
977
160M
    const T *typed_obj = (const T *) obj;
978
160M
    return apply_ (typed_obj, c, external_cache, hb_prioritize);
979
160M
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::CursivePosFormat1>(void const*, OT::hb_ot_apply_context_t*, void*)
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Line
Count
Source
976
500k
  {
977
500k
    const T *typed_obj = (const T *) obj;
978
500k
    return apply_ (typed_obj, c, external_cache, hb_prioritize);
979
500k
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Line
Count
Source
976
247k
  {
977
247k
    const T *typed_obj = (const T *) obj;
978
247k
    return apply_ (typed_obj, c, external_cache, hb_prioritize);
979
247k
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ContextFormat3>(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ChainContextFormat3>(void const*, OT::hb_ot_apply_context_t*, void*)
Line
Count
Source
976
2.00M
  {
977
2.00M
    const T *typed_obj = (const T *) obj;
978
2.00M
    return apply_ (typed_obj, c, external_cache, hb_prioritize);
979
2.00M
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Line
Count
Source
976
410k
  {
977
410k
    const T *typed_obj = (const T *) obj;
978
410k
    return apply_ (typed_obj, c, external_cache, hb_prioritize);
979
410k
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(void const*, OT::hb_ot_apply_context_t*, void*)
980
981
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
982
  template <typename T>
983
  static inline auto apply_cached_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<2>) HB_RETURN (bool, obj->apply_cached (c, external_cache) )
984
  template <typename T>
985
  static inline auto apply_cached_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<1>) HB_RETURN (bool, obj->apply (c, external_cache) )
986
  template <typename T>
987
  static inline auto apply_cached_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<0>) HB_RETURN (bool, obj->apply (c) )
988
  template <typename T>
989
  static inline bool apply_cached_to (const void *obj, hb_ot_apply_context_t *c, void *external_cache)
990
0
  {
991
0
    const T *typed_obj = (const T *) obj;
992
0
    return apply_cached_ (typed_obj, c, external_cache, hb_prioritize);
993
0
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::SinglePosFormat1>(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::SinglePosFormat2>(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::CursivePosFormat1>(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ContextFormat3>(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ChainContextFormat3>(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, void*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(void const*, OT::hb_ot_apply_context_t*, void*)
994
995
  template <typename T>
996
  static inline auto cache_func_ (hb_ot_apply_context_t *c,
997
          hb_ot_subtable_cache_op_t op,
998
          hb_priority<1>) HB_RETURN (bool, T::cache_func (c, op) )
999
  template <typename T=void>
1000
  static inline bool cache_func_ (hb_ot_apply_context_t *c,
1001
          hb_ot_subtable_cache_op_t op HB_UNUSED,
1002
0
          hb_priority<0>) { return false; }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::ContextFormat3>(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::ChainContextFormat3>(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t, hb_priority<0u>)
1003
  template <typename Type>
1004
  static inline bool cache_func_to (hb_ot_apply_context_t *c,
1005
            hb_ot_subtable_cache_op_t op)
1006
0
  {
1007
0
    return cache_func_<Type> (c, op, hb_prioritize);
1008
0
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ContextFormat3>(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ChainContextFormat3>(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
1009
#endif
1010
1011
  typedef bool (*hb_apply_func_t) (const void *obj, hb_ot_apply_context_t *c, void *external_cache);
1012
  typedef bool (*hb_cache_func_t) (hb_ot_apply_context_t *c, hb_ot_subtable_cache_op_t op);
1013
1014
  struct hb_applicable_t
1015
  {
1016
    friend struct hb_accelerate_subtables_context_t;
1017
    friend struct hb_ot_layout_lookup_accelerator_t;
1018
1019
    template <typename T>
1020
    void init (const T &obj_,
1021
         hb_apply_func_t apply_func_
1022
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1023
         , hb_apply_func_t apply_cached_func_
1024
         , hb_cache_func_t cache_func_
1025
         , void *external_cache_
1026
#endif
1027
    )
1028
1.69k
    {
1029
1.69k
      obj = &obj_;
1030
1.69k
      apply_func = apply_func_;
1031
1.69k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1032
1.69k
      apply_cached_func = apply_cached_func_;
1033
1.69k
      cache_func = cache_func_;
1034
1.69k
      external_cache = external_cache_;
1035
1.69k
#endif
1036
1.69k
      digest.init ();
1037
1.69k
      obj_.get_coverage ().collect_coverage (&digest);
1038
1.69k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::Layout::GPOS_impl::SinglePosFormat1 const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
Line
Count
Source
1028
4
    {
1029
4
      obj = &obj_;
1030
4
      apply_func = apply_func_;
1031
4
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1032
4
      apply_cached_func = apply_cached_func_;
1033
4
      cache_func = cache_func_;
1034
4
      external_cache = external_cache_;
1035
4
#endif
1036
4
      digest.init ();
1037
4
      obj_.get_coverage ().collect_coverage (&digest);
1038
4
    }
Unexecuted instantiation: void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::Layout::GPOS_impl::SinglePosFormat2 const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
Line
Count
Source
1028
53
    {
1029
53
      obj = &obj_;
1030
53
      apply_func = apply_func_;
1031
53
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1032
53
      apply_cached_func = apply_cached_func_;
1033
53
      cache_func = cache_func_;
1034
53
      external_cache = external_cache_;
1035
53
#endif
1036
53
      digest.init ();
1037
53
      obj_.get_coverage ().collect_coverage (&digest);
1038
53
    }
Unexecuted instantiation: void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
Unexecuted instantiation: void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::Layout::GPOS_impl::CursivePosFormat1 const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
Line
Count
Source
1028
562
    {
1029
562
      obj = &obj_;
1030
562
      apply_func = apply_func_;
1031
562
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1032
562
      apply_cached_func = apply_cached_func_;
1033
562
      cache_func = cache_func_;
1034
562
      external_cache = external_cache_;
1035
562
#endif
1036
562
      digest.init ();
1037
562
      obj_.get_coverage ().collect_coverage (&digest);
1038
562
    }
Unexecuted instantiation: void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
Line
Count
Source
1028
94
    {
1029
94
      obj = &obj_;
1030
94
      apply_func = apply_func_;
1031
94
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1032
94
      apply_cached_func = apply_cached_func_;
1033
94
      cache_func = cache_func_;
1034
94
      external_cache = external_cache_;
1035
94
#endif
1036
94
      digest.init ();
1037
94
      obj_.get_coverage ().collect_coverage (&digest);
1038
94
    }
Unexecuted instantiation: void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
Unexecuted instantiation: void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
Unexecuted instantiation: void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ContextFormat3>(OT::ContextFormat3 const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
Unexecuted instantiation: void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
Unexecuted instantiation: void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
Line
Count
Source
1028
902
    {
1029
902
      obj = &obj_;
1030
902
      apply_func = apply_func_;
1031
902
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1032
902
      apply_cached_func = apply_cached_func_;
1033
902
      cache_func = cache_func_;
1034
902
      external_cache = external_cache_;
1035
902
#endif
1036
902
      digest.init ();
1037
902
      obj_.get_coverage ().collect_coverage (&digest);
1038
902
    }
Unexecuted instantiation: void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
Unexecuted instantiation: void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
Unexecuted instantiation: void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
Unexecuted instantiation: void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
Line
Count
Source
1028
75
    {
1029
75
      obj = &obj_;
1030
75
      apply_func = apply_func_;
1031
75
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1032
75
      apply_cached_func = apply_cached_func_;
1033
75
      cache_func = cache_func_;
1034
75
      external_cache = external_cache_;
1035
75
#endif
1036
75
      digest.init ();
1037
75
      obj_.get_coverage ().collect_coverage (&digest);
1038
75
    }
Unexecuted instantiation: void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&, bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(void const*, OT::hb_ot_apply_context_t*, void*), bool (*)(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t), void*)
1039
1040
#ifdef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1041
    bool apply (hb_ot_apply_context_t *c) const
1042
    {
1043
      return digest.may_have (c->buffer->cur().codepoint) && apply_func (obj, c, nullptr);
1044
    }
1045
#else
1046
    bool apply (hb_ot_apply_context_t *c) const
1047
163M
    {
1048
163M
      return digest.may_have (c->buffer->cur().codepoint) && apply_func (obj, c, external_cache);
1049
163M
    }
1050
    bool apply_cached (hb_ot_apply_context_t *c) const
1051
0
    {
1052
0
      return digest.may_have (c->buffer->cur().codepoint) &&  apply_cached_func (obj, c, external_cache);
1053
0
    }
1054
1055
    bool cache_enter (hb_ot_apply_context_t *c) const
1056
0
    {
1057
0
      return cache_func (c, hb_ot_subtable_cache_op_t::ENTER);
1058
0
    }
1059
    void cache_leave (hb_ot_apply_context_t *c) const
1060
0
    {
1061
0
      cache_func (c, hb_ot_subtable_cache_op_t::LEAVE);
1062
0
    }
1063
#endif
1064
1065
    private:
1066
    const void *obj;
1067
    hb_apply_func_t apply_func;
1068
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1069
    hb_apply_func_t apply_cached_func;
1070
    hb_cache_func_t cache_func;
1071
    void *external_cache;
1072
#endif
1073
    hb_set_digest_t digest;
1074
  };
1075
1076
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1077
  template <typename T>
1078
  auto cache_cost (const T &obj, hb_priority<1>) HB_AUTO_RETURN ( obj.cache_cost () )
1079
  template <typename T>
1080
  auto cache_cost (const T &obj, hb_priority<0>) HB_AUTO_RETURN ( 0u )
1081
1082
  template <typename T>
1083
  auto external_cache_create (const T &obj, hb_priority<1>) HB_AUTO_RETURN ( obj.external_cache_create () )
1084
  template <typename T>
1085
  auto external_cache_create (const T &obj, hb_priority<0>) HB_AUTO_RETURN ( nullptr )
1086
#endif
1087
1088
  /* Dispatch interface. */
1089
  template <typename T>
1090
  return_t dispatch (const T &obj)
1091
1.69k
  {
1092
1.69k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1093
1.69k
    void *external_cache = nullptr;
1094
1.69k
    if (i < 8)
1095
1.58k
      external_cache = external_cache_create (obj, hb_prioritize);
1096
1.69k
#endif
1097
1098
1.69k
    hb_applicable_t *entry = &array[i++];
1099
1100
1.69k
    entry->init (obj,
1101
1.69k
     apply_to<T>
1102
1.69k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1103
1.69k
     , apply_cached_to<T>
1104
1.69k
     , cache_func_to<T>
1105
1.69k
     , external_cache
1106
1.69k
#endif
1107
1.69k
     );
1108
1109
1.69k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1110
    /* Cache handling
1111
     *
1112
     * We allow one subtable from each lookup to use a cache. The assumption
1113
     * being that multiple subtables of the same lookup cannot use a cache
1114
     * because the resources they would use will collide.  As such, we ask
1115
     * each subtable to tell us how much it costs (which a cache would avoid),
1116
     * and we allocate the cache opportunity to the costliest subtable.
1117
     */
1118
1.69k
    unsigned cost = cache_cost (obj, hb_prioritize);
1119
1.69k
    if (cost > subtable_cache_user_cost)
1120
0
    {
1121
0
      subtable_cache_user_idx = i - 1;
1122
0
      subtable_cache_user_cost = cost;
1123
0
    }
1124
1.69k
#endif
1125
1126
1.69k
    return hb_empty_t ();
1127
1.69k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::Layout::GPOS_impl::SinglePosFormat1 const&)
Line
Count
Source
1091
4
  {
1092
4
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1093
4
    void *external_cache = nullptr;
1094
4
    if (i < 8)
1095
4
      external_cache = external_cache_create (obj, hb_prioritize);
1096
4
#endif
1097
1098
4
    hb_applicable_t *entry = &array[i++];
1099
1100
4
    entry->init (obj,
1101
4
     apply_to<T>
1102
4
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1103
4
     , apply_cached_to<T>
1104
4
     , cache_func_to<T>
1105
4
     , external_cache
1106
4
#endif
1107
4
     );
1108
1109
4
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1110
    /* Cache handling
1111
     *
1112
     * We allow one subtable from each lookup to use a cache. The assumption
1113
     * being that multiple subtables of the same lookup cannot use a cache
1114
     * because the resources they would use will collide.  As such, we ask
1115
     * each subtable to tell us how much it costs (which a cache would avoid),
1116
     * and we allocate the cache opportunity to the costliest subtable.
1117
     */
1118
4
    unsigned cost = cache_cost (obj, hb_prioritize);
1119
4
    if (cost > subtable_cache_user_cost)
1120
0
    {
1121
0
      subtable_cache_user_idx = i - 1;
1122
0
      subtable_cache_user_cost = cost;
1123
0
    }
1124
4
#endif
1125
1126
4
    return hb_empty_t ();
1127
4
  }
Unexecuted instantiation: hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::Layout::GPOS_impl::SinglePosFormat2 const&)
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> const&)
Line
Count
Source
1091
53
  {
1092
53
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1093
53
    void *external_cache = nullptr;
1094
53
    if (i < 8)
1095
53
      external_cache = external_cache_create (obj, hb_prioritize);
1096
53
#endif
1097
1098
53
    hb_applicable_t *entry = &array[i++];
1099
1100
53
    entry->init (obj,
1101
53
     apply_to<T>
1102
53
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1103
53
     , apply_cached_to<T>
1104
53
     , cache_func_to<T>
1105
53
     , external_cache
1106
53
#endif
1107
53
     );
1108
1109
53
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1110
    /* Cache handling
1111
     *
1112
     * We allow one subtable from each lookup to use a cache. The assumption
1113
     * being that multiple subtables of the same lookup cannot use a cache
1114
     * because the resources they would use will collide.  As such, we ask
1115
     * each subtable to tell us how much it costs (which a cache would avoid),
1116
     * and we allocate the cache opportunity to the costliest subtable.
1117
     */
1118
53
    unsigned cost = cache_cost (obj, hb_prioritize);
1119
53
    if (cost > subtable_cache_user_cost)
1120
0
    {
1121
0
      subtable_cache_user_idx = i - 1;
1122
0
      subtable_cache_user_cost = cost;
1123
0
    }
1124
53
#endif
1125
1126
53
    return hb_empty_t ();
1127
53
  }
Unexecuted instantiation: hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::Layout::GPOS_impl::CursivePosFormat1 const&)
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> const&)
Line
Count
Source
1091
562
  {
1092
562
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1093
562
    void *external_cache = nullptr;
1094
562
    if (i < 8)
1095
562
      external_cache = external_cache_create (obj, hb_prioritize);
1096
562
#endif
1097
1098
562
    hb_applicable_t *entry = &array[i++];
1099
1100
562
    entry->init (obj,
1101
562
     apply_to<T>
1102
562
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1103
562
     , apply_cached_to<T>
1104
562
     , cache_func_to<T>
1105
562
     , external_cache
1106
562
#endif
1107
562
     );
1108
1109
562
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1110
    /* Cache handling
1111
     *
1112
     * We allow one subtable from each lookup to use a cache. The assumption
1113
     * being that multiple subtables of the same lookup cannot use a cache
1114
     * because the resources they would use will collide.  As such, we ask
1115
     * each subtable to tell us how much it costs (which a cache would avoid),
1116
     * and we allocate the cache opportunity to the costliest subtable.
1117
     */
1118
562
    unsigned cost = cache_cost (obj, hb_prioritize);
1119
562
    if (cost > subtable_cache_user_cost)
1120
0
    {
1121
0
      subtable_cache_user_idx = i - 1;
1122
0
      subtable_cache_user_cost = cost;
1123
0
    }
1124
562
#endif
1125
1126
562
    return hb_empty_t ();
1127
562
  }
Unexecuted instantiation: hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> const&)
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> const&)
Line
Count
Source
1091
94
  {
1092
94
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1093
94
    void *external_cache = nullptr;
1094
94
    if (i < 8)
1095
94
      external_cache = external_cache_create (obj, hb_prioritize);
1096
94
#endif
1097
1098
94
    hb_applicable_t *entry = &array[i++];
1099
1100
94
    entry->init (obj,
1101
94
     apply_to<T>
1102
94
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1103
94
     , apply_cached_to<T>
1104
94
     , cache_func_to<T>
1105
94
     , external_cache
1106
94
#endif
1107
94
     );
1108
1109
94
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1110
    /* Cache handling
1111
     *
1112
     * We allow one subtable from each lookup to use a cache. The assumption
1113
     * being that multiple subtables of the same lookup cannot use a cache
1114
     * because the resources they would use will collide.  As such, we ask
1115
     * each subtable to tell us how much it costs (which a cache would avoid),
1116
     * and we allocate the cache opportunity to the costliest subtable.
1117
     */
1118
94
    unsigned cost = cache_cost (obj, hb_prioritize);
1119
94
    if (cost > subtable_cache_user_cost)
1120
0
    {
1121
0
      subtable_cache_user_idx = i - 1;
1122
0
      subtable_cache_user_cost = cost;
1123
0
    }
1124
94
#endif
1125
1126
94
    return hb_empty_t ();
1127
94
  }
Unexecuted instantiation: hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Line
Count
Source
1091
902
  {
1092
902
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1093
902
    void *external_cache = nullptr;
1094
902
    if (i < 8)
1095
792
      external_cache = external_cache_create (obj, hb_prioritize);
1096
902
#endif
1097
1098
902
    hb_applicable_t *entry = &array[i++];
1099
1100
902
    entry->init (obj,
1101
902
     apply_to<T>
1102
902
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1103
902
     , apply_cached_to<T>
1104
902
     , cache_func_to<T>
1105
902
     , external_cache
1106
902
#endif
1107
902
     );
1108
1109
902
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1110
    /* Cache handling
1111
     *
1112
     * We allow one subtable from each lookup to use a cache. The assumption
1113
     * being that multiple subtables of the same lookup cannot use a cache
1114
     * because the resources they would use will collide.  As such, we ask
1115
     * each subtable to tell us how much it costs (which a cache would avoid),
1116
     * and we allocate the cache opportunity to the costliest subtable.
1117
     */
1118
902
    unsigned cost = cache_cost (obj, hb_prioritize);
1119
902
    if (cost > subtable_cache_user_cost)
1120
0
    {
1121
0
      subtable_cache_user_idx = i - 1;
1122
0
      subtable_cache_user_cost = cost;
1123
0
    }
1124
902
#endif
1125
1126
902
    return hb_empty_t ();
1127
902
  }
Unexecuted instantiation: hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Line
Count
Source
1091
75
  {
1092
75
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1093
75
    void *external_cache = nullptr;
1094
75
    if (i < 8)
1095
75
      external_cache = external_cache_create (obj, hb_prioritize);
1096
75
#endif
1097
1098
75
    hb_applicable_t *entry = &array[i++];
1099
1100
75
    entry->init (obj,
1101
75
     apply_to<T>
1102
75
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1103
75
     , apply_cached_to<T>
1104
75
     , cache_func_to<T>
1105
75
     , external_cache
1106
75
#endif
1107
75
     );
1108
1109
75
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1110
    /* Cache handling
1111
     *
1112
     * We allow one subtable from each lookup to use a cache. The assumption
1113
     * being that multiple subtables of the same lookup cannot use a cache
1114
     * because the resources they would use will collide.  As such, we ask
1115
     * each subtable to tell us how much it costs (which a cache would avoid),
1116
     * and we allocate the cache opportunity to the costliest subtable.
1117
     */
1118
75
    unsigned cost = cache_cost (obj, hb_prioritize);
1119
75
    if (cost > subtable_cache_user_cost)
1120
0
    {
1121
0
      subtable_cache_user_idx = i - 1;
1122
0
      subtable_cache_user_cost = cost;
1123
0
    }
1124
75
#endif
1125
1126
75
    return hb_empty_t ();
1127
75
  }
Unexecuted instantiation: hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
1128
986
  static return_t default_return_value () { return hb_empty_t (); }
1129
1130
  hb_accelerate_subtables_context_t (hb_applicable_t *array_) :
1131
986
             array (array_) {}
1132
1133
  hb_applicable_t *array;
1134
  unsigned i = 0;
1135
1136
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1137
  unsigned subtable_cache_user_idx = (unsigned) -1;
1138
  unsigned subtable_cache_user_cost = 0;
1139
#endif
1140
};
1141
1142
1143
typedef bool (*intersects_func_t) (const hb_set_t *glyphs, unsigned value, const void *data, void *cache);
1144
typedef void (*intersected_glyphs_func_t) (const hb_set_t *glyphs, const void *data, unsigned value, hb_set_t *intersected_glyphs, void *cache);
1145
typedef void (*collect_glyphs_func_t) (hb_set_t *glyphs, unsigned value, const void *data);
1146
typedef bool (*match_func_t) (hb_glyph_info_t &info, unsigned value, const void *data);
1147
1148
struct ContextClosureFuncs
1149
{
1150
  intersects_func_t intersects;
1151
  intersected_glyphs_func_t intersected_glyphs;
1152
};
1153
struct ContextCollectGlyphsFuncs
1154
{
1155
  collect_glyphs_func_t collect;
1156
};
1157
struct ContextApplyFuncs
1158
{
1159
  match_func_t match;
1160
};
1161
struct ChainContextApplyFuncs
1162
{
1163
  match_func_t match[3];
1164
};
1165
1166
1167
static inline bool intersects_glyph (const hb_set_t *glyphs, unsigned value, const void *data HB_UNUSED, void *cache HB_UNUSED)
1168
0
{
1169
0
  return glyphs->has (value);
1170
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-face.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-layout.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: gsubgpos-context.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
1171
static inline bool intersects_class (const hb_set_t *glyphs, unsigned value, const void *data, void *cache)
1172
0
{
1173
0
  const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
1174
0
  hb_map_t *map = (hb_map_t *) cache;
1175
1176
0
  hb_codepoint_t *cached_v;
1177
0
  if (map->has (value, &cached_v))
1178
0
    return *cached_v;
1179
1180
0
  bool v = class_def.intersects_class (glyphs, value);
1181
0
  map->set (value, v);
1182
1183
0
  return v;
1184
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-face.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-layout.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: gsubgpos-context.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
1185
static inline bool intersects_coverage (const hb_set_t *glyphs, unsigned value, const void *data, void *cache HB_UNUSED)
1186
0
{
1187
0
  Offset16To<Coverage> coverage;
1188
0
  coverage = value;
1189
0
  return (data+coverage).intersects (glyphs);
1190
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-face.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-layout.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: gsubgpos-context.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
1191
1192
1193
static inline void intersected_glyph (const hb_set_t *glyphs HB_UNUSED, const void *data, unsigned value, hb_set_t *intersected_glyphs, HB_UNUSED void *cache)
1194
0
{
1195
0
  unsigned g = reinterpret_cast<const HBUINT16 *>(data)[value];
1196
0
  intersected_glyphs->add (g);
1197
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-face.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-layout.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: gsubgpos-context.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
1198
1199
using intersected_class_cache_t = hb_hashmap_t<unsigned, hb_set_t>;
1200
1201
static inline void intersected_class_glyphs (const hb_set_t *glyphs, const void *data, unsigned value, hb_set_t *intersected_glyphs, void *cache)
1202
0
{
1203
0
  const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
1204
1205
0
  intersected_class_cache_t *map = (intersected_class_cache_t *) cache;
1206
1207
0
  hb_set_t *cached_v;
1208
0
  if (map->has (value, &cached_v))
1209
0
  {
1210
0
    intersected_glyphs->union_ (*cached_v);
1211
0
    return;
1212
0
  }
1213
1214
0
  hb_set_t v;
1215
0
  class_def.intersected_class_glyphs (glyphs, value, &v);
1216
1217
0
  intersected_glyphs->union_ (v);
1218
1219
0
  map->set (value, std::move (v));
1220
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-face.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-layout.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: gsubgpos-context.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
1221
1222
static inline void intersected_coverage_glyphs (const hb_set_t *glyphs, const void *data, unsigned value, hb_set_t *intersected_glyphs, HB_UNUSED void *cache)
1223
0
{
1224
0
  Offset16To<Coverage> coverage;
1225
0
  coverage = value;
1226
0
  (data+coverage).intersect_set (*glyphs, *intersected_glyphs);
1227
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-face.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-layout.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: gsubgpos-context.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
1228
1229
1230
template <typename HBUINT>
1231
static inline bool array_is_subset_of (const hb_set_t *glyphs,
1232
               unsigned int count,
1233
               const HBUINT values[],
1234
               intersects_func_t intersects_func,
1235
               const void *intersects_data,
1236
               void *cache)
1237
0
{
1238
0
  for (const auto &_ : + hb_iter (values, count))
1239
0
    if (!intersects_func (glyphs, _, intersects_data, cache)) return false;
1240
0
  return true;
1241
0
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::array_is_subset_of<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::array_is_subset_of<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::array_is_subset_of<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::array_is_subset_of<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::array_is_subset_of<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-subset.cc:bool OT::array_is_subset_of<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-subset-plan-layout.cc:bool OT::array_is_subset_of<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-subset-table-layout.cc:bool OT::array_is_subset_of<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-subset-table-var.cc:bool OT::array_is_subset_of<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-subset-table-cff.cc:bool OT::array_is_subset_of<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-subset-table-color.cc:bool OT::array_is_subset_of<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-subset-table-other.cc:bool OT::array_is_subset_of<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: gsubgpos-context.cc:bool OT::array_is_subset_of<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
1242
1243
1244
static inline void collect_glyph (hb_set_t *glyphs, unsigned value, const void *data HB_UNUSED)
1245
0
{
1246
0
  glyphs->add (value);
1247
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-layout.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: gsubgpos-context.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
1248
static inline void collect_class (hb_set_t *glyphs, unsigned value, const void *data)
1249
0
{
1250
0
  const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
1251
0
  class_def.collect_class (glyphs, value);
1252
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-layout.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: gsubgpos-context.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
1253
static inline void collect_coverage (hb_set_t *glyphs, unsigned value, const void *data)
1254
0
{
1255
0
  Offset16To<Coverage> coverage;
1256
0
  coverage = value;
1257
0
  (data+coverage).collect_coverage (glyphs);
1258
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-layout.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: gsubgpos-context.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
1259
template <typename HBUINT>
1260
static inline void collect_array (hb_collect_glyphs_context_t *c HB_UNUSED,
1261
          hb_set_t *glyphs,
1262
          unsigned int count,
1263
          const HBUINT values[],
1264
          collect_glyphs_func_t collect_func,
1265
          const void *collect_data)
1266
0
{
1267
0
  return
1268
0
  + hb_iter (values, count)
1269
0
  | hb_apply ([&] (const HBUINT &_) { collect_func (glyphs, _, collect_data); })
1270
0
  ;
1271
0
}
Unexecuted instantiation: hb-aat-layout.cc:void OT::collect_array<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-face.cc:void OT::collect_array<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-layout.cc:void OT::collect_array<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::collect_array<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::collect_array<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-subset.cc:void OT::collect_array<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:void OT::collect_array<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-subset-table-layout.cc:void OT::collect_array<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-subset-table-var.cc:void OT::collect_array<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-subset-table-cff.cc:void OT::collect_array<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-subset-table-color.cc:void OT::collect_array<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-subset-table-other.cc:void OT::collect_array<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: gsubgpos-context.cc:void OT::collect_array<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
1272
1273
1274
static inline bool match_always (hb_glyph_info_t &info HB_UNUSED, unsigned value HB_UNUSED, const void *data HB_UNUSED)
1275
33.2k
{
1276
33.2k
  return true;
1277
33.2k
}
Unexecuted instantiation: hb-aat-layout.cc:OT::match_always(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::match_always(hb_glyph_info_t&, unsigned int, void const*)
hb-ot-layout.cc:OT::match_always(hb_glyph_info_t&, unsigned int, void const*)
Line
Count
Source
1275
33.2k
{
1276
33.2k
  return true;
1277
33.2k
}
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::match_always(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::match_always(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset.cc:OT::match_always(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::match_always(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::match_always(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::match_always(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::match_always(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::match_always(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::match_always(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: gsubgpos-context.cc:OT::match_always(hb_glyph_info_t&, unsigned int, void const*)
1278
static inline bool match_glyph (hb_glyph_info_t &info, unsigned value, const void *data HB_UNUSED)
1279
208k
{
1280
208k
  return info.codepoint == value;
1281
208k
}
Unexecuted instantiation: hb-aat-layout.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
hb-ot-layout.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
Line
Count
Source
1279
208k
{
1280
208k
  return info.codepoint == value;
1281
208k
}
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: gsubgpos-context.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
1282
static inline bool match_class (hb_glyph_info_t &info, unsigned value, const void *data)
1283
0
{
1284
0
  const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
1285
0
  return class_def.get_class (info.codepoint) == value;
1286
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-layout.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: gsubgpos-context.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
1287
static inline unsigned get_class_cached (const ClassDef &class_def, hb_glyph_info_t &info)
1288
0
{
1289
0
  unsigned klass = info.syllable();
1290
0
  if (klass < 255)
1291
0
    return klass;
1292
0
  klass = class_def.get_class (info.codepoint);
1293
0
  if (likely (klass < 255))
1294
0
    info.syllable() = klass;
1295
0
  return klass;
1296
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::get_class_cached(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-ot-face.cc:OT::get_class_cached(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-ot-layout.cc:OT::get_class_cached(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::get_class_cached(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::get_class_cached(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset.cc:OT::get_class_cached(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::get_class_cached(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::get_class_cached(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-var.cc:OT::get_class_cached(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::get_class_cached(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-color.cc:OT::get_class_cached(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-other.cc:OT::get_class_cached(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: gsubgpos-context.cc:OT::get_class_cached(OT::ClassDef const&, hb_glyph_info_t&)
1297
static inline bool match_class_cached (hb_glyph_info_t &info, unsigned value, const void *data)
1298
0
{
1299
0
  const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
1300
0
  return get_class_cached (class_def, info) == value;
1301
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-layout.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: gsubgpos-context.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
1302
static inline unsigned get_class_cached1 (const ClassDef &class_def, hb_glyph_info_t &info)
1303
0
{
1304
0
  unsigned klass = info.syllable() & 0x0F;
1305
0
  if (klass < 15)
1306
0
    return klass;
1307
0
  klass = class_def.get_class (info.codepoint);
1308
0
  if (likely (klass < 15))
1309
0
    info.syllable() = (info.syllable() & 0xF0) | klass;
1310
0
  return klass;
1311
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::get_class_cached1(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-ot-face.cc:OT::get_class_cached1(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-ot-layout.cc:OT::get_class_cached1(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::get_class_cached1(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::get_class_cached1(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset.cc:OT::get_class_cached1(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::get_class_cached1(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::get_class_cached1(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-var.cc:OT::get_class_cached1(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::get_class_cached1(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-color.cc:OT::get_class_cached1(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-other.cc:OT::get_class_cached1(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: gsubgpos-context.cc:OT::get_class_cached1(OT::ClassDef const&, hb_glyph_info_t&)
1312
static inline bool match_class_cached1 (hb_glyph_info_t &info, unsigned value, const void *data)
1313
0
{
1314
0
  const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
1315
0
  return get_class_cached1 (class_def, info) == value;
1316
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::match_class_cached1(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::match_class_cached1(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-layout.cc:OT::match_class_cached1(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::match_class_cached1(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::match_class_cached1(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset.cc:OT::match_class_cached1(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::match_class_cached1(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::match_class_cached1(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::match_class_cached1(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::match_class_cached1(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::match_class_cached1(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::match_class_cached1(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: gsubgpos-context.cc:OT::match_class_cached1(hb_glyph_info_t&, unsigned int, void const*)
1317
static inline unsigned get_class_cached2 (const ClassDef &class_def, hb_glyph_info_t &info)
1318
0
{
1319
0
  unsigned klass = (info.syllable() & 0xF0) >> 4;
1320
0
  if (klass < 15)
1321
0
    return klass;
1322
0
  klass = class_def.get_class (info.codepoint);
1323
0
  if (likely (klass < 15))
1324
0
    info.syllable() = (info.syllable() & 0x0F) | (klass << 4);
1325
0
  return klass;
1326
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::get_class_cached2(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-ot-face.cc:OT::get_class_cached2(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-ot-layout.cc:OT::get_class_cached2(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::get_class_cached2(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::get_class_cached2(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset.cc:OT::get_class_cached2(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::get_class_cached2(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::get_class_cached2(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-var.cc:OT::get_class_cached2(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::get_class_cached2(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-color.cc:OT::get_class_cached2(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: hb-subset-table-other.cc:OT::get_class_cached2(OT::ClassDef const&, hb_glyph_info_t&)
Unexecuted instantiation: gsubgpos-context.cc:OT::get_class_cached2(OT::ClassDef const&, hb_glyph_info_t&)
1327
static inline bool match_class_cached2 (hb_glyph_info_t &info, unsigned value, const void *data)
1328
0
{
1329
0
  const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
1330
0
  return get_class_cached2 (class_def, info) == value;
1331
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::match_class_cached2(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::match_class_cached2(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-layout.cc:OT::match_class_cached2(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::match_class_cached2(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::match_class_cached2(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset.cc:OT::match_class_cached2(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::match_class_cached2(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::match_class_cached2(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::match_class_cached2(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::match_class_cached2(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::match_class_cached2(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::match_class_cached2(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: gsubgpos-context.cc:OT::match_class_cached2(hb_glyph_info_t&, unsigned int, void const*)
1332
static inline bool match_coverage (hb_glyph_info_t &info, unsigned value, const void *data)
1333
1.06M
{
1334
1.06M
  Offset16To<Coverage> coverage;
1335
1.06M
  coverage = value;
1336
1.06M
  return (data+coverage).get_coverage (info.codepoint) != NOT_COVERED;
1337
1.06M
}
Unexecuted instantiation: hb-aat-layout.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
hb-ot-layout.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
Line
Count
Source
1333
1.06M
{
1334
1.06M
  Offset16To<Coverage> coverage;
1335
1.06M
  coverage = value;
1336
1.06M
  return (data+coverage).get_coverage (info.codepoint) != NOT_COVERED;
1337
1.06M
}
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: gsubgpos-context.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
1338
1339
template <typename HBUINT>
1340
static inline bool would_match_input (hb_would_apply_context_t *c,
1341
              unsigned int count, /* Including the first glyph (not matched) */
1342
              const HBUINT input[], /* Array of input values--start with second glyph */
1343
              match_func_t match_func,
1344
              const void *match_data)
1345
0
{
1346
0
  if (count != c->len)
1347
0
    return false;
1348
1349
0
  for (unsigned int i = 1; i < count; i++)
1350
0
  {
1351
0
    hb_glyph_info_t info;
1352
0
    info.codepoint = c->glyphs[i];
1353
0
    if (likely (!match_func (info, input[i - 1], match_data)))
1354
0
      return false;
1355
0
  }
1356
1357
0
  return true;
1358
0
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::would_match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::would_match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::would_match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::would_match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::would_match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-subset.cc:bool OT::would_match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:bool OT::would_match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-subset-table-layout.cc:bool OT::would_match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-subset-table-var.cc:bool OT::would_match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-subset-table-cff.cc:bool OT::would_match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-subset-table-color.cc:bool OT::would_match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-subset-table-other.cc:bool OT::would_match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: gsubgpos-context.cc:bool OT::would_match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
1359
template <typename HBUINT>
1360
#ifndef HB_OPTIMIZE_SIZE
1361
HB_ALWAYS_INLINE
1362
#endif
1363
static bool match_input (hb_ot_apply_context_t *c,
1364
       unsigned int count, /* Including the first glyph (not matched) */
1365
       const HBUINT input[], /* Array of input values--start with second glyph */
1366
       match_func_t match_func,
1367
       const void *match_data,
1368
       unsigned int *end_position,
1369
       unsigned int *p_total_component_count = nullptr)
1370
2.06M
{
1371
2.06M
  TRACE_APPLY (nullptr);
1372
1373
2.06M
  hb_buffer_t *buffer = c->buffer;
1374
1375
2.06M
  if (count == 1)
1376
1.47M
  {
1377
1.47M
    *end_position = buffer->idx + 1;
1378
1.47M
    c->match_positions[0] = buffer->idx;
1379
1.47M
    if (p_total_component_count)
1380
0
      *p_total_component_count = _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1381
1.47M
    return_trace (true);
1382
1.47M
  }
1383
1384
583k
  if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return_trace (false);
1385
1386
583k
  auto &skippy_iter = c->iter_input;
1387
583k
  skippy_iter.reset (buffer->idx);
1388
583k
  skippy_iter.set_match_func (match_func, match_data);
1389
583k
  skippy_iter.set_glyph_data (input);
1390
1391
  /*
1392
   * This is perhaps the trickiest part of OpenType...  Remarks:
1393
   *
1394
   * - If all components of the ligature were marks, we call this a mark ligature.
1395
   *
1396
   * - If there is no GDEF, and the ligature is NOT a mark ligature, we categorize
1397
   *   it as a ligature glyph.
1398
   *
1399
   * - Ligatures cannot be formed across glyphs attached to different components
1400
   *   of previous ligatures.  Eg. the sequence is LAM,SHADDA,LAM,FATHA,HEH, and
1401
   *   LAM,LAM,HEH form a ligature, leaving SHADDA,FATHA next to eachother.
1402
   *   However, it would be wrong to ligate that SHADDA,FATHA sequence.
1403
   *   There are a couple of exceptions to this:
1404
   *
1405
   *   o If a ligature tries ligating with marks that belong to it itself, go ahead,
1406
   *     assuming that the font designer knows what they are doing (otherwise it can
1407
   *     break Indic stuff when a matra wants to ligate with a conjunct,
1408
   *
1409
   *   o If two marks want to ligate and they belong to different components of the
1410
   *     same ligature glyph, and said ligature glyph is to be ignored according to
1411
   *     mark-filtering rules, then allow.
1412
   *     https://github.com/harfbuzz/harfbuzz/issues/545
1413
   */
1414
1415
583k
  unsigned int total_component_count = 0;
1416
1417
583k
  unsigned int first_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
1418
583k
  unsigned int first_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
1419
1420
583k
  enum {
1421
583k
    LIGBASE_NOT_CHECKED,
1422
583k
    LIGBASE_MAY_NOT_SKIP,
1423
583k
    LIGBASE_MAY_SKIP
1424
583k
  } ligbase = LIGBASE_NOT_CHECKED;
1425
1426
645k
  for (unsigned int i = 1; i < count; i++)
1427
583k
  {
1428
583k
    unsigned unsafe_to;
1429
583k
    if (!skippy_iter.next (&unsafe_to))
1430
520k
    {
1431
520k
      *end_position = unsafe_to;
1432
520k
      return_trace (false);
1433
520k
    }
1434
1435
62.5k
    if (unlikely (i + 1 > c->match_positions.length &&
1436
62.5k
      !c->match_positions.resize_dirty  (i + 1)))
1437
0
      return_trace (false);
1438
62.5k
    c->match_positions.arrayZ[i] = skippy_iter.idx;
1439
1440
62.5k
    unsigned int this_lig_id = _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx]);
1441
62.5k
    unsigned int this_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]);
1442
1443
62.5k
    if (first_lig_id && first_lig_comp)
1444
0
    {
1445
      /* If first component was attached to a previous ligature component,
1446
       * all subsequent components should be attached to the same ligature
1447
       * component, otherwise we shouldn't ligate them... */
1448
0
      if (first_lig_id != this_lig_id || first_lig_comp != this_lig_comp)
1449
0
      {
1450
  /* ...unless, we are attached to a base ligature and that base
1451
   * ligature is ignorable. */
1452
0
  if (ligbase == LIGBASE_NOT_CHECKED)
1453
0
  {
1454
0
    bool found = false;
1455
0
    const auto *out = buffer->out_info;
1456
0
    unsigned int j = buffer->out_len;
1457
0
    while (j && _hb_glyph_info_get_lig_id (&out[j - 1]) == first_lig_id)
1458
0
    {
1459
0
      if (_hb_glyph_info_get_lig_comp (&out[j - 1]) == 0)
1460
0
      {
1461
0
        j--;
1462
0
        found = true;
1463
0
        break;
1464
0
      }
1465
0
      j--;
1466
0
    }
1467
1468
0
    if (found && skippy_iter.may_skip (out[j]) == matcher_t::SKIP_YES)
1469
0
      ligbase = LIGBASE_MAY_SKIP;
1470
0
    else
1471
0
      ligbase = LIGBASE_MAY_NOT_SKIP;
1472
0
  }
1473
1474
0
  if (ligbase == LIGBASE_MAY_NOT_SKIP)
1475
0
    return_trace (false);
1476
0
      }
1477
0
    }
1478
62.5k
    else
1479
62.5k
    {
1480
      /* If first component was NOT attached to a previous ligature component,
1481
       * all subsequent components should also NOT be attached to any ligature
1482
       * component, unless they are attached to the first component itself! */
1483
62.5k
      if (this_lig_id && this_lig_comp && (this_lig_id != first_lig_id))
1484
0
  return_trace (false);
1485
62.5k
    }
1486
1487
62.5k
    total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->info[skippy_iter.idx]);
1488
62.5k
  }
1489
1490
62.1k
  *end_position = skippy_iter.idx + 1;
1491
1492
62.1k
  if (p_total_component_count)
1493
29.0k
  {
1494
29.0k
    total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1495
29.0k
    *p_total_component_count = total_component_count;
1496
29.0k
  }
1497
1498
62.1k
  c->match_positions.arrayZ[0] = buffer->idx;
1499
1500
62.1k
  return_trace (true);
1501
583k
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-aat-layout.cc:bool OT::match_input<OT::HBGlyphID16>(OT::hb_ot_apply_context_t*, unsigned int, OT::HBGlyphID16 const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::match_input<OT::HBGlyphID16>(OT::hb_ot_apply_context_t*, unsigned int, OT::HBGlyphID16 const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
hb-ot-layout.cc:bool OT::match_input<OT::HBGlyphID16>(OT::hb_ot_apply_context_t*, unsigned int, OT::HBGlyphID16 const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Line
Count
Source
1370
467k
{
1371
467k
  TRACE_APPLY (nullptr);
1372
1373
467k
  hb_buffer_t *buffer = c->buffer;
1374
1375
467k
  if (count == 1)
1376
0
  {
1377
0
    *end_position = buffer->idx + 1;
1378
0
    c->match_positions[0] = buffer->idx;
1379
0
    if (p_total_component_count)
1380
0
      *p_total_component_count = _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1381
0
    return_trace (true);
1382
0
  }
1383
1384
467k
  if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return_trace (false);
1385
1386
467k
  auto &skippy_iter = c->iter_input;
1387
467k
  skippy_iter.reset (buffer->idx);
1388
467k
  skippy_iter.set_match_func (match_func, match_data);
1389
467k
  skippy_iter.set_glyph_data (input);
1390
1391
  /*
1392
   * This is perhaps the trickiest part of OpenType...  Remarks:
1393
   *
1394
   * - If all components of the ligature were marks, we call this a mark ligature.
1395
   *
1396
   * - If there is no GDEF, and the ligature is NOT a mark ligature, we categorize
1397
   *   it as a ligature glyph.
1398
   *
1399
   * - Ligatures cannot be formed across glyphs attached to different components
1400
   *   of previous ligatures.  Eg. the sequence is LAM,SHADDA,LAM,FATHA,HEH, and
1401
   *   LAM,LAM,HEH form a ligature, leaving SHADDA,FATHA next to eachother.
1402
   *   However, it would be wrong to ligate that SHADDA,FATHA sequence.
1403
   *   There are a couple of exceptions to this:
1404
   *
1405
   *   o If a ligature tries ligating with marks that belong to it itself, go ahead,
1406
   *     assuming that the font designer knows what they are doing (otherwise it can
1407
   *     break Indic stuff when a matra wants to ligate with a conjunct,
1408
   *
1409
   *   o If two marks want to ligate and they belong to different components of the
1410
   *     same ligature glyph, and said ligature glyph is to be ignored according to
1411
   *     mark-filtering rules, then allow.
1412
   *     https://github.com/harfbuzz/harfbuzz/issues/545
1413
   */
1414
1415
467k
  unsigned int total_component_count = 0;
1416
1417
467k
  unsigned int first_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
1418
467k
  unsigned int first_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
1419
1420
467k
  enum {
1421
467k
    LIGBASE_NOT_CHECKED,
1422
467k
    LIGBASE_MAY_NOT_SKIP,
1423
467k
    LIGBASE_MAY_SKIP
1424
467k
  } ligbase = LIGBASE_NOT_CHECKED;
1425
1426
497k
  for (unsigned int i = 1; i < count; i++)
1427
468k
  {
1428
468k
    unsigned unsafe_to;
1429
468k
    if (!skippy_iter.next (&unsafe_to))
1430
438k
    {
1431
438k
      *end_position = unsafe_to;
1432
438k
      return_trace (false);
1433
438k
    }
1434
1435
29.4k
    if (unlikely (i + 1 > c->match_positions.length &&
1436
29.4k
      !c->match_positions.resize_dirty  (i + 1)))
1437
0
      return_trace (false);
1438
29.4k
    c->match_positions.arrayZ[i] = skippy_iter.idx;
1439
1440
29.4k
    unsigned int this_lig_id = _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx]);
1441
29.4k
    unsigned int this_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]);
1442
1443
29.4k
    if (first_lig_id && first_lig_comp)
1444
0
    {
1445
      /* If first component was attached to a previous ligature component,
1446
       * all subsequent components should be attached to the same ligature
1447
       * component, otherwise we shouldn't ligate them... */
1448
0
      if (first_lig_id != this_lig_id || first_lig_comp != this_lig_comp)
1449
0
      {
1450
  /* ...unless, we are attached to a base ligature and that base
1451
   * ligature is ignorable. */
1452
0
  if (ligbase == LIGBASE_NOT_CHECKED)
1453
0
  {
1454
0
    bool found = false;
1455
0
    const auto *out = buffer->out_info;
1456
0
    unsigned int j = buffer->out_len;
1457
0
    while (j && _hb_glyph_info_get_lig_id (&out[j - 1]) == first_lig_id)
1458
0
    {
1459
0
      if (_hb_glyph_info_get_lig_comp (&out[j - 1]) == 0)
1460
0
      {
1461
0
        j--;
1462
0
        found = true;
1463
0
        break;
1464
0
      }
1465
0
      j--;
1466
0
    }
1467
1468
0
    if (found && skippy_iter.may_skip (out[j]) == matcher_t::SKIP_YES)
1469
0
      ligbase = LIGBASE_MAY_SKIP;
1470
0
    else
1471
0
      ligbase = LIGBASE_MAY_NOT_SKIP;
1472
0
  }
1473
1474
0
  if (ligbase == LIGBASE_MAY_NOT_SKIP)
1475
0
    return_trace (false);
1476
0
      }
1477
0
    }
1478
29.4k
    else
1479
29.4k
    {
1480
      /* If first component was NOT attached to a previous ligature component,
1481
       * all subsequent components should also NOT be attached to any ligature
1482
       * component, unless they are attached to the first component itself! */
1483
29.4k
      if (this_lig_id && this_lig_comp && (this_lig_id != first_lig_id))
1484
0
  return_trace (false);
1485
29.4k
    }
1486
1487
29.4k
    total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->info[skippy_iter.idx]);
1488
29.4k
  }
1489
1490
29.0k
  *end_position = skippy_iter.idx + 1;
1491
1492
29.0k
  if (p_total_component_count)
1493
29.0k
  {
1494
29.0k
    total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1495
29.0k
    *p_total_component_count = total_component_count;
1496
29.0k
  }
1497
1498
29.0k
  c->match_positions.arrayZ[0] = buffer->idx;
1499
1500
29.0k
  return_trace (true);
1501
467k
}
hb-ot-layout.cc:bool OT::match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Line
Count
Source
1370
1.59M
{
1371
1.59M
  TRACE_APPLY (nullptr);
1372
1373
1.59M
  hb_buffer_t *buffer = c->buffer;
1374
1375
1.59M
  if (count == 1)
1376
1.47M
  {
1377
1.47M
    *end_position = buffer->idx + 1;
1378
1.47M
    c->match_positions[0] = buffer->idx;
1379
1.47M
    if (p_total_component_count)
1380
0
      *p_total_component_count = _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1381
1.47M
    return_trace (true);
1382
1.47M
  }
1383
1384
115k
  if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return_trace (false);
1385
1386
115k
  auto &skippy_iter = c->iter_input;
1387
115k
  skippy_iter.reset (buffer->idx);
1388
115k
  skippy_iter.set_match_func (match_func, match_data);
1389
115k
  skippy_iter.set_glyph_data (input);
1390
1391
  /*
1392
   * This is perhaps the trickiest part of OpenType...  Remarks:
1393
   *
1394
   * - If all components of the ligature were marks, we call this a mark ligature.
1395
   *
1396
   * - If there is no GDEF, and the ligature is NOT a mark ligature, we categorize
1397
   *   it as a ligature glyph.
1398
   *
1399
   * - Ligatures cannot be formed across glyphs attached to different components
1400
   *   of previous ligatures.  Eg. the sequence is LAM,SHADDA,LAM,FATHA,HEH, and
1401
   *   LAM,LAM,HEH form a ligature, leaving SHADDA,FATHA next to eachother.
1402
   *   However, it would be wrong to ligate that SHADDA,FATHA sequence.
1403
   *   There are a couple of exceptions to this:
1404
   *
1405
   *   o If a ligature tries ligating with marks that belong to it itself, go ahead,
1406
   *     assuming that the font designer knows what they are doing (otherwise it can
1407
   *     break Indic stuff when a matra wants to ligate with a conjunct,
1408
   *
1409
   *   o If two marks want to ligate and they belong to different components of the
1410
   *     same ligature glyph, and said ligature glyph is to be ignored according to
1411
   *     mark-filtering rules, then allow.
1412
   *     https://github.com/harfbuzz/harfbuzz/issues/545
1413
   */
1414
1415
115k
  unsigned int total_component_count = 0;
1416
1417
115k
  unsigned int first_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
1418
115k
  unsigned int first_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
1419
1420
115k
  enum {
1421
115k
    LIGBASE_NOT_CHECKED,
1422
115k
    LIGBASE_MAY_NOT_SKIP,
1423
115k
    LIGBASE_MAY_SKIP
1424
115k
  } ligbase = LIGBASE_NOT_CHECKED;
1425
1426
148k
  for (unsigned int i = 1; i < count; i++)
1427
115k
  {
1428
115k
    unsigned unsafe_to;
1429
115k
    if (!skippy_iter.next (&unsafe_to))
1430
82.1k
    {
1431
82.1k
      *end_position = unsafe_to;
1432
82.1k
      return_trace (false);
1433
82.1k
    }
1434
1435
33.1k
    if (unlikely (i + 1 > c->match_positions.length &&
1436
33.1k
      !c->match_positions.resize_dirty  (i + 1)))
1437
0
      return_trace (false);
1438
33.1k
    c->match_positions.arrayZ[i] = skippy_iter.idx;
1439
1440
33.1k
    unsigned int this_lig_id = _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx]);
1441
33.1k
    unsigned int this_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]);
1442
1443
33.1k
    if (first_lig_id && first_lig_comp)
1444
0
    {
1445
      /* If first component was attached to a previous ligature component,
1446
       * all subsequent components should be attached to the same ligature
1447
       * component, otherwise we shouldn't ligate them... */
1448
0
      if (first_lig_id != this_lig_id || first_lig_comp != this_lig_comp)
1449
0
      {
1450
  /* ...unless, we are attached to a base ligature and that base
1451
   * ligature is ignorable. */
1452
0
  if (ligbase == LIGBASE_NOT_CHECKED)
1453
0
  {
1454
0
    bool found = false;
1455
0
    const auto *out = buffer->out_info;
1456
0
    unsigned int j = buffer->out_len;
1457
0
    while (j && _hb_glyph_info_get_lig_id (&out[j - 1]) == first_lig_id)
1458
0
    {
1459
0
      if (_hb_glyph_info_get_lig_comp (&out[j - 1]) == 0)
1460
0
      {
1461
0
        j--;
1462
0
        found = true;
1463
0
        break;
1464
0
      }
1465
0
      j--;
1466
0
    }
1467
1468
0
    if (found && skippy_iter.may_skip (out[j]) == matcher_t::SKIP_YES)
1469
0
      ligbase = LIGBASE_MAY_SKIP;
1470
0
    else
1471
0
      ligbase = LIGBASE_MAY_NOT_SKIP;
1472
0
  }
1473
1474
0
  if (ligbase == LIGBASE_MAY_NOT_SKIP)
1475
0
    return_trace (false);
1476
0
      }
1477
0
    }
1478
33.1k
    else
1479
33.1k
    {
1480
      /* If first component was NOT attached to a previous ligature component,
1481
       * all subsequent components should also NOT be attached to any ligature
1482
       * component, unless they are attached to the first component itself! */
1483
33.1k
      if (this_lig_id && this_lig_comp && (this_lig_id != first_lig_id))
1484
0
  return_trace (false);
1485
33.1k
    }
1486
1487
33.1k
    total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->info[skippy_iter.idx]);
1488
33.1k
  }
1489
1490
33.1k
  *end_position = skippy_iter.idx + 1;
1491
1492
33.1k
  if (p_total_component_count)
1493
0
  {
1494
0
    total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1495
0
    *p_total_component_count = total_component_count;
1496
0
  }
1497
1498
33.1k
  c->match_positions.arrayZ[0] = buffer->idx;
1499
1500
33.1k
  return_trace (true);
1501
115k
}
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::match_input<OT::HBGlyphID16>(OT::hb_ot_apply_context_t*, unsigned int, OT::HBGlyphID16 const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-subset.cc:bool OT::match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-subset-plan-layout.cc:bool OT::match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-subset-plan-layout.cc:bool OT::match_input<OT::HBGlyphID16>(OT::hb_ot_apply_context_t*, unsigned int, OT::HBGlyphID16 const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-subset-table-layout.cc:bool OT::match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-subset-table-layout.cc:bool OT::match_input<OT::HBGlyphID16>(OT::hb_ot_apply_context_t*, unsigned int, OT::HBGlyphID16 const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-subset-table-var.cc:bool OT::match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-subset-table-cff.cc:bool OT::match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-subset-table-color.cc:bool OT::match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-subset-table-other.cc:bool OT::match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
Unexecuted instantiation: gsubgpos-context.cc:bool OT::match_input<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*)
1502
static inline bool ligate_input (hb_ot_apply_context_t *c,
1503
         unsigned int count, /* Including the first glyph */
1504
         unsigned int match_end,
1505
         hb_codepoint_t lig_glyph,
1506
         unsigned int total_component_count)
1507
29.0k
{
1508
29.0k
  TRACE_APPLY (nullptr);
1509
1510
29.0k
  hb_buffer_t *buffer = c->buffer;
1511
1512
29.0k
  buffer->merge_clusters (buffer->idx, match_end);
1513
1514
  /* - If a base and one or more marks ligate, consider that as a base, NOT
1515
   *   ligature, such that all following marks can still attach to it.
1516
   *   https://github.com/harfbuzz/harfbuzz/issues/1109
1517
   *
1518
   * - If all components of the ligature were marks, we call this a mark ligature.
1519
   *   If it *is* a mark ligature, we don't allocate a new ligature id, and leave
1520
   *   the ligature to keep its old ligature id.  This will allow it to attach to
1521
   *   a base ligature in GPOS.  Eg. if the sequence is: LAM,LAM,SHADDA,FATHA,HEH,
1522
   *   and LAM,LAM,HEH for a ligature, they will leave SHADDA and FATHA with a
1523
   *   ligature id and component value of 2.  Then if SHADDA,FATHA form a ligature
1524
   *   later, we don't want them to lose their ligature id/component, otherwise
1525
   *   GPOS will fail to correctly position the mark ligature on top of the
1526
   *   LAM,LAM,HEH ligature.  See:
1527
   *     https://bugzilla.gnome.org/show_bug.cgi?id=676343
1528
   *
1529
   * - If a ligature is formed of components that some of which are also ligatures
1530
   *   themselves, and those ligature components had marks attached to *their*
1531
   *   components, we have to attach the marks to the new ligature component
1532
   *   positions!  Now *that*'s tricky!  And these marks may be following the
1533
   *   last component of the whole sequence, so we should loop forward looking
1534
   *   for them and update them.
1535
   *
1536
   *   Eg. the sequence is LAM,LAM,SHADDA,FATHA,HEH, and the font first forms a
1537
   *   'calt' ligature of LAM,HEH, leaving the SHADDA and FATHA with a ligature
1538
   *   id and component == 1.  Now, during 'liga', the LAM and the LAM-HEH ligature
1539
   *   form a LAM-LAM-HEH ligature.  We need to reassign the SHADDA and FATHA to
1540
   *   the new ligature with a component value of 2.
1541
   *
1542
   *   This in fact happened to a font...  See:
1543
   *   https://bugzilla.gnome.org/show_bug.cgi?id=437633
1544
   */
1545
1546
29.0k
  bool is_base_ligature = _hb_glyph_info_is_base_glyph (&buffer->info[c->match_positions.arrayZ[0]]);
1547
29.0k
  bool is_mark_ligature = _hb_glyph_info_is_mark (&buffer->info[c->match_positions.arrayZ[0]]);
1548
58.1k
  for (unsigned int i = 1; i < count; i++)
1549
29.0k
    if (!_hb_glyph_info_is_mark (&buffer->info[c->match_positions.arrayZ[i]]))
1550
0
    {
1551
0
      is_base_ligature = false;
1552
0
      is_mark_ligature = false;
1553
0
      break;
1554
0
    }
1555
29.0k
  bool is_ligature = !is_base_ligature && !is_mark_ligature;
1556
1557
29.0k
  unsigned int klass = is_ligature ? HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE : 0;
1558
29.0k
  unsigned int lig_id = is_ligature ? _hb_allocate_lig_id (buffer) : 0;
1559
29.0k
  unsigned int last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
1560
29.0k
  unsigned int last_num_components = _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1561
29.0k
  unsigned int components_so_far = last_num_components;
1562
1563
29.0k
  if (is_ligature)
1564
0
  {
1565
0
    _hb_glyph_info_set_lig_props_for_ligature (&buffer->cur(), lig_id, total_component_count);
1566
0
    if (_hb_glyph_info_get_general_category (&buffer->cur()) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
1567
0
    {
1568
0
      _hb_glyph_info_set_general_category (&buffer->cur(), HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER);
1569
0
    }
1570
0
  }
1571
29.0k
  c->replace_glyph_with_ligature (lig_glyph, klass);
1572
1573
58.1k
  for (unsigned int i = 1; i < count; i++)
1574
29.0k
  {
1575
29.0k
    while (buffer->idx < c->match_positions.arrayZ[i] && buffer->successful)
1576
0
    {
1577
0
      if (is_ligature)
1578
0
      {
1579
0
  unsigned int this_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
1580
0
  if (this_comp == 0)
1581
0
    this_comp = last_num_components;
1582
0
  assert (components_so_far >= last_num_components);
1583
0
  unsigned int new_lig_comp = components_so_far - last_num_components +
1584
0
            hb_min (this_comp, last_num_components);
1585
0
    _hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp);
1586
0
      }
1587
0
      (void) buffer->next_glyph ();
1588
0
    }
1589
1590
29.0k
    last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
1591
29.0k
    last_num_components = _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1592
29.0k
    components_so_far += last_num_components;
1593
1594
    /* Skip the base glyph */
1595
29.0k
    buffer->idx++;
1596
29.0k
  }
1597
1598
29.0k
  if (!is_mark_ligature && last_lig_id)
1599
0
  {
1600
    /* Re-adjust components for any marks following. */
1601
0
    for (unsigned i = buffer->idx; i < buffer->len; ++i)
1602
0
    {
1603
0
      if (last_lig_id != _hb_glyph_info_get_lig_id (&buffer->info[i])) break;
1604
1605
0
      unsigned this_comp = _hb_glyph_info_get_lig_comp (&buffer->info[i]);
1606
0
      if (!this_comp) break;
1607
1608
0
      assert (components_so_far >= last_num_components);
1609
0
      unsigned new_lig_comp = components_so_far - last_num_components +
1610
0
            hb_min (this_comp, last_num_components);
1611
0
      _hb_glyph_info_set_lig_props_for_mark (&buffer->info[i], lig_id, new_lig_comp);
1612
0
    }
1613
0
  }
1614
29.0k
  return_trace (true);
1615
29.0k
}
Unexecuted instantiation: hb-aat-layout.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: hb-ot-face.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, unsigned int, unsigned int)
hb-ot-layout.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, unsigned int, unsigned int)
Line
Count
Source
1507
29.0k
{
1508
29.0k
  TRACE_APPLY (nullptr);
1509
1510
29.0k
  hb_buffer_t *buffer = c->buffer;
1511
1512
29.0k
  buffer->merge_clusters (buffer->idx, match_end);
1513
1514
  /* - If a base and one or more marks ligate, consider that as a base, NOT
1515
   *   ligature, such that all following marks can still attach to it.
1516
   *   https://github.com/harfbuzz/harfbuzz/issues/1109
1517
   *
1518
   * - If all components of the ligature were marks, we call this a mark ligature.
1519
   *   If it *is* a mark ligature, we don't allocate a new ligature id, and leave
1520
   *   the ligature to keep its old ligature id.  This will allow it to attach to
1521
   *   a base ligature in GPOS.  Eg. if the sequence is: LAM,LAM,SHADDA,FATHA,HEH,
1522
   *   and LAM,LAM,HEH for a ligature, they will leave SHADDA and FATHA with a
1523
   *   ligature id and component value of 2.  Then if SHADDA,FATHA form a ligature
1524
   *   later, we don't want them to lose their ligature id/component, otherwise
1525
   *   GPOS will fail to correctly position the mark ligature on top of the
1526
   *   LAM,LAM,HEH ligature.  See:
1527
   *     https://bugzilla.gnome.org/show_bug.cgi?id=676343
1528
   *
1529
   * - If a ligature is formed of components that some of which are also ligatures
1530
   *   themselves, and those ligature components had marks attached to *their*
1531
   *   components, we have to attach the marks to the new ligature component
1532
   *   positions!  Now *that*'s tricky!  And these marks may be following the
1533
   *   last component of the whole sequence, so we should loop forward looking
1534
   *   for them and update them.
1535
   *
1536
   *   Eg. the sequence is LAM,LAM,SHADDA,FATHA,HEH, and the font first forms a
1537
   *   'calt' ligature of LAM,HEH, leaving the SHADDA and FATHA with a ligature
1538
   *   id and component == 1.  Now, during 'liga', the LAM and the LAM-HEH ligature
1539
   *   form a LAM-LAM-HEH ligature.  We need to reassign the SHADDA and FATHA to
1540
   *   the new ligature with a component value of 2.
1541
   *
1542
   *   This in fact happened to a font...  See:
1543
   *   https://bugzilla.gnome.org/show_bug.cgi?id=437633
1544
   */
1545
1546
29.0k
  bool is_base_ligature = _hb_glyph_info_is_base_glyph (&buffer->info[c->match_positions.arrayZ[0]]);
1547
29.0k
  bool is_mark_ligature = _hb_glyph_info_is_mark (&buffer->info[c->match_positions.arrayZ[0]]);
1548
58.1k
  for (unsigned int i = 1; i < count; i++)
1549
29.0k
    if (!_hb_glyph_info_is_mark (&buffer->info[c->match_positions.arrayZ[i]]))
1550
0
    {
1551
0
      is_base_ligature = false;
1552
0
      is_mark_ligature = false;
1553
0
      break;
1554
0
    }
1555
29.0k
  bool is_ligature = !is_base_ligature && !is_mark_ligature;
1556
1557
29.0k
  unsigned int klass = is_ligature ? HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE : 0;
1558
29.0k
  unsigned int lig_id = is_ligature ? _hb_allocate_lig_id (buffer) : 0;
1559
29.0k
  unsigned int last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
1560
29.0k
  unsigned int last_num_components = _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1561
29.0k
  unsigned int components_so_far = last_num_components;
1562
1563
29.0k
  if (is_ligature)
1564
0
  {
1565
0
    _hb_glyph_info_set_lig_props_for_ligature (&buffer->cur(), lig_id, total_component_count);
1566
0
    if (_hb_glyph_info_get_general_category (&buffer->cur()) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
1567
0
    {
1568
0
      _hb_glyph_info_set_general_category (&buffer->cur(), HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER);
1569
0
    }
1570
0
  }
1571
29.0k
  c->replace_glyph_with_ligature (lig_glyph, klass);
1572
1573
58.1k
  for (unsigned int i = 1; i < count; i++)
1574
29.0k
  {
1575
29.0k
    while (buffer->idx < c->match_positions.arrayZ[i] && buffer->successful)
1576
0
    {
1577
0
      if (is_ligature)
1578
0
      {
1579
0
  unsigned int this_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
1580
0
  if (this_comp == 0)
1581
0
    this_comp = last_num_components;
1582
0
  assert (components_so_far >= last_num_components);
1583
0
  unsigned int new_lig_comp = components_so_far - last_num_components +
1584
0
            hb_min (this_comp, last_num_components);
1585
0
    _hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp);
1586
0
      }
1587
0
      (void) buffer->next_glyph ();
1588
0
    }
1589
1590
29.0k
    last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
1591
29.0k
    last_num_components = _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1592
29.0k
    components_so_far += last_num_components;
1593
1594
    /* Skip the base glyph */
1595
29.0k
    buffer->idx++;
1596
29.0k
  }
1597
1598
29.0k
  if (!is_mark_ligature && last_lig_id)
1599
0
  {
1600
    /* Re-adjust components for any marks following. */
1601
0
    for (unsigned i = buffer->idx; i < buffer->len; ++i)
1602
0
    {
1603
0
      if (last_lig_id != _hb_glyph_info_get_lig_id (&buffer->info[i])) break;
1604
1605
0
      unsigned this_comp = _hb_glyph_info_get_lig_comp (&buffer->info[i]);
1606
0
      if (!this_comp) break;
1607
1608
0
      assert (components_so_far >= last_num_components);
1609
0
      unsigned new_lig_comp = components_so_far - last_num_components +
1610
0
            hb_min (this_comp, last_num_components);
1611
0
      _hb_glyph_info_set_lig_props_for_mark (&buffer->info[i], lig_id, new_lig_comp);
1612
0
    }
1613
0
  }
1614
29.0k
  return_trace (true);
1615
29.0k
}
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: hb-subset.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: hb-subset-table-var.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: hb-subset-table-color.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: hb-subset-table-other.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: gsubgpos-context.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, unsigned int, unsigned int)
1616
1617
template <typename HBUINT>
1618
#ifndef HB_OPTIMIZE_SIZE
1619
HB_ALWAYS_INLINE
1620
#endif
1621
static bool match_backtrack (hb_ot_apply_context_t *c,
1622
           unsigned int count,
1623
           const HBUINT backtrack[],
1624
           match_func_t match_func,
1625
           const void *match_data,
1626
           unsigned int *match_start)
1627
862k
{
1628
862k
  TRACE_APPLY (nullptr);
1629
1630
862k
  if (!count)
1631
776
  {
1632
776
    *match_start = c->buffer->backtrack_len ();
1633
776
    return_trace (true);
1634
776
  }
1635
1636
861k
  auto &skippy_iter = c->iter_context;
1637
861k
  skippy_iter.reset_back (c->buffer->backtrack_len ());
1638
861k
  skippy_iter.set_match_func (match_func, match_data);
1639
861k
  skippy_iter.set_glyph_data (backtrack);
1640
1641
979k
  for (unsigned int i = 0; i < count; i++)
1642
971k
  {
1643
971k
    unsigned unsafe_from;
1644
971k
    if (!skippy_iter.prev (&unsafe_from))
1645
853k
    {
1646
853k
      *match_start = unsafe_from;
1647
853k
      return_trace (false);
1648
853k
    }
1649
971k
  }
1650
1651
7.78k
  *match_start = skippy_iter.idx;
1652
7.78k
  return_trace (true);
1653
861k
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::match_backtrack<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::match_backtrack<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
hb-ot-layout.cc:bool OT::match_backtrack<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Line
Count
Source
1627
862k
{
1628
862k
  TRACE_APPLY (nullptr);
1629
1630
862k
  if (!count)
1631
776
  {
1632
776
    *match_start = c->buffer->backtrack_len ();
1633
776
    return_trace (true);
1634
776
  }
1635
1636
861k
  auto &skippy_iter = c->iter_context;
1637
861k
  skippy_iter.reset_back (c->buffer->backtrack_len ());
1638
861k
  skippy_iter.set_match_func (match_func, match_data);
1639
861k
  skippy_iter.set_glyph_data (backtrack);
1640
1641
979k
  for (unsigned int i = 0; i < count; i++)
1642
971k
  {
1643
971k
    unsigned unsafe_from;
1644
971k
    if (!skippy_iter.prev (&unsafe_from))
1645
853k
    {
1646
853k
      *match_start = unsafe_from;
1647
853k
      return_trace (false);
1648
853k
    }
1649
971k
  }
1650
1651
7.78k
  *match_start = skippy_iter.idx;
1652
7.78k
  return_trace (true);
1653
861k
}
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::match_backtrack<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::match_backtrack<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-subset.cc:bool OT::match_backtrack<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-subset-plan-layout.cc:bool OT::match_backtrack<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-subset-table-layout.cc:bool OT::match_backtrack<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-subset-table-var.cc:bool OT::match_backtrack<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-subset-table-cff.cc:bool OT::match_backtrack<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-subset-table-color.cc:bool OT::match_backtrack<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-subset-table-other.cc:bool OT::match_backtrack<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: gsubgpos-context.cc:bool OT::match_backtrack<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
1654
1655
template <typename HBUINT>
1656
#ifndef HB_OPTIMIZE_SIZE
1657
HB_ALWAYS_INLINE
1658
#endif
1659
static bool match_lookahead (hb_ot_apply_context_t *c,
1660
           unsigned int count,
1661
           const HBUINT lookahead[],
1662
           match_func_t match_func,
1663
           const void *match_data,
1664
           unsigned int start_index,
1665
           unsigned int *end_index)
1666
1.51M
{
1667
1.51M
  TRACE_APPLY (nullptr);
1668
1669
1.51M
  if (!count)
1670
751k
  {
1671
751k
    *end_index = start_index;
1672
751k
    return_trace (true);
1673
751k
  }
1674
1675
760k
  auto &skippy_iter = c->iter_context;
1676
760k
  assert (start_index >= 1);
1677
760k
  skippy_iter.reset (start_index - 1);
1678
760k
  skippy_iter.set_match_func (match_func, match_data);
1679
760k
  skippy_iter.set_glyph_data (lookahead);
1680
1681
870k
  for (unsigned int i = 0; i < count; i++)
1682
760k
  {
1683
760k
    unsigned unsafe_to;
1684
760k
    if (!skippy_iter.next (&unsafe_to))
1685
649k
    {
1686
649k
      *end_index = unsafe_to;
1687
649k
      return_trace (false);
1688
649k
    }
1689
760k
  }
1690
1691
110k
  *end_index = skippy_iter.idx + 1;
1692
110k
  return_trace (true);
1693
760k
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::match_lookahead<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::match_lookahead<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
hb-ot-layout.cc:bool OT::match_lookahead<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Line
Count
Source
1666
1.51M
{
1667
1.51M
  TRACE_APPLY (nullptr);
1668
1669
1.51M
  if (!count)
1670
751k
  {
1671
751k
    *end_index = start_index;
1672
751k
    return_trace (true);
1673
751k
  }
1674
1675
760k
  auto &skippy_iter = c->iter_context;
1676
760k
  assert (start_index >= 1);
1677
760k
  skippy_iter.reset (start_index - 1);
1678
760k
  skippy_iter.set_match_func (match_func, match_data);
1679
760k
  skippy_iter.set_glyph_data (lookahead);
1680
1681
870k
  for (unsigned int i = 0; i < count; i++)
1682
760k
  {
1683
760k
    unsigned unsafe_to;
1684
760k
    if (!skippy_iter.next (&unsafe_to))
1685
649k
    {
1686
649k
      *end_index = unsafe_to;
1687
649k
      return_trace (false);
1688
649k
    }
1689
760k
  }
1690
1691
110k
  *end_index = skippy_iter.idx + 1;
1692
110k
  return_trace (true);
1693
760k
}
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::match_lookahead<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::match_lookahead<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-subset.cc:bool OT::match_lookahead<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-subset-plan-layout.cc:bool OT::match_lookahead<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-subset-table-layout.cc:bool OT::match_lookahead<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-subset-table-var.cc:bool OT::match_lookahead<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-subset-table-cff.cc:bool OT::match_lookahead<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-subset-table-color.cc:bool OT::match_lookahead<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-subset-table-other.cc:bool OT::match_lookahead<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: gsubgpos-context.cc:bool OT::match_lookahead<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
1694
1695
1696
1697
struct LookupRecord
1698
{
1699
  bool serialize (hb_serialize_context_t *c,
1700
      const hb_map_t         *lookup_map) const
1701
0
  {
1702
0
    TRACE_SERIALIZE (this);
1703
0
    auto *out = c->embed (*this);
1704
0
    if (unlikely (!out)) return_trace (false);
1705
1706
0
    return_trace (c->check_assign (out->lookupListIndex, lookup_map->get (lookupListIndex), HB_SERIALIZE_ERROR_INT_OVERFLOW));
1707
0
  }
1708
1709
  bool sanitize (hb_sanitize_context_t *c) const
1710
0
  {
1711
0
    TRACE_SANITIZE (this);
1712
0
    return_trace (c->check_struct (this));
1713
0
  }
1714
1715
  HBUINT16  sequenceIndex;    /* Index into current glyph
1716
           * sequence--first glyph = 0 */
1717
  HBUINT16  lookupListIndex;  /* Lookup to apply to that
1718
           * position--zero--based */
1719
  public:
1720
  DEFINE_SIZE_STATIC (4);
1721
};
1722
1723
static unsigned serialize_lookuprecord_array (hb_serialize_context_t *c,
1724
                const hb_array_t<const LookupRecord> lookupRecords,
1725
                const hb_map_t *lookup_map)
1726
0
{
1727
0
  unsigned count = 0;
1728
0
  for (const LookupRecord& r : lookupRecords)
1729
0
  {
1730
0
    if (!lookup_map->has (r.lookupListIndex))
1731
0
      continue;
1732
1733
0
    if (!r.serialize (c, lookup_map))
1734
0
      return 0;
1735
1736
0
    count++;
1737
0
  }
1738
0
  return count;
1739
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-ot-face.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-ot-layout.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-subset.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-subset-table-var.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-subset-table-color.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-subset-table-other.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: gsubgpos-context.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
1740
1741
enum ContextFormat { SimpleContext = 1, ClassBasedContext = 2, CoverageBasedContext = 3 };
1742
1743
template <typename HBUINT>
1744
static void context_closure_recurse_lookups (hb_closure_context_t *c,
1745
               unsigned inputCount, const HBUINT input[],
1746
               unsigned lookupCount,
1747
               const LookupRecord lookupRecord[] /* Array of LookupRecords--in design order */,
1748
               unsigned value,
1749
               ContextFormat context_format,
1750
               const void *data,
1751
               intersected_glyphs_func_t intersected_glyphs_func,
1752
               void *cache)
1753
0
{
1754
0
  hb_set_t covered_seq_indicies;
1755
0
  hb_set_t pos_glyphs;
1756
0
  for (unsigned int i = 0; i < lookupCount; i++)
1757
0
  {
1758
0
    unsigned seqIndex = lookupRecord[i].sequenceIndex;
1759
0
    if (seqIndex >= inputCount) continue;
1760
1761
0
    bool has_pos_glyphs = false;
1762
1763
0
    if (!covered_seq_indicies.has (seqIndex))
1764
0
    {
1765
0
      has_pos_glyphs = true;
1766
0
      pos_glyphs.clear ();
1767
0
      if (seqIndex == 0)
1768
0
      {
1769
0
        switch (context_format) {
1770
0
        case ContextFormat::SimpleContext:
1771
0
          pos_glyphs.add (value);
1772
0
          break;
1773
0
        case ContextFormat::ClassBasedContext:
1774
0
          intersected_glyphs_func (&c->parent_active_glyphs (), data, value, &pos_glyphs, cache);
1775
0
          break;
1776
0
        case ContextFormat::CoverageBasedContext:
1777
0
          pos_glyphs.set (c->parent_active_glyphs ());
1778
0
          break;
1779
0
        }
1780
0
      }
1781
0
      else
1782
0
      {
1783
0
        const void *input_data = input;
1784
0
        unsigned input_value = seqIndex - 1;
1785
0
        if (context_format != ContextFormat::SimpleContext)
1786
0
        {
1787
0
          input_data = data;
1788
0
          input_value = input[seqIndex - 1];
1789
0
        }
1790
1791
0
        intersected_glyphs_func (c->glyphs, input_data, input_value, &pos_glyphs, cache);
1792
0
      }
1793
0
    }
1794
1795
0
    covered_seq_indicies.add (seqIndex);
1796
0
    hb_set_t *cur_active_glyphs = c->push_cur_active_glyphs ();
1797
0
    if (unlikely (!cur_active_glyphs))
1798
0
      return;
1799
0
    if (has_pos_glyphs) {
1800
0
      *cur_active_glyphs = std::move (pos_glyphs);
1801
0
    } else {
1802
0
      *cur_active_glyphs = *c->glyphs;
1803
0
    }
1804
1805
0
    unsigned endIndex = inputCount;
1806
0
    if (context_format == ContextFormat::CoverageBasedContext)
1807
0
      endIndex += 1;
1808
1809
0
    c->recurse (lookupRecord[i].lookupListIndex, &covered_seq_indicies, seqIndex, endIndex);
1810
1811
0
    c->pop_cur_done_glyphs ();
1812
0
  }
1813
0
}
Unexecuted instantiation: hb-aat-layout.cc:void OT::context_closure_recurse_lookups<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-ot-face.cc:void OT::context_closure_recurse_lookups<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-ot-layout.cc:void OT::context_closure_recurse_lookups<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::context_closure_recurse_lookups<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::context_closure_recurse_lookups<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-subset.cc:void OT::context_closure_recurse_lookups<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-subset-plan-layout.cc:void OT::context_closure_recurse_lookups<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-subset-table-layout.cc:void OT::context_closure_recurse_lookups<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-subset-table-var.cc:void OT::context_closure_recurse_lookups<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-subset-table-cff.cc:void OT::context_closure_recurse_lookups<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-subset-table-color.cc:void OT::context_closure_recurse_lookups<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-subset-table-other.cc:void OT::context_closure_recurse_lookups<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: gsubgpos-context.cc:void OT::context_closure_recurse_lookups<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
1814
1815
template <typename context_t>
1816
static inline void recurse_lookups (context_t *c,
1817
                                    unsigned int lookupCount,
1818
                                    const LookupRecord lookupRecord[] /* Array of LookupRecords--in design order */)
1819
0
{
1820
0
  for (unsigned int i = 0; i < lookupCount; i++)
1821
0
    c->recurse (lookupRecord[i].lookupListIndex);
1822
0
}
Unexecuted instantiation: hb-aat-layout.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-aat-layout.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-face.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-face.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-layout.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-layout.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-subset.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-subset.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-subset-plan-layout.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-subset-table-layout.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-subset-table-layout.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-subset-table-var.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-subset-table-var.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-subset-table-cff.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-subset-table-cff.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-subset-table-color.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-subset-table-color.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-subset-table-other.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-subset-table-other.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: gsubgpos-context.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: gsubgpos-context.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
1823
1824
static inline void apply_lookup (hb_ot_apply_context_t *c,
1825
         unsigned int count, /* Including the first glyph */
1826
         unsigned int lookupCount,
1827
         const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
1828
         unsigned int match_end)
1829
8.56k
{
1830
8.56k
  hb_buffer_t *buffer = c->buffer;
1831
8.56k
  int end;
1832
1833
  /* All positions are distance from beginning of *output* buffer.
1834
   * Adjust. */
1835
8.56k
  {
1836
8.56k
    unsigned int bl = buffer->backtrack_len ();
1837
8.56k
    end = bl + match_end - buffer->idx;
1838
1839
8.56k
    int delta = bl - buffer->idx;
1840
    /* Convert positions to new indexing. */
1841
17.9k
    for (unsigned int j = 0; j < count; j++)
1842
9.33k
      c->match_positions.arrayZ[j] += delta;
1843
8.56k
  }
1844
1845
17.1k
  for (unsigned int i = 0; i < lookupCount && buffer->successful; i++)
1846
8.56k
  {
1847
8.56k
    unsigned int idx = lookupRecord[i].sequenceIndex;
1848
8.56k
    if (idx >= count)
1849
0
      continue;
1850
1851
8.56k
    unsigned int orig_len = buffer->backtrack_len () + buffer->lookahead_len ();
1852
1853
    /* This can happen if earlier recursed lookups deleted many entries. */
1854
8.56k
    if (unlikely (c->match_positions.arrayZ[idx] >= orig_len))
1855
0
      continue;
1856
1857
8.56k
    if (unlikely (!buffer->move_to (c->match_positions.arrayZ[idx])))
1858
0
      break;
1859
1860
8.56k
    if (unlikely (buffer->max_ops <= 0))
1861
0
      break;
1862
1863
8.56k
    if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
1864
0
    {
1865
0
      if (buffer->have_output)
1866
0
        c->buffer->sync_so_far ();
1867
0
      c->buffer->message (c->font,
1868
0
        "recursing to lookup %u at %u",
1869
0
        (unsigned) lookupRecord[i].lookupListIndex,
1870
0
        buffer->idx);
1871
0
    }
1872
1873
8.56k
    if (!c->recurse (lookupRecord[i].lookupListIndex))
1874
747
      continue;
1875
1876
7.81k
    if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
1877
0
    {
1878
0
      if (buffer->have_output)
1879
0
        c->buffer->sync_so_far ();
1880
0
      c->buffer->message (c->font,
1881
0
        "recursed to lookup %u",
1882
0
        (unsigned) lookupRecord[i].lookupListIndex);
1883
0
    }
1884
1885
7.81k
    unsigned int new_len = buffer->backtrack_len () + buffer->lookahead_len ();
1886
7.81k
    int delta = new_len - orig_len;
1887
1888
7.81k
    if (!delta)
1889
7.78k
      continue;
1890
1891
    /* Recursed lookup changed buffer len.  Adjust.
1892
     *
1893
     * TODO:
1894
     *
1895
     * Right now, if buffer length increased by n, we assume n new glyphs
1896
     * were added right after the current position, and if buffer length
1897
     * was decreased by n, we assume n match positions after the current
1898
     * one where removed.  The former (buffer length increased) case is
1899
     * fine, but the decrease case can be improved in at least two ways,
1900
     * both of which are significant:
1901
     *
1902
     *   - If recursed-to lookup is MultipleSubst and buffer length
1903
     *     decreased, then it's current match position that was deleted,
1904
     *     NOT the one after it.
1905
     *
1906
     *   - If buffer length was decreased by n, it does not necessarily
1907
     *     mean that n match positions where removed, as there recursed-to
1908
     *     lookup might had a different LookupFlag.  Here's a constructed
1909
     *     case of that:
1910
     *     https://github.com/harfbuzz/harfbuzz/discussions/3538
1911
     *
1912
     * It should be possible to construct tests for both of these cases.
1913
     */
1914
1915
29
    end += delta;
1916
29
    if (end < int (c->match_positions.arrayZ[idx]))
1917
0
    {
1918
      /* End might end up being smaller than match_positions.arrayZ[idx] if the recursed
1919
       * lookup ended up removing many items.
1920
       * Just never rewind end beyond start of current position, since that is
1921
       * not possible in the recursed lookup.  Also adjust delta as such.
1922
       *
1923
       * https://bugs.chromium.org/p/chromium/issues/detail?id=659496
1924
       * https://github.com/harfbuzz/harfbuzz/issues/1611
1925
       */
1926
0
      delta += c->match_positions.arrayZ[idx] - end;
1927
0
      end = c->match_positions.arrayZ[idx];
1928
0
    }
1929
1930
29
    unsigned int next = idx + 1; /* next now is the position after the recursed lookup. */
1931
1932
29
    if (delta > 0)
1933
0
    {
1934
0
      if (unlikely (delta + count > HB_MAX_CONTEXT_LENGTH))
1935
0
  break;
1936
0
      if (unlikely (count + delta > c->match_positions.length &&
1937
0
        !c->match_positions.resize_dirty  (count + delta)))
1938
0
        return;
1939
0
    }
1940
29
    else
1941
29
    {
1942
      /* NOTE: delta is non-positive. */
1943
29
      delta = hb_max (delta, (int) next - (int) count);
1944
29
      next -= delta;
1945
29
    }
1946
1947
    /* Shift! */
1948
29
    memmove (c->match_positions + next + delta, c->match_positions + next,
1949
29
       (count - next) * sizeof (c->match_positions.arrayZ[0]));
1950
29
    next += delta;
1951
29
    count += delta;
1952
1953
    /* Fill in new entries. */
1954
29
    for (unsigned int j = idx + 1; j < next; j++)
1955
0
      c->match_positions.arrayZ[j] = c->match_positions.arrayZ[j - 1] + 1;
1956
1957
    /* And fixup the rest. */
1958
29
    for (; next < count; next++)
1959
0
      c->match_positions.arrayZ[next] += delta;
1960
29
  }
1961
1962
8.56k
  assert (end >= 0);
1963
8.56k
  (void) buffer->move_to (end);
1964
8.56k
}
Unexecuted instantiation: hb-aat-layout.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, OT::LookupRecord const*, unsigned int)
Unexecuted instantiation: hb-ot-face.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, OT::LookupRecord const*, unsigned int)
hb-ot-layout.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, OT::LookupRecord const*, unsigned int)
Line
Count
Source
1829
8.56k
{
1830
8.56k
  hb_buffer_t *buffer = c->buffer;
1831
8.56k
  int end;
1832
1833
  /* All positions are distance from beginning of *output* buffer.
1834
   * Adjust. */
1835
8.56k
  {
1836
8.56k
    unsigned int bl = buffer->backtrack_len ();
1837
8.56k
    end = bl + match_end - buffer->idx;
1838
1839
8.56k
    int delta = bl - buffer->idx;
1840
    /* Convert positions to new indexing. */
1841
17.9k
    for (unsigned int j = 0; j < count; j++)
1842
9.33k
      c->match_positions.arrayZ[j] += delta;
1843
8.56k
  }
1844
1845
17.1k
  for (unsigned int i = 0; i < lookupCount && buffer->successful; i++)
1846
8.56k
  {
1847
8.56k
    unsigned int idx = lookupRecord[i].sequenceIndex;
1848
8.56k
    if (idx >= count)
1849
0
      continue;
1850
1851
8.56k
    unsigned int orig_len = buffer->backtrack_len () + buffer->lookahead_len ();
1852
1853
    /* This can happen if earlier recursed lookups deleted many entries. */
1854
8.56k
    if (unlikely (c->match_positions.arrayZ[idx] >= orig_len))
1855
0
      continue;
1856
1857
8.56k
    if (unlikely (!buffer->move_to (c->match_positions.arrayZ[idx])))
1858
0
      break;
1859
1860
8.56k
    if (unlikely (buffer->max_ops <= 0))
1861
0
      break;
1862
1863
8.56k
    if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
1864
0
    {
1865
0
      if (buffer->have_output)
1866
0
        c->buffer->sync_so_far ();
1867
0
      c->buffer->message (c->font,
1868
0
        "recursing to lookup %u at %u",
1869
0
        (unsigned) lookupRecord[i].lookupListIndex,
1870
0
        buffer->idx);
1871
0
    }
1872
1873
8.56k
    if (!c->recurse (lookupRecord[i].lookupListIndex))
1874
747
      continue;
1875
1876
7.81k
    if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
1877
0
    {
1878
0
      if (buffer->have_output)
1879
0
        c->buffer->sync_so_far ();
1880
0
      c->buffer->message (c->font,
1881
0
        "recursed to lookup %u",
1882
0
        (unsigned) lookupRecord[i].lookupListIndex);
1883
0
    }
1884
1885
7.81k
    unsigned int new_len = buffer->backtrack_len () + buffer->lookahead_len ();
1886
7.81k
    int delta = new_len - orig_len;
1887
1888
7.81k
    if (!delta)
1889
7.78k
      continue;
1890
1891
    /* Recursed lookup changed buffer len.  Adjust.
1892
     *
1893
     * TODO:
1894
     *
1895
     * Right now, if buffer length increased by n, we assume n new glyphs
1896
     * were added right after the current position, and if buffer length
1897
     * was decreased by n, we assume n match positions after the current
1898
     * one where removed.  The former (buffer length increased) case is
1899
     * fine, but the decrease case can be improved in at least two ways,
1900
     * both of which are significant:
1901
     *
1902
     *   - If recursed-to lookup is MultipleSubst and buffer length
1903
     *     decreased, then it's current match position that was deleted,
1904
     *     NOT the one after it.
1905
     *
1906
     *   - If buffer length was decreased by n, it does not necessarily
1907
     *     mean that n match positions where removed, as there recursed-to
1908
     *     lookup might had a different LookupFlag.  Here's a constructed
1909
     *     case of that:
1910
     *     https://github.com/harfbuzz/harfbuzz/discussions/3538
1911
     *
1912
     * It should be possible to construct tests for both of these cases.
1913
     */
1914
1915
29
    end += delta;
1916
29
    if (end < int (c->match_positions.arrayZ[idx]))
1917
0
    {
1918
      /* End might end up being smaller than match_positions.arrayZ[idx] if the recursed
1919
       * lookup ended up removing many items.
1920
       * Just never rewind end beyond start of current position, since that is
1921
       * not possible in the recursed lookup.  Also adjust delta as such.
1922
       *
1923
       * https://bugs.chromium.org/p/chromium/issues/detail?id=659496
1924
       * https://github.com/harfbuzz/harfbuzz/issues/1611
1925
       */
1926
0
      delta += c->match_positions.arrayZ[idx] - end;
1927
0
      end = c->match_positions.arrayZ[idx];
1928
0
    }
1929
1930
29
    unsigned int next = idx + 1; /* next now is the position after the recursed lookup. */
1931
1932
29
    if (delta > 0)
1933
0
    {
1934
0
      if (unlikely (delta + count > HB_MAX_CONTEXT_LENGTH))
1935
0
  break;
1936
0
      if (unlikely (count + delta > c->match_positions.length &&
1937
0
        !c->match_positions.resize_dirty  (count + delta)))
1938
0
        return;
1939
0
    }
1940
29
    else
1941
29
    {
1942
      /* NOTE: delta is non-positive. */
1943
29
      delta = hb_max (delta, (int) next - (int) count);
1944
29
      next -= delta;
1945
29
    }
1946
1947
    /* Shift! */
1948
29
    memmove (c->match_positions + next + delta, c->match_positions + next,
1949
29
       (count - next) * sizeof (c->match_positions.arrayZ[0]));
1950
29
    next += delta;
1951
29
    count += delta;
1952
1953
    /* Fill in new entries. */
1954
29
    for (unsigned int j = idx + 1; j < next; j++)
1955
0
      c->match_positions.arrayZ[j] = c->match_positions.arrayZ[j - 1] + 1;
1956
1957
    /* And fixup the rest. */
1958
29
    for (; next < count; next++)
1959
0
      c->match_positions.arrayZ[next] += delta;
1960
29
  }
1961
1962
8.56k
  assert (end >= 0);
1963
8.56k
  (void) buffer->move_to (end);
1964
8.56k
}
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, OT::LookupRecord const*, unsigned int)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, OT::LookupRecord const*, unsigned int)
Unexecuted instantiation: hb-subset.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, OT::LookupRecord const*, unsigned int)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, OT::LookupRecord const*, unsigned int)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, OT::LookupRecord const*, unsigned int)
Unexecuted instantiation: hb-subset-table-var.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, OT::LookupRecord const*, unsigned int)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, OT::LookupRecord const*, unsigned int)
Unexecuted instantiation: hb-subset-table-color.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, OT::LookupRecord const*, unsigned int)
Unexecuted instantiation: hb-subset-table-other.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, OT::LookupRecord const*, unsigned int)
Unexecuted instantiation: gsubgpos-context.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int, OT::LookupRecord const*, unsigned int)
1965
1966
1967
1968
/* Contextual lookups */
1969
1970
struct ContextClosureLookupContext
1971
{
1972
  ContextClosureFuncs funcs;
1973
  ContextFormat context_format;
1974
  const void *intersects_data;
1975
  void *intersects_cache;
1976
  void *intersected_glyphs_cache;
1977
};
1978
1979
struct ContextCollectGlyphsLookupContext
1980
{
1981
  ContextCollectGlyphsFuncs funcs;
1982
  const void *collect_data;
1983
};
1984
1985
struct ContextApplyLookupContext
1986
{
1987
  ContextApplyFuncs funcs;
1988
  const void *match_data;
1989
};
1990
1991
template <typename HBUINT>
1992
static inline bool context_intersects (const hb_set_t *glyphs,
1993
               unsigned int inputCount, /* Including the first glyph (not matched) */
1994
               const HBUINT input[], /* Array of input values--start with second glyph */
1995
               ContextClosureLookupContext &lookup_context)
1996
0
{
1997
0
  return array_is_subset_of (glyphs,
1998
0
           inputCount ? inputCount - 1 : 0, input,
1999
0
           lookup_context.funcs.intersects,
2000
0
           lookup_context.intersects_data,
2001
0
           lookup_context.intersects_cache);
2002
0
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-subset.cc:bool OT::context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-plan-layout.cc:bool OT::context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-layout.cc:bool OT::context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-var.cc:bool OT::context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-cff.cc:bool OT::context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-color.cc:bool OT::context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-other.cc:bool OT::context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: gsubgpos-context.cc:bool OT::context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
2003
2004
template <typename HBUINT>
2005
static inline void context_closure_lookup (hb_closure_context_t *c,
2006
             unsigned int inputCount, /* Including the first glyph (not matched) */
2007
             const HBUINT input[], /* Array of input values--start with second glyph */
2008
             unsigned int lookupCount,
2009
             const LookupRecord lookupRecord[],
2010
             unsigned value, /* Index of first glyph in Coverage or Class value in ClassDef table */
2011
             ContextClosureLookupContext &lookup_context)
2012
0
{
2013
0
  if (context_intersects (c->glyphs,
2014
0
        inputCount, input,
2015
0
        lookup_context))
2016
0
    context_closure_recurse_lookups (c,
2017
0
             inputCount, input,
2018
0
             lookupCount, lookupRecord,
2019
0
             value,
2020
0
             lookup_context.context_format,
2021
0
             lookup_context.intersects_data,
2022
0
             lookup_context.funcs.intersected_glyphs,
2023
0
             lookup_context.intersected_glyphs_cache);
2024
0
}
Unexecuted instantiation: hb-aat-layout.cc:void OT::context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:void OT::context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:void OT::context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-subset.cc:void OT::context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-plan-layout.cc:void OT::context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-layout.cc:void OT::context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-var.cc:void OT::context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-cff.cc:void OT::context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-color.cc:void OT::context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-other.cc:void OT::context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: gsubgpos-context.cc:void OT::context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
2025
2026
template <typename HBUINT>
2027
static inline void context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c,
2028
              unsigned int inputCount, /* Including the first glyph (not matched) */
2029
              const HBUINT input[], /* Array of input values--start with second glyph */
2030
              unsigned int lookupCount,
2031
              const LookupRecord lookupRecord[],
2032
              ContextCollectGlyphsLookupContext &lookup_context)
2033
0
{
2034
0
  collect_array (c, c->input,
2035
0
     inputCount ? inputCount - 1 : 0, input,
2036
0
     lookup_context.funcs.collect, lookup_context.collect_data);
2037
0
  recurse_lookups (c,
2038
0
       lookupCount, lookupRecord);
2039
0
}
Unexecuted instantiation: hb-aat-layout.cc:void OT::context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:void OT::context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:void OT::context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-subset.cc:void OT::context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-subset-plan-layout.cc:void OT::context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-subset-table-layout.cc:void OT::context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-subset-table-var.cc:void OT::context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-subset-table-cff.cc:void OT::context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-subset-table-color.cc:void OT::context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-subset-table-other.cc:void OT::context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: gsubgpos-context.cc:void OT::context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
2040
2041
template <typename HBUINT>
2042
static inline bool context_would_apply_lookup (hb_would_apply_context_t *c,
2043
                 unsigned int inputCount, /* Including the first glyph (not matched) */
2044
                 const HBUINT input[], /* Array of input values--start with second glyph */
2045
                 unsigned int lookupCount HB_UNUSED,
2046
                 const LookupRecord lookupRecord[] HB_UNUSED,
2047
                 const ContextApplyLookupContext &lookup_context)
2048
0
{
2049
0
  return would_match_input (c,
2050
0
          inputCount, input,
2051
0
          lookup_context.funcs.match, lookup_context.match_data);
2052
0
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset.cc:bool OT::context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-plan-layout.cc:bool OT::context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-layout.cc:bool OT::context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-var.cc:bool OT::context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-cff.cc:bool OT::context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-color.cc:bool OT::context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-other.cc:bool OT::context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: gsubgpos-context.cc:bool OT::context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
2053
2054
template <typename HBUINT>
2055
static inline bool context_apply_lookup (hb_ot_apply_context_t *c,
2056
           unsigned int inputCount, /* Including the first glyph (not matched) */
2057
           const HBUINT input[], /* Array of input values--start with second glyph */
2058
           unsigned int lookupCount,
2059
           const LookupRecord lookupRecord[],
2060
           const ContextApplyLookupContext &lookup_context)
2061
0
{
2062
0
  if (unlikely (inputCount > HB_MAX_CONTEXT_LENGTH)) return false;
2063
2064
0
  unsigned match_end = 0;
2065
0
  bool ret = false;
2066
0
  if (match_input (c,
2067
0
       inputCount, input,
2068
0
       lookup_context.funcs.match, lookup_context.match_data,
2069
0
       &match_end))
2070
0
  {
2071
0
    c->buffer->unsafe_to_break (c->buffer->idx, match_end);
2072
0
    apply_lookup (c,
2073
0
      inputCount,
2074
0
      lookupCount, lookupRecord,
2075
0
      match_end);
2076
0
    ret = true;
2077
0
  }
2078
0
  else
2079
0
  {
2080
0
    c->buffer->unsafe_to_concat (c->buffer->idx, match_end);
2081
0
    ret = false;
2082
0
  }
2083
2084
0
  return ret;
2085
0
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset.cc:bool OT::context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-plan-layout.cc:bool OT::context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-layout.cc:bool OT::context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-var.cc:bool OT::context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-cff.cc:bool OT::context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-color.cc:bool OT::context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-other.cc:bool OT::context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: gsubgpos-context.cc:bool OT::context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
2086
2087
static inline bool context_cache_func (hb_ot_apply_context_t *c, hb_ot_subtable_cache_op_t op)
2088
0
{
2089
0
  switch (op)
2090
0
  {
2091
0
    case hb_ot_subtable_cache_op_t::ENTER:
2092
0
    {
2093
0
      if (!HB_BUFFER_TRY_ALLOCATE_VAR (c->buffer, syllable))
2094
0
  return false;
2095
0
      auto &info = c->buffer->info;
2096
0
      unsigned count = c->buffer->len;
2097
0
      for (unsigned i = 0; i < count; i++)
2098
0
  info[i].syllable() = 255;
2099
0
      c->new_syllables = 255;
2100
0
      return true;
2101
0
    }
2102
0
    case hb_ot_subtable_cache_op_t::LEAVE:
2103
0
    {
2104
0
      c->new_syllables = (unsigned) -1;
2105
0
      HB_BUFFER_DEALLOCATE_VAR (c->buffer, syllable);
2106
0
      break;
2107
0
    }
2108
0
  }
2109
0
  return false;
2110
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::context_cache_func(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: hb-ot-face.cc:OT::context_cache_func(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: hb-ot-layout.cc:OT::context_cache_func(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::context_cache_func(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::context_cache_func(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: hb-subset.cc:OT::context_cache_func(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: hb-subset-plan-layout.cc:OT::context_cache_func(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: hb-subset-table-layout.cc:OT::context_cache_func(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: hb-subset-table-var.cc:OT::context_cache_func(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: hb-subset-table-cff.cc:OT::context_cache_func(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: hb-subset-table-color.cc:OT::context_cache_func(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: hb-subset-table-other.cc:OT::context_cache_func(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
Unexecuted instantiation: gsubgpos-context.cc:OT::context_cache_func(OT::hb_ot_apply_context_t*, OT::hb_ot_subtable_cache_op_t)
2111
2112
template <typename Types>
2113
struct Rule
2114
{
2115
  template <typename T>
2116
  friend struct RuleSet;
2117
2118
  bool intersects (const hb_set_t *glyphs, ContextClosureLookupContext &lookup_context) const
2119
0
  {
2120
0
    return context_intersects (glyphs,
2121
0
             inputCount, inputZ.arrayZ,
2122
0
             lookup_context);
2123
0
  }
2124
2125
  void closure (hb_closure_context_t *c, unsigned value, ContextClosureLookupContext &lookup_context) const
2126
0
  {
2127
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
2128
2129
0
    const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
2130
0
             (inputZ.as_array ((inputCount ? inputCount - 1 : 0)));
2131
0
    context_closure_lookup (c,
2132
0
          inputCount, inputZ.arrayZ,
2133
0
          lookupCount, lookupRecord.arrayZ,
2134
0
          value, lookup_context);
2135
0
  }
2136
2137
  void closure_lookups (hb_closure_lookups_context_t *c,
2138
                        ContextClosureLookupContext &lookup_context) const
2139
0
  {
2140
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
2141
0
    if (!intersects (c->glyphs, lookup_context)) return;
2142
2143
0
    const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
2144
0
             (inputZ.as_array (inputCount ? inputCount - 1 : 0));
2145
0
    recurse_lookups (c, lookupCount, lookupRecord.arrayZ);
2146
0
  }
2147
2148
  void collect_glyphs (hb_collect_glyphs_context_t *c,
2149
           ContextCollectGlyphsLookupContext &lookup_context) const
2150
0
  {
2151
0
    const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
2152
0
             (inputZ.as_array (inputCount ? inputCount - 1 : 0));
2153
0
    context_collect_glyphs_lookup (c,
2154
0
           inputCount, inputZ.arrayZ,
2155
0
           lookupCount, lookupRecord.arrayZ,
2156
0
           lookup_context);
2157
0
  }
2158
2159
  bool would_apply (hb_would_apply_context_t *c,
2160
        const ContextApplyLookupContext &lookup_context) const
2161
0
  {
2162
0
    const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
2163
0
             (inputZ.as_array (inputCount ? inputCount - 1 : 0));
2164
0
    return context_would_apply_lookup (c,
2165
0
               inputCount, inputZ.arrayZ,
2166
0
               lookupCount, lookupRecord.arrayZ,
2167
0
               lookup_context);
2168
0
  }
2169
2170
  bool apply (hb_ot_apply_context_t *c,
2171
        const ContextApplyLookupContext &lookup_context) const
2172
0
  {
2173
0
    TRACE_APPLY (this);
2174
0
    const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
2175
0
             (inputZ.as_array (inputCount ? inputCount - 1 : 0));
2176
0
    return_trace (context_apply_lookup (c, inputCount, inputZ.arrayZ, lookupCount, lookupRecord.arrayZ, lookup_context));
2177
0
  }
2178
2179
  bool serialize (hb_serialize_context_t *c,
2180
      const hb_map_t *input_mapping, /* old->new glyphid or class mapping */
2181
      const hb_map_t *lookup_map) const
2182
0
  {
2183
0
    TRACE_SERIALIZE (this);
2184
0
    auto *out = c->start_embed (this);
2185
0
    if (unlikely (!c->extend_min (out))) return_trace (false);
2186
2187
0
    out->inputCount = inputCount;
2188
0
    const auto input = inputZ.as_array (inputCount - 1);
2189
0
    for (const auto org : input)
2190
0
    {
2191
0
      HBUINT16 d;
2192
0
      d = input_mapping->get (org);
2193
0
      c->copy (d);
2194
0
    }
2195
2196
0
    const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
2197
0
             (inputZ.as_array ((inputCount ? inputCount - 1 : 0)));
2198
2199
0
    unsigned count = serialize_lookuprecord_array (c, lookupRecord.as_array (lookupCount), lookup_map);
2200
0
    return_trace (c->check_assign (out->lookupCount, count, HB_SERIALIZE_ERROR_INT_OVERFLOW));
2201
0
  }
2202
2203
  bool subset (hb_subset_context_t *c,
2204
         const hb_map_t *lookup_map,
2205
         const hb_map_t *klass_map = nullptr) const
2206
0
  {
2207
0
    TRACE_SUBSET (this);
2208
0
    if (unlikely (!inputCount)) return_trace (false);
2209
0
    const auto input = inputZ.as_array (inputCount - 1);
2210
2211
0
    const hb_map_t *mapping = klass_map == nullptr ? c->plan->glyph_map : klass_map;
2212
0
    if (!hb_all (input, mapping)) return_trace (false);
2213
0
    return_trace (serialize (c->serializer, mapping, lookup_map));
2214
0
  }
2215
2216
  public:
2217
  bool sanitize (hb_sanitize_context_t *c) const
2218
0
  {
2219
0
    TRACE_SANITIZE (this);
2220
0
    return_trace (c->check_struct (this) &&
2221
0
      hb_barrier () &&
2222
0
      c->check_range (inputZ.arrayZ,
2223
0
          inputZ.item_size * (inputCount ? inputCount - 1 : 0) +
2224
0
          LookupRecord::static_size * lookupCount));
2225
0
  }
2226
2227
  protected:
2228
  HBUINT16  inputCount;   /* Total number of glyphs in input
2229
           * glyph sequence--includes the first
2230
           * glyph */
2231
  HBUINT16  lookupCount;    /* Number of LookupRecords */
2232
  UnsizedArrayOf<typename Types::HBUINT>
2233
    inputZ;     /* Array of match inputs--start with
2234
           * second glyph */
2235
/*UnsizedArrayOf<LookupRecord>
2236
    lookupRecordX;*/  /* Array of LookupRecords--in
2237
           * design order */
2238
  public:
2239
  DEFINE_SIZE_ARRAY (4, inputZ);
2240
};
2241
2242
template <typename Types>
2243
struct RuleSet
2244
{
2245
  using Rule = OT::Rule<Types>;
2246
2247
  bool intersects (const hb_set_t *glyphs,
2248
       ContextClosureLookupContext &lookup_context) const
2249
0
  {
2250
0
    return
2251
0
    + hb_iter (rule)
2252
0
    | hb_map (hb_add (this))
2253
0
    | hb_map ([&] (const Rule &_) { return _.intersects (glyphs, lookup_context); })
2254
0
    | hb_any
2255
0
    ;
2256
0
  }
2257
2258
  void closure (hb_closure_context_t *c, unsigned value,
2259
    ContextClosureLookupContext &lookup_context) const
2260
0
  {
2261
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
2262
2263
0
    return
2264
0
    + hb_iter (rule)
2265
0
    | hb_map (hb_add (this))
2266
0
    | hb_apply ([&] (const Rule &_) { _.closure (c, value, lookup_context); })
2267
0
    ;
2268
0
  }
2269
2270
  void closure_lookups (hb_closure_lookups_context_t *c,
2271
                        ContextClosureLookupContext &lookup_context) const
2272
0
  {
2273
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
2274
0
    + hb_iter (rule)
2275
0
    | hb_map (hb_add (this))
2276
0
    | hb_apply ([&] (const Rule &_) { _.closure_lookups (c, lookup_context); })
2277
0
    ;
2278
0
  }
2279
2280
  void collect_glyphs (hb_collect_glyphs_context_t *c,
2281
           ContextCollectGlyphsLookupContext &lookup_context) const
2282
0
  {
2283
0
    return
2284
0
    + hb_iter (rule)
2285
0
    | hb_map (hb_add (this))
2286
0
    | hb_apply ([&] (const Rule &_) { _.collect_glyphs (c, lookup_context); })
2287
0
    ;
2288
0
  }
2289
2290
  bool would_apply (hb_would_apply_context_t *c,
2291
        const ContextApplyLookupContext &lookup_context) const
2292
0
  {
2293
0
    return
2294
0
    + hb_iter (rule)
2295
0
    | hb_map (hb_add (this))
2296
0
    | hb_map ([&] (const Rule &_) { return _.would_apply (c, lookup_context); })
2297
0
    | hb_any
2298
0
    ;
2299
0
  }
2300
2301
  bool apply (hb_ot_apply_context_t *c,
2302
        const ContextApplyLookupContext &lookup_context) const
2303
0
  {
2304
0
    TRACE_APPLY (this);
2305
2306
0
    unsigned num_rules = rule.len;
2307
2308
0
#ifndef HB_NO_OT_RULESETS_FAST_PATH
2309
0
    if (HB_OPTIMIZE_SIZE_VAL || num_rules <= 4)
2310
0
#endif
2311
0
    {
2312
0
    slow:
2313
0
      return_trace (
2314
0
      + hb_iter (rule)
2315
0
      | hb_map (hb_add (this))
2316
0
      | hb_map ([&] (const Rule &_) { return _.apply (c, lookup_context); })
2317
0
      | hb_any
2318
0
      )
2319
0
      ;
2320
0
    }
2321
2322
    /* This version is optimized for speed by matching the first & second
2323
     * components of the rule here, instead of calling into the matching code.
2324
     *
2325
     * Replicated from LigatureSet::apply(). */
2326
2327
    /* We use the iter_context instead of iter_input, to avoid skipping
2328
     * default-ignorables and such.
2329
     *
2330
     * Related: https://github.com/harfbuzz/harfbuzz/issues/4813
2331
     */
2332
0
    auto &skippy_iter = c->iter_context;
2333
0
    skippy_iter.reset (c->buffer->idx);
2334
0
    skippy_iter.set_match_func (match_always, nullptr);
2335
0
    skippy_iter.set_glyph_data ((HBUINT16 *) nullptr);
2336
0
    unsigned unsafe_to = (unsigned) -1, unsafe_to1, unsafe_to2 = 0;
2337
0
    hb_glyph_info_t *first = nullptr, *second = nullptr;
2338
0
    bool matched = skippy_iter.next ();
2339
0
    if (likely (matched))
2340
0
    {
2341
0
      if (skippy_iter.may_skip (c->buffer->info[skippy_iter.idx]))
2342
0
      {
2343
  /* Can't use the fast path if eg. the next char is a default-ignorable
2344
   * or other skippable. */
2345
0
        goto slow;
2346
0
      }
2347
2348
0
      first = &c->buffer->info[skippy_iter.idx];
2349
0
      unsafe_to1 = skippy_iter.idx + 1;
2350
0
    }
2351
0
    else
2352
0
    {
2353
      /* Failed to match a next glyph. Only try applying rules that have
2354
       * no further input. */
2355
0
      return_trace (
2356
0
      + hb_iter (rule)
2357
0
      | hb_map (hb_add (this))
2358
0
      | hb_filter ([&] (const Rule &_) { return _.inputCount <= 1; })
2359
0
      | hb_map ([&] (const Rule &_) { return _.apply (c, lookup_context); })
2360
0
      | hb_any
2361
0
      )
2362
0
      ;
2363
0
    }
2364
0
    matched = skippy_iter.next ();
2365
0
    if (likely (matched))
2366
0
    {
2367
0
      if (skippy_iter.may_skip (c->buffer->info[skippy_iter.idx]))
2368
0
      {
2369
  /* Can't use the fast path if eg. the next char is a default-ignorable
2370
   * or other skippable. */
2371
0
        goto slow;
2372
0
      }
2373
2374
0
      second = &c->buffer->info[skippy_iter.idx];
2375
0
      unsafe_to2 = skippy_iter.idx + 1;
2376
0
    }
2377
2378
0
    auto match_input = lookup_context.funcs.match;
2379
0
    auto *input_data = lookup_context.match_data;
2380
0
    for (unsigned int i = 0; i < num_rules; i++)
2381
0
    {
2382
0
      const auto &r = this+rule.arrayZ[i];
2383
2384
0
      const auto &input = r.inputZ;
2385
2386
0
      if (r.inputCount <= 1 ||
2387
0
    (!match_input ||
2388
0
     match_input (*first, input.arrayZ[0], input_data)))
2389
0
      {
2390
0
        if (!second ||
2391
0
      (r.inputCount <= 2 ||
2392
0
       (!match_input ||
2393
0
        match_input (*second, input.arrayZ[1], input_data)))
2394
0
     )
2395
0
  {
2396
0
    if (r.apply (c, lookup_context))
2397
0
    {
2398
0
      if (unsafe_to != (unsigned) -1)
2399
0
        c->buffer->unsafe_to_concat (c->buffer->idx, unsafe_to);
2400
0
      return_trace (true);
2401
0
    }
2402
0
  }
2403
0
  else
2404
0
    unsafe_to = unsafe_to2;
2405
0
      }
2406
0
      else
2407
0
      {
2408
0
  if (unsafe_to == (unsigned) -1)
2409
0
    unsafe_to = unsafe_to1;
2410
2411
  // Skip ahead to next possible first glyph match.
2412
0
  for (; i + 1 < num_rules; i++)
2413
0
  {
2414
0
    const auto &r2 = this+rule.arrayZ[i + 1];
2415
0
    const auto &input2 = r2.inputZ;
2416
0
    if (r2.inputCount <= 1 || input2.arrayZ[0] != input.arrayZ[0])
2417
0
      break;
2418
0
  }
2419
0
      }
2420
0
    }
2421
0
    if (likely (unsafe_to != (unsigned) -1))
2422
0
      c->buffer->unsafe_to_concat (c->buffer->idx, unsafe_to);
2423
2424
0
    return_trace (false);
2425
0
  }
2426
2427
  bool subset (hb_subset_context_t *c,
2428
         const hb_map_t *lookup_map,
2429
         const hb_map_t *klass_map = nullptr) const
2430
0
  {
2431
0
    TRACE_SUBSET (this);
2432
2433
0
    auto snap = c->serializer->snapshot ();
2434
0
    auto *out = c->serializer->start_embed (*this);
2435
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
2436
2437
0
    for (const Offset16To<Rule>& _ : rule)
2438
0
    {
2439
0
      if (!_) continue;
2440
0
      auto o_snap = c->serializer->snapshot ();
2441
0
      auto *o = out->rule.serialize_append (c->serializer);
2442
0
      if (unlikely (!o)) continue;
2443
2444
0
      if (!o->serialize_subset (c, _, this, lookup_map, klass_map))
2445
0
      {
2446
0
  out->rule.pop ();
2447
0
  c->serializer->revert (o_snap);
2448
0
      }
2449
0
    }
2450
2451
0
    bool ret = bool (out->rule);
2452
0
    if (!ret) c->serializer->revert (snap);
2453
2454
0
    return_trace (ret);
2455
0
  }
2456
2457
  bool sanitize (hb_sanitize_context_t *c) const
2458
0
  {
2459
0
    TRACE_SANITIZE (this);
2460
0
    return_trace (rule.sanitize (c, this));
2461
0
  }
2462
2463
  protected:
2464
  Array16OfOffset16To<Rule>
2465
    rule;     /* Array of Rule tables
2466
           * ordered by preference */
2467
  public:
2468
  DEFINE_SIZE_ARRAY (2, rule);
2469
};
2470
2471
2472
template <typename Types>
2473
struct ContextFormat1_4
2474
{
2475
  using RuleSet = OT::RuleSet<Types>;
2476
2477
  bool intersects (const hb_set_t *glyphs) const
2478
0
  {
2479
0
    struct ContextClosureLookupContext lookup_context = {
2480
0
      {intersects_glyph, intersected_glyph},
2481
0
      ContextFormat::SimpleContext,
2482
0
      nullptr
2483
0
    };
2484
2485
0
    return
2486
0
    + hb_zip (this+coverage, ruleSet)
2487
0
    | hb_filter (*glyphs, hb_first)
2488
0
    | hb_map (hb_second)
2489
0
    | hb_map (hb_add (this))
2490
0
    | hb_map ([&] (const RuleSet &_) { return _.intersects (glyphs, lookup_context); })
2491
0
    | hb_any
2492
0
    ;
2493
0
  }
2494
2495
  bool may_have_non_1to1 () const
2496
0
  { return true; }
2497
2498
  void closure (hb_closure_context_t *c) const
2499
0
  {
2500
0
    hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs ();
2501
0
    if (unlikely (!cur_active_glyphs)) return;
2502
0
    get_coverage ().intersect_set (c->previous_parent_active_glyphs (), *cur_active_glyphs);
2503
2504
0
    struct ContextClosureLookupContext lookup_context = {
2505
0
      {intersects_glyph, intersected_glyph},
2506
0
      ContextFormat::SimpleContext,
2507
0
      nullptr
2508
0
    };
2509
2510
0
    + hb_zip (this+coverage, hb_range ((unsigned) ruleSet.len))
2511
0
    | hb_filter ([&] (hb_codepoint_t _) {
2512
0
      return c->previous_parent_active_glyphs ().has (_);
2513
0
    }, hb_first)
2514
0
    | hb_map ([&](const hb_pair_t<hb_codepoint_t, unsigned> _) { return hb_pair_t<unsigned, const RuleSet&> (_.first, this+ruleSet[_.second]); })
2515
0
    | hb_apply ([&] (const hb_pair_t<unsigned, const RuleSet&>& _) { _.second.closure (c, _.first, lookup_context); })
2516
0
    ;
2517
2518
0
    c->pop_cur_done_glyphs ();
2519
0
  }
2520
2521
  void closure_lookups (hb_closure_lookups_context_t *c) const
2522
0
  {
2523
0
    struct ContextClosureLookupContext lookup_context = {
2524
0
      {intersects_glyph, nullptr},
2525
0
      ContextFormat::SimpleContext,
2526
0
      nullptr
2527
0
    };
2528
2529
0
    + hb_zip (this+coverage, ruleSet)
2530
0
    | hb_filter (*c->glyphs, hb_first)
2531
0
    | hb_map (hb_second)
2532
0
    | hb_map (hb_add (this))
2533
0
    | hb_apply ([&] (const RuleSet &_) { _.closure_lookups (c, lookup_context); })
2534
0
    ;
2535
0
  }
2536
2537
0
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const {}
2538
2539
  void collect_glyphs (hb_collect_glyphs_context_t *c) const
2540
0
  {
2541
0
    (this+coverage).collect_coverage (c->input);
2542
2543
0
    struct ContextCollectGlyphsLookupContext lookup_context = {
2544
0
      {collect_glyph},
2545
0
      nullptr
2546
0
    };
2547
2548
0
    + hb_iter (ruleSet)
2549
0
    | hb_map (hb_add (this))
2550
0
    | hb_apply ([&] (const RuleSet &_) { _.collect_glyphs (c, lookup_context); })
2551
0
    ;
2552
0
  }
2553
2554
  bool would_apply (hb_would_apply_context_t *c) const
2555
0
  {
2556
0
    const RuleSet &rule_set = this+ruleSet[(this+coverage).get_coverage (c->glyphs[0])];
2557
0
    struct ContextApplyLookupContext lookup_context = {
2558
0
      {match_glyph},
2559
0
      nullptr
2560
0
    };
2561
0
    return rule_set.would_apply (c, lookup_context);
2562
0
  }
2563
2564
0
  const Coverage &get_coverage () const { return this+coverage; }
2565
2566
  bool apply (hb_ot_apply_context_t *c) const
2567
0
  {
2568
0
    TRACE_APPLY (this);
2569
0
    unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
2570
0
    if (likely (index == NOT_COVERED))
2571
0
      return_trace (false);
2572
2573
0
    const RuleSet &rule_set = this+ruleSet[index];
2574
0
    struct ContextApplyLookupContext lookup_context = {
2575
0
      {match_glyph},
2576
0
      nullptr
2577
0
    };
2578
0
    return_trace (rule_set.apply (c, lookup_context));
2579
0
  }
2580
2581
  bool subset (hb_subset_context_t *c) const
2582
0
  {
2583
0
    TRACE_SUBSET (this);
2584
0
    const hb_set_t &glyphset = *c->plan->glyphset_gsub ();
2585
0
    const hb_map_t &glyph_map = *c->plan->glyph_map;
2586
2587
0
    auto *out = c->serializer->start_embed (*this);
2588
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
2589
0
    out->format = format;
2590
2591
0
    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
2592
0
    hb_sorted_vector_t<hb_codepoint_t> new_coverage;
2593
0
    + hb_zip (this+coverage, ruleSet)
2594
0
    | hb_filter (glyphset, hb_first)
2595
0
    | hb_filter (subset_offset_array (c, out->ruleSet, this, lookup_map), hb_second)
2596
0
    | hb_map (hb_first)
2597
0
    | hb_map (glyph_map)
2598
0
    | hb_sink (new_coverage)
2599
0
    ;
2600
2601
0
    out->coverage.serialize_serialize (c->serializer, new_coverage.iter ());
2602
0
    return_trace (bool (new_coverage));
2603
0
  }
2604
2605
  bool sanitize (hb_sanitize_context_t *c) const
2606
0
  {
2607
0
    TRACE_SANITIZE (this);
2608
0
    return_trace (coverage.sanitize (c, this) && ruleSet.sanitize (c, this));
2609
0
  }
2610
2611
  protected:
2612
  HBUINT16  format;     /* Format identifier--format = 1 */
2613
  typename Types::template OffsetTo<Coverage>
2614
    coverage;   /* Offset to Coverage table--from
2615
           * beginning of table */
2616
  Array16Of<typename Types::template OffsetTo<RuleSet>>
2617
    ruleSet;    /* Array of RuleSet tables
2618
           * ordered by Coverage Index */
2619
  public:
2620
  DEFINE_SIZE_ARRAY (2 + 2 * Types::size, ruleSet);
2621
};
2622
2623
2624
template <typename Types>
2625
struct ContextFormat2_5
2626
{
2627
  using RuleSet = OT::RuleSet<SmallTypes>;
2628
2629
  bool intersects (const hb_set_t *glyphs) const
2630
0
  {
2631
0
    if (!(this+coverage).intersects (glyphs))
2632
0
      return false;
2633
2634
0
    const ClassDef &class_def = this+classDef;
2635
2636
0
    hb_map_t cache;
2637
0
    struct ContextClosureLookupContext lookup_context = {
2638
0
      {intersects_class, nullptr},
2639
0
      ContextFormat::ClassBasedContext,
2640
0
      &class_def,
2641
0
      &cache
2642
0
    };
2643
2644
0
    hb_set_t retained_coverage_glyphs;
2645
0
    (this+coverage).intersect_set (*glyphs, retained_coverage_glyphs);
2646
2647
0
    hb_set_t coverage_glyph_classes;
2648
0
    class_def.intersected_classes (&retained_coverage_glyphs, &coverage_glyph_classes);
2649
2650
2651
0
    return
2652
0
    + hb_iter (ruleSet)
2653
0
    | hb_map (hb_add (this))
2654
0
    | hb_enumerate
2655
0
    | hb_map ([&] (const hb_pair_t<unsigned, const RuleSet &> p)
2656
0
        { return class_def.intersects_class (glyphs, p.first) &&
2657
0
           coverage_glyph_classes.has (p.first) &&
2658
0
           p.second.intersects (glyphs, lookup_context); })
2659
0
    | hb_any
2660
0
    ;
2661
0
  }
2662
2663
  bool may_have_non_1to1 () const
2664
0
  { return true; }
2665
2666
  void closure (hb_closure_context_t *c) const
2667
0
  {
2668
0
    if (!(this+coverage).intersects (c->glyphs))
2669
0
      return;
2670
2671
0
    hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs ();
2672
0
    if (unlikely (!cur_active_glyphs)) return;
2673
0
    get_coverage ().intersect_set (c->previous_parent_active_glyphs (),
2674
0
           *cur_active_glyphs);
2675
2676
0
    const ClassDef &class_def = this+classDef;
2677
2678
0
    hb_map_t cache;
2679
0
    intersected_class_cache_t intersected_cache;
2680
0
    struct ContextClosureLookupContext lookup_context = {
2681
0
      {intersects_class, intersected_class_glyphs},
2682
0
      ContextFormat::ClassBasedContext,
2683
0
      &class_def,
2684
0
      &cache,
2685
0
      &intersected_cache
2686
0
    };
2687
2688
0
    + hb_enumerate (ruleSet)
2689
0
    | hb_filter ([&] (unsigned _)
2690
0
    { return class_def.intersects_class (&c->parent_active_glyphs (), _); },
2691
0
     hb_first)
2692
0
    | hb_apply ([&] (const hb_pair_t<unsigned, const typename Types::template OffsetTo<RuleSet>&> _)
2693
0
                {
2694
0
                  const RuleSet& rule_set = this+_.second;
2695
0
                  rule_set.closure (c, _.first, lookup_context);
2696
0
                })
2697
0
    ;
2698
2699
0
    c->pop_cur_done_glyphs ();
2700
0
  }
2701
2702
  void closure_lookups (hb_closure_lookups_context_t *c) const
2703
0
  {
2704
0
    if (!(this+coverage).intersects (c->glyphs))
2705
0
      return;
2706
2707
0
    const ClassDef &class_def = this+classDef;
2708
2709
0
    hb_map_t cache;
2710
0
    struct ContextClosureLookupContext lookup_context = {
2711
0
      {intersects_class, nullptr},
2712
0
      ContextFormat::ClassBasedContext,
2713
0
      &class_def,
2714
0
      &cache
2715
0
    };
2716
2717
0
    + hb_iter (ruleSet)
2718
0
    | hb_map (hb_add (this))
2719
0
    | hb_enumerate
2720
0
    | hb_filter ([&] (const hb_pair_t<unsigned, const RuleSet &> p)
2721
0
    { return class_def.intersects_class (c->glyphs, p.first); })
2722
0
    | hb_map (hb_second)
2723
0
    | hb_apply ([&] (const RuleSet & _)
2724
0
    { _.closure_lookups (c, lookup_context); });
2725
0
  }
2726
2727
0
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const {}
2728
2729
  void collect_glyphs (hb_collect_glyphs_context_t *c) const
2730
0
  {
2731
0
    (this+coverage).collect_coverage (c->input);
2732
2733
0
    const ClassDef &class_def = this+classDef;
2734
0
    struct ContextCollectGlyphsLookupContext lookup_context = {
2735
0
      {collect_class},
2736
0
      &class_def
2737
0
    };
2738
2739
0
    + hb_iter (ruleSet)
2740
0
    | hb_map (hb_add (this))
2741
0
    | hb_apply ([&] (const RuleSet &_) { _.collect_glyphs (c, lookup_context); })
2742
0
    ;
2743
0
  }
2744
2745
  bool would_apply (hb_would_apply_context_t *c) const
2746
0
  {
2747
0
    const ClassDef &class_def = this+classDef;
2748
0
    unsigned int index = class_def.get_class (c->glyphs[0]);
2749
0
    const RuleSet &rule_set = this+ruleSet[index];
2750
0
    struct ContextApplyLookupContext lookup_context = {
2751
0
      {match_class},
2752
0
      &class_def
2753
0
    };
2754
0
    return rule_set.would_apply (c, lookup_context);
2755
0
  }
2756
2757
0
  const Coverage &get_coverage () const { return this+coverage; }
2758
2759
  unsigned cache_cost () const
2760
0
  {
2761
0
    return (this+classDef).cost ();
2762
0
  }
2763
  static bool cache_func (hb_ot_apply_context_t *c, hb_ot_subtable_cache_op_t op)
2764
0
  {
2765
0
    return context_cache_func (c, op);
2766
0
  }
2767
2768
  struct external_cache_t
2769
  {
2770
    hb_ot_layout_binary_cache_t coverage;
2771
  };
2772
  void *external_cache_create () const
2773
0
  {
2774
0
    external_cache_t *cache = (external_cache_t *) hb_malloc (sizeof (external_cache_t));
2775
0
    if (likely (cache))
2776
0
    {
2777
0
      cache->coverage.clear ();
2778
0
    }
2779
0
    return cache;
2780
0
  }
2781
0
  bool apply_cached (hb_ot_apply_context_t *c, void *external_cache) const { return _apply (c, true, external_cache); }
2782
0
  bool apply (hb_ot_apply_context_t *c, void *external_cache) const { return _apply (c, false, external_cache); }
2783
  bool _apply (hb_ot_apply_context_t *c, bool cached, void *external_cache) const
2784
0
  {
2785
0
    TRACE_APPLY (this);
2786
0
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
2787
0
    external_cache_t *cache = (external_cache_t *) external_cache;
2788
0
    unsigned int index = (this+coverage).get_coverage_binary (c->buffer->cur().codepoint, cache ? &cache->coverage : nullptr);
2789
#else
2790
    unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
2791
#endif
2792
0
    if (index == NOT_COVERED) return_trace (false);
2793
2794
0
    const ClassDef &class_def = this+classDef;
2795
2796
0
    struct ContextApplyLookupContext lookup_context = {
2797
0
      {cached ? match_class_cached : match_class},
2798
0
      &class_def
2799
0
    };
2800
2801
0
    index = cached ? get_class_cached (class_def, c->buffer->cur()) : class_def.get_class (c->buffer->cur().codepoint);
2802
0
    const RuleSet &rule_set = this+ruleSet[index];
2803
0
    return_trace (rule_set.apply (c, lookup_context));
2804
0
  }
2805
2806
  bool subset (hb_subset_context_t *c) const
2807
0
  {
2808
0
    TRACE_SUBSET (this);
2809
0
    auto *out = c->serializer->start_embed (*this);
2810
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
2811
0
    out->format = format;
2812
0
    if (unlikely (!out->coverage.serialize_subset (c, coverage, this)))
2813
0
      return_trace (false);
2814
2815
0
    hb_map_t klass_map;
2816
0
    out->classDef.serialize_subset (c, classDef, this, &klass_map);
2817
2818
0
    const hb_set_t* glyphset = c->plan->glyphset_gsub ();
2819
0
    hb_set_t retained_coverage_glyphs;
2820
0
    (this+coverage).intersect_set (*glyphset, retained_coverage_glyphs);
2821
2822
0
    hb_set_t coverage_glyph_classes;
2823
0
    (this+classDef).intersected_classes (&retained_coverage_glyphs, &coverage_glyph_classes);
2824
2825
0
    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
2826
0
    bool ret = true;
2827
0
    int non_zero_index = -1, index = 0;
2828
0
    auto snapshot = c->serializer->snapshot();
2829
0
    for (const auto& _ : + hb_enumerate (ruleSet)
2830
0
       | hb_filter (klass_map, hb_first))
2831
0
    {
2832
0
      auto *o = out->ruleSet.serialize_append (c->serializer);
2833
0
      if (unlikely (!o))
2834
0
      {
2835
0
  ret = false;
2836
0
  break;
2837
0
      }
2838
2839
0
      if (coverage_glyph_classes.has (_.first) &&
2840
0
    o->serialize_subset (c, _.second, this, lookup_map, &klass_map)) {
2841
0
  non_zero_index = index;
2842
0
        snapshot = c->serializer->snapshot();
2843
0
      }
2844
2845
0
      index++;
2846
0
    }
2847
2848
0
    if (!ret || non_zero_index == -1) return_trace (false);
2849
2850
    //prune empty trailing ruleSets
2851
0
    --index;
2852
0
    while (index > non_zero_index)
2853
0
    {
2854
0
      out->ruleSet.pop ();
2855
0
      index--;
2856
0
    }
2857
0
    c->serializer->revert (snapshot);
2858
2859
0
    return_trace (bool (out->ruleSet));
2860
0
  }
2861
2862
  bool sanitize (hb_sanitize_context_t *c) const
2863
0
  {
2864
0
    TRACE_SANITIZE (this);
2865
0
    return_trace (coverage.sanitize (c, this) && classDef.sanitize (c, this) && ruleSet.sanitize (c, this));
2866
0
  }
2867
2868
  protected:
2869
  HBUINT16  format;     /* Format identifier--format = 2 */
2870
  typename Types::template OffsetTo<Coverage>
2871
    coverage;   /* Offset to Coverage table--from
2872
           * beginning of table */
2873
  typename Types::template OffsetTo<ClassDef>
2874
    classDef;   /* Offset to glyph ClassDef table--from
2875
           * beginning of table */
2876
  Array16Of<typename Types::template OffsetTo<RuleSet>>
2877
    ruleSet;    /* Array of RuleSet tables
2878
           * ordered by class */
2879
  public:
2880
  DEFINE_SIZE_ARRAY (4 + 2 * Types::size, ruleSet);
2881
};
2882
2883
2884
struct ContextFormat3
2885
{
2886
  using RuleSet = OT::RuleSet<SmallTypes>;
2887
2888
  bool intersects (const hb_set_t *glyphs) const
2889
0
  {
2890
0
    if (!(this+coverageZ[0]).intersects (glyphs))
2891
0
      return false;
2892
2893
0
    struct ContextClosureLookupContext lookup_context = {
2894
0
      {intersects_coverage, nullptr},
2895
0
      ContextFormat::CoverageBasedContext,
2896
0
      this
2897
0
    };
2898
0
    return context_intersects (glyphs,
2899
0
             glyphCount, (const HBUINT16 *) (coverageZ.arrayZ + 1),
2900
0
             lookup_context);
2901
0
  }
2902
2903
  bool may_have_non_1to1 () const
2904
0
  { return true; }
2905
2906
  void closure (hb_closure_context_t *c) const
2907
0
  {
2908
0
    if (!(this+coverageZ[0]).intersects (c->glyphs))
2909
0
      return;
2910
2911
0
    hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs ();
2912
0
    if (unlikely (!cur_active_glyphs)) return;
2913
0
    get_coverage ().intersect_set (c->previous_parent_active_glyphs (),
2914
0
           *cur_active_glyphs);
2915
2916
0
    const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount));
2917
0
    struct ContextClosureLookupContext lookup_context = {
2918
0
      {intersects_coverage, intersected_coverage_glyphs},
2919
0
      ContextFormat::CoverageBasedContext,
2920
0
      this
2921
0
    };
2922
0
    context_closure_lookup (c,
2923
0
          glyphCount, (const HBUINT16 *) (coverageZ.arrayZ + 1),
2924
0
          lookupCount, lookupRecord,
2925
0
          0, lookup_context);
2926
2927
0
    c->pop_cur_done_glyphs ();
2928
0
  }
2929
2930
  void closure_lookups (hb_closure_lookups_context_t *c) const
2931
0
  {
2932
0
    if (!intersects (c->glyphs))
2933
0
      return;
2934
0
    const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount));
2935
0
    recurse_lookups (c, lookupCount, lookupRecord);
2936
0
  }
2937
2938
0
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const {}
2939
2940
  void collect_glyphs (hb_collect_glyphs_context_t *c) const
2941
0
  {
2942
0
    (this+coverageZ[0]).collect_coverage (c->input);
2943
2944
0
    const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount));
2945
0
    struct ContextCollectGlyphsLookupContext lookup_context = {
2946
0
      {collect_coverage},
2947
0
      this
2948
0
    };
2949
2950
0
    context_collect_glyphs_lookup (c,
2951
0
           glyphCount, (const HBUINT16 *) (coverageZ.arrayZ + 1),
2952
0
           lookupCount, lookupRecord,
2953
0
           lookup_context);
2954
0
  }
2955
2956
  bool would_apply (hb_would_apply_context_t *c) const
2957
0
  {
2958
0
    const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount));
2959
0
    struct ContextApplyLookupContext lookup_context = {
2960
0
      {match_coverage},
2961
0
      this
2962
0
    };
2963
0
    return context_would_apply_lookup (c,
2964
0
               glyphCount, (const HBUINT16 *) (coverageZ.arrayZ + 1),
2965
0
               lookupCount, lookupRecord,
2966
0
               lookup_context);
2967
0
  }
2968
2969
0
  const Coverage &get_coverage () const { return this+coverageZ[0]; }
2970
2971
  bool apply (hb_ot_apply_context_t *c) const
2972
0
  {
2973
0
    TRACE_APPLY (this);
2974
0
    unsigned int index = (this+coverageZ[0]).get_coverage (c->buffer->cur().codepoint);
2975
0
    if (index == NOT_COVERED) return_trace (false);
2976
2977
0
    const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount));
2978
0
    struct ContextApplyLookupContext lookup_context = {
2979
0
      {match_coverage},
2980
0
      this
2981
0
    };
2982
0
    return_trace (context_apply_lookup (c, glyphCount, (const HBUINT16 *) (coverageZ.arrayZ + 1), lookupCount, lookupRecord, lookup_context));
2983
0
  }
2984
2985
  bool subset (hb_subset_context_t *c) const
2986
0
  {
2987
0
    TRACE_SUBSET (this);
2988
0
    auto *out = c->serializer->start_embed (this);
2989
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
2990
2991
0
    out->format = format;
2992
0
    out->glyphCount = glyphCount;
2993
2994
0
    auto coverages = coverageZ.as_array (glyphCount);
2995
2996
0
    for (const Offset16To<Coverage>& offset : coverages)
2997
0
    {
2998
      /* TODO(subset) This looks like should not be necessary to write this way. */
2999
0
      auto *o = c->serializer->allocate_size<Offset16To<Coverage>> (Offset16To<Coverage>::static_size);
3000
0
      if (unlikely (!o)) return_trace (false);
3001
0
      if (!o->serialize_subset (c, offset, this)) return_trace (false);
3002
0
    }
3003
3004
0
    const auto& lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>> (coverageZ.as_array (glyphCount));
3005
0
    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
3006
3007
3008
0
    unsigned count = serialize_lookuprecord_array (c->serializer, lookupRecord.as_array (lookupCount), lookup_map);
3009
0
    return_trace (c->serializer->check_assign (out->lookupCount, count, HB_SERIALIZE_ERROR_INT_OVERFLOW));
3010
0
  }
3011
3012
  bool sanitize (hb_sanitize_context_t *c) const
3013
0
  {
3014
0
    TRACE_SANITIZE (this);
3015
0
    if (unlikely (!c->check_struct (this))) return_trace (false);
3016
0
    hb_barrier ();
3017
0
    unsigned int count = glyphCount;
3018
0
    if (unlikely (!count)) return_trace (false); /* We want to access coverageZ[0] freely. */
3019
0
    if (unlikely (!c->check_array (coverageZ.arrayZ, count))) return_trace (false);
3020
0
    for (unsigned int i = 0; i < count; i++)
3021
0
      if (unlikely (!coverageZ[i].sanitize (c, this))) return_trace (false);
3022
0
    const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount));
3023
0
    return_trace (likely (c->check_array (lookupRecord, lookupCount)));
3024
0
  }
3025
3026
  protected:
3027
  HBUINT16  format;     /* Format identifier--format = 3 */
3028
  HBUINT16  glyphCount;   /* Number of glyphs in the input glyph
3029
           * sequence */
3030
  HBUINT16  lookupCount;    /* Number of LookupRecords */
3031
  UnsizedArrayOf<Offset16To<Coverage>>
3032
    coverageZ;    /* Array of offsets to Coverage
3033
           * table in glyph sequence order */
3034
/*UnsizedArrayOf<LookupRecord>
3035
    lookupRecordX;*/  /* Array of LookupRecords--in
3036
           * design order */
3037
  public:
3038
  DEFINE_SIZE_ARRAY (6, coverageZ);
3039
};
3040
3041
struct Context
3042
{
3043
  template <typename context_t, typename ...Ts>
3044
  typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
3045
0
  {
3046
0
    if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
3047
0
    TRACE_DISPATCH (this, u.format.v);
3048
0
    switch (u.format.v) {
3049
0
    case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
3050
0
    case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
3051
0
    case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
3052
#ifndef HB_NO_BEYOND_64K
3053
    case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
3054
    case 5: hb_barrier (); return_trace (c->dispatch (u.format5, std::forward<Ts> (ds)...));
3055
#endif
3056
0
    default:return_trace (c->default_return_value ());
3057
0
    }
3058
0
  }
Unexecuted instantiation: hb_sanitize_context_t::return_t OT::Context::dispatch<hb_sanitize_context_t>(hb_sanitize_context_t*) const
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::Context::dispatch<OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::Context::dispatch<OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::Context::dispatch<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::Context::dispatch<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: hb_subset_context_t::return_t OT::Context::dispatch<hb_subset_context_t>(hb_subset_context_t*) const
Unexecuted instantiation: OT::hb_collect_variation_indices_context_t::return_t OT::Context::dispatch<OT::hb_collect_variation_indices_context_t>(OT::hb_collect_variation_indices_context_t*) const
Unexecuted instantiation: OT::hb_accelerate_subtables_context_t::return_t OT::Context::dispatch<OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Unexecuted instantiation: OT::hb_have_non_1to1_context_t::return_t OT::Context::dispatch<OT::hb_have_non_1to1_context_t>(OT::hb_have_non_1to1_context_t*) const
Unexecuted instantiation: OT::hb_closure_context_t::return_t OT::Context::dispatch<OT::hb_closure_context_t>(OT::hb_closure_context_t*) const
Unexecuted instantiation: OT::hb_would_apply_context_t::return_t OT::Context::dispatch<OT::hb_would_apply_context_t>(OT::hb_would_apply_context_t*) const
Unexecuted instantiation: hb_get_glyph_alternates_dispatch_t::return_t OT::Context::dispatch<hb_get_glyph_alternates_dispatch_t, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&>(hb_get_glyph_alternates_dispatch_t*, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&) const
Unexecuted instantiation: hb_collect_glyph_alternates_dispatch_t::return_t OT::Context::dispatch<hb_collect_glyph_alternates_dispatch_t, hb_map_t*&, hb_map_t*&>(hb_collect_glyph_alternates_dispatch_t*, hb_map_t*&, hb_map_t*&) const
Unexecuted instantiation: hb_position_single_dispatch_t::return_t OT::Context::dispatch<hb_position_single_dispatch_t, hb_font_t*&, hb_blob_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&>(hb_position_single_dispatch_t*, hb_font_t*&, hb_blob_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&) const
3059
3060
  protected:
3061
  union {
3062
  struct { HBUINT16 v; }  format;   /* Format identifier */
3063
  ContextFormat1_4<SmallTypes>  format1;
3064
  ContextFormat2_5<SmallTypes>  format2;
3065
  ContextFormat3    format3;
3066
#ifndef HB_NO_BEYOND_64K
3067
  ContextFormat1_4<MediumTypes> format4;
3068
  ContextFormat2_5<MediumTypes> format5;
3069
#endif
3070
  } u;
3071
};
3072
3073
3074
/* Chaining Contextual lookups */
3075
3076
struct ChainContextClosureLookupContext
3077
{
3078
  ContextClosureFuncs funcs;
3079
  ContextFormat context_format;
3080
  const void *intersects_data[3];
3081
  void *intersects_cache[3];
3082
  void *intersected_glyphs_cache;
3083
};
3084
3085
struct ChainContextCollectGlyphsLookupContext
3086
{
3087
  ContextCollectGlyphsFuncs funcs;
3088
  const void *collect_data[3];
3089
};
3090
3091
struct ChainContextApplyLookupContext
3092
{
3093
  ChainContextApplyFuncs funcs;
3094
  const void *match_data[3];
3095
};
3096
3097
template <typename HBUINT>
3098
static inline bool chain_context_intersects (const hb_set_t *glyphs,
3099
               unsigned int backtrackCount,
3100
               const HBUINT backtrack[],
3101
               unsigned int inputCount, /* Including the first glyph (not matched) */
3102
               const HBUINT input[], /* Array of input values--start with second glyph */
3103
               unsigned int lookaheadCount,
3104
               const HBUINT lookahead[],
3105
               ChainContextClosureLookupContext &lookup_context)
3106
0
{
3107
0
  return array_is_subset_of (glyphs,
3108
0
           backtrackCount, backtrack,
3109
0
           lookup_context.funcs.intersects,
3110
0
           lookup_context.intersects_data[0],
3111
0
           lookup_context.intersects_cache[0])
3112
0
      && array_is_subset_of (glyphs,
3113
0
           inputCount ? inputCount - 1 : 0, input,
3114
0
           lookup_context.funcs.intersects,
3115
0
           lookup_context.intersects_data[1],
3116
0
           lookup_context.intersects_cache[1])
3117
0
      && array_is_subset_of (glyphs,
3118
0
           lookaheadCount, lookahead,
3119
0
           lookup_context.funcs.intersects,
3120
0
           lookup_context.intersects_data[2],
3121
0
           lookup_context.intersects_cache[2]);
3122
0
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::chain_context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::chain_context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::chain_context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::chain_context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::chain_context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-subset.cc:bool OT::chain_context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-plan-layout.cc:bool OT::chain_context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-layout.cc:bool OT::chain_context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-var.cc:bool OT::chain_context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-cff.cc:bool OT::chain_context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-color.cc:bool OT::chain_context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-other.cc:bool OT::chain_context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: gsubgpos-context.cc:bool OT::chain_context_intersects<OT::NumType<true, unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
3123
3124
template <typename HBUINT>
3125
static inline void chain_context_closure_lookup (hb_closure_context_t *c,
3126
             unsigned int backtrackCount,
3127
             const HBUINT backtrack[],
3128
             unsigned int inputCount, /* Including the first glyph (not matched) */
3129
             const HBUINT input[], /* Array of input values--start with second glyph */
3130
             unsigned int lookaheadCount,
3131
             const HBUINT lookahead[],
3132
             unsigned int lookupCount,
3133
             const LookupRecord lookupRecord[],
3134
             unsigned value,
3135
             ChainContextClosureLookupContext &lookup_context)
3136
0
{
3137
0
  if (chain_context_intersects (c->glyphs,
3138
0
        backtrackCount, backtrack,
3139
0
        inputCount, input,
3140
0
        lookaheadCount, lookahead,
3141
0
        lookup_context))
3142
0
    context_closure_recurse_lookups (c,
3143
0
         inputCount, input,
3144
0
         lookupCount, lookupRecord,
3145
0
         value,
3146
0
         lookup_context.context_format,
3147
0
         lookup_context.intersects_data[1],
3148
0
         lookup_context.funcs.intersected_glyphs,
3149
0
         lookup_context.intersected_glyphs_cache);
3150
0
}
Unexecuted instantiation: hb-aat-layout.cc:void OT::chain_context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:void OT::chain_context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:void OT::chain_context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::chain_context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::chain_context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-subset.cc:void OT::chain_context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-plan-layout.cc:void OT::chain_context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-layout.cc:void OT::chain_context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-var.cc:void OT::chain_context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-cff.cc:void OT::chain_context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-color.cc:void OT::chain_context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-subset-table-other.cc:void OT::chain_context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: gsubgpos-context.cc:void OT::chain_context_closure_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
3151
3152
template <typename HBUINT>
3153
static inline void chain_context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c,
3154
              unsigned int backtrackCount,
3155
              const HBUINT backtrack[],
3156
              unsigned int inputCount, /* Including the first glyph (not matched) */
3157
              const HBUINT input[], /* Array of input values--start with second glyph */
3158
              unsigned int lookaheadCount,
3159
              const HBUINT lookahead[],
3160
              unsigned int lookupCount,
3161
              const LookupRecord lookupRecord[],
3162
              ChainContextCollectGlyphsLookupContext &lookup_context)
3163
0
{
3164
0
  collect_array (c, c->before,
3165
0
     backtrackCount, backtrack,
3166
0
     lookup_context.funcs.collect, lookup_context.collect_data[0]);
3167
0
  collect_array (c, c->input,
3168
0
     inputCount ? inputCount - 1 : 0, input,
3169
0
     lookup_context.funcs.collect, lookup_context.collect_data[1]);
3170
0
  collect_array (c, c->after,
3171
0
     lookaheadCount, lookahead,
3172
0
     lookup_context.funcs.collect, lookup_context.collect_data[2]);
3173
0
  recurse_lookups (c,
3174
0
       lookupCount, lookupRecord);
3175
0
}
Unexecuted instantiation: hb-aat-layout.cc:void OT::chain_context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:void OT::chain_context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:void OT::chain_context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::chain_context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::chain_context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-subset.cc:void OT::chain_context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-subset-plan-layout.cc:void OT::chain_context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-subset-table-layout.cc:void OT::chain_context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-subset-table-var.cc:void OT::chain_context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-subset-table-cff.cc:void OT::chain_context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-subset-table-color.cc:void OT::chain_context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-subset-table-other.cc:void OT::chain_context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: gsubgpos-context.cc:void OT::chain_context_collect_glyphs_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
3176
3177
template <typename HBUINT>
3178
static inline bool chain_context_would_apply_lookup (hb_would_apply_context_t *c,
3179
                 unsigned int backtrackCount,
3180
                 const HBUINT backtrack[] HB_UNUSED,
3181
                 unsigned int inputCount, /* Including the first glyph (not matched) */
3182
                 const HBUINT input[], /* Array of input values--start with second glyph */
3183
                 unsigned int lookaheadCount,
3184
                 const HBUINT lookahead[] HB_UNUSED,
3185
                 unsigned int lookupCount HB_UNUSED,
3186
                 const LookupRecord lookupRecord[] HB_UNUSED,
3187
                 const ChainContextApplyLookupContext &lookup_context)
3188
0
{
3189
0
  return (c->zero_context ? !backtrackCount && !lookaheadCount : true)
3190
0
      && would_match_input (c,
3191
0
          inputCount, input,
3192
0
          lookup_context.funcs.match[1], lookup_context.match_data[1]);
3193
0
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::chain_context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::chain_context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::chain_context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::chain_context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::chain_context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset.cc:bool OT::chain_context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-plan-layout.cc:bool OT::chain_context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-layout.cc:bool OT::chain_context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-var.cc:bool OT::chain_context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-cff.cc:bool OT::chain_context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-color.cc:bool OT::chain_context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-other.cc:bool OT::chain_context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: gsubgpos-context.cc:bool OT::chain_context_would_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
3194
3195
template <typename HBUINT>
3196
static inline bool chain_context_apply_lookup (hb_ot_apply_context_t *c,
3197
                 unsigned int backtrackCount,
3198
                 const HBUINT backtrack[],
3199
                 unsigned int inputCount, /* Including the first glyph (not matched) */
3200
                 const HBUINT input[], /* Array of input values--start with second glyph */
3201
                 unsigned int lookaheadCount,
3202
                 const HBUINT lookahead[],
3203
                 unsigned int lookupCount,
3204
                 const LookupRecord lookupRecord[],
3205
                 const ChainContextApplyLookupContext &lookup_context)
3206
1.59M
{
3207
1.59M
  if (unlikely (inputCount > HB_MAX_CONTEXT_LENGTH)) return false;
3208
3209
1.59M
  unsigned start_index = c->buffer->out_len;
3210
1.59M
  unsigned end_index = c->buffer->idx;
3211
1.59M
  unsigned match_end = 0;
3212
1.59M
  bool ret = true;
3213
1.59M
  if (!(match_input (c,
3214
1.59M
         inputCount, input,
3215
1.59M
         lookup_context.funcs.match[1], lookup_context.match_data[1],
3216
1.59M
         &match_end) && (end_index = match_end)
3217
1.51M
       && match_lookahead (c,
3218
1.51M
         lookaheadCount, lookahead,
3219
1.51M
         lookup_context.funcs.match[2], lookup_context.match_data[2],
3220
1.51M
         match_end, &end_index)))
3221
731k
  {
3222
731k
    c->buffer->unsafe_to_concat (c->buffer->idx, end_index);
3223
731k
    return false;
3224
731k
  }
3225
3226
862k
  if (!match_backtrack (c,
3227
862k
      backtrackCount, backtrack,
3228
862k
      lookup_context.funcs.match[0], lookup_context.match_data[0],
3229
862k
      &start_index))
3230
853k
  {
3231
853k
    c->buffer->unsafe_to_concat_from_outbuffer (start_index, end_index);
3232
853k
    return false;
3233
853k
  }
3234
3235
8.56k
  c->buffer->unsafe_to_break_from_outbuffer (start_index, end_index);
3236
8.56k
  apply_lookup (c,
3237
8.56k
    inputCount,
3238
8.56k
    lookupCount, lookupRecord,
3239
8.56k
    match_end);
3240
3241
8.56k
  return ret;
3242
862k
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::chain_context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::chain_context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
hb-ot-layout.cc:bool OT::chain_context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Line
Count
Source
3206
1.59M
{
3207
1.59M
  if (unlikely (inputCount > HB_MAX_CONTEXT_LENGTH)) return false;
3208
3209
1.59M
  unsigned start_index = c->buffer->out_len;
3210
1.59M
  unsigned end_index = c->buffer->idx;
3211
1.59M
  unsigned match_end = 0;
3212
1.59M
  bool ret = true;
3213
1.59M
  if (!(match_input (c,
3214
1.59M
         inputCount, input,
3215
1.59M
         lookup_context.funcs.match[1], lookup_context.match_data[1],
3216
1.59M
         &match_end) && (end_index = match_end)
3217
1.51M
       && match_lookahead (c,
3218
1.51M
         lookaheadCount, lookahead,
3219
1.51M
         lookup_context.funcs.match[2], lookup_context.match_data[2],
3220
1.51M
         match_end, &end_index)))
3221
731k
  {
3222
731k
    c->buffer->unsafe_to_concat (c->buffer->idx, end_index);
3223
731k
    return false;
3224
731k
  }
3225
3226
862k
  if (!match_backtrack (c,
3227
862k
      backtrackCount, backtrack,
3228
862k
      lookup_context.funcs.match[0], lookup_context.match_data[0],
3229
862k
      &start_index))
3230
853k
  {
3231
853k
    c->buffer->unsafe_to_concat_from_outbuffer (start_index, end_index);
3232
853k
    return false;
3233
853k
  }
3234
3235
8.56k
  c->buffer->unsafe_to_break_from_outbuffer (start_index, end_index);
3236
8.56k
  apply_lookup (c,
3237
8.56k
    inputCount,
3238
8.56k
    lookupCount, lookupRecord,
3239
8.56k
    match_end);
3240
3241
8.56k
  return ret;
3242
862k
}
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::chain_context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::chain_context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset.cc:bool OT::chain_context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-plan-layout.cc:bool OT::chain_context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-layout.cc:bool OT::chain_context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-var.cc:bool OT::chain_context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-cff.cc:bool OT::chain_context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-color.cc:bool OT::chain_context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-subset-table-other.cc:bool OT::chain_context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: gsubgpos-context.cc:bool OT::chain_context_apply_lookup<OT::NumType<true, unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::NumType<true, unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
3243
3244
template <typename Types>
3245
struct ChainRule
3246
{
3247
  template <typename T>
3248
  friend struct ChainRuleSet;
3249
3250
  bool intersects (const hb_set_t *glyphs, ChainContextClosureLookupContext &lookup_context) const
3251
0
  {
3252
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3253
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3254
0
    return chain_context_intersects (glyphs,
3255
0
             backtrack.len, backtrack.arrayZ,
3256
0
             input.lenP1, input.arrayZ,
3257
0
             lookahead.len, lookahead.arrayZ,
3258
0
             lookup_context);
3259
0
  }
3260
3261
  void closure (hb_closure_context_t *c, unsigned value,
3262
    ChainContextClosureLookupContext &lookup_context) const
3263
0
  {
3264
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
3265
3266
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3267
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3268
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3269
0
    chain_context_closure_lookup (c,
3270
0
          backtrack.len, backtrack.arrayZ,
3271
0
          input.lenP1, input.arrayZ,
3272
0
          lookahead.len, lookahead.arrayZ,
3273
0
          lookup.len, lookup.arrayZ,
3274
0
          value,
3275
0
          lookup_context);
3276
0
  }
3277
3278
  void closure_lookups (hb_closure_lookups_context_t *c,
3279
                        ChainContextClosureLookupContext &lookup_context) const
3280
0
  {
3281
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
3282
0
    if (!intersects (c->glyphs, lookup_context)) return;
3283
3284
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3285
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3286
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3287
0
    recurse_lookups (c, lookup.len, lookup.arrayZ);
3288
0
  }
3289
3290
  void collect_glyphs (hb_collect_glyphs_context_t *c,
3291
           ChainContextCollectGlyphsLookupContext &lookup_context) const
3292
0
  {
3293
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3294
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3295
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3296
0
    chain_context_collect_glyphs_lookup (c,
3297
0
           backtrack.len, backtrack.arrayZ,
3298
0
           input.lenP1, input.arrayZ,
3299
0
           lookahead.len, lookahead.arrayZ,
3300
0
           lookup.len, lookup.arrayZ,
3301
0
           lookup_context);
3302
0
  }
3303
3304
  bool would_apply (hb_would_apply_context_t *c,
3305
        const ChainContextApplyLookupContext &lookup_context) const
3306
0
  {
3307
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3308
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3309
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3310
0
    return chain_context_would_apply_lookup (c,
3311
0
               backtrack.len, backtrack.arrayZ,
3312
0
               input.lenP1, input.arrayZ,
3313
0
               lookahead.len, lookahead.arrayZ, lookup.len,
3314
0
               lookup.arrayZ, lookup_context);
3315
0
  }
3316
3317
  bool apply (hb_ot_apply_context_t *c,
3318
        const ChainContextApplyLookupContext &lookup_context) const
3319
0
  {
3320
0
    TRACE_APPLY (this);
3321
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3322
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3323
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3324
0
    return_trace (chain_context_apply_lookup (c,
3325
0
                backtrack.len, backtrack.arrayZ,
3326
0
                input.lenP1, input.arrayZ,
3327
0
                lookahead.len, lookahead.arrayZ, lookup.len,
3328
0
                lookup.arrayZ, lookup_context));
3329
0
  }
3330
3331
  template<typename Iterator,
3332
     hb_requires (hb_is_iterator (Iterator))>
3333
  void serialize_array (hb_serialize_context_t *c,
3334
      HBUINT16 len,
3335
      Iterator it) const
3336
0
  {
3337
0
    c->copy (len);
3338
0
    for (const auto g : it)
3339
0
      c->copy ((HBUINT16) g);
3340
0
  }
3341
3342
  bool serialize (hb_serialize_context_t *c,
3343
      const hb_map_t *lookup_map,
3344
      const hb_map_t *backtrack_map,
3345
      const hb_map_t *input_map = nullptr,
3346
      const hb_map_t *lookahead_map = nullptr) const
3347
0
  {
3348
0
    TRACE_SERIALIZE (this);
3349
3350
0
    const hb_map_t *mapping = backtrack_map;
3351
0
    serialize_array (c, backtrack.len, + backtrack.iter ()
3352
0
               | hb_map (mapping));
3353
3354
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3355
0
    if (input_map) mapping = input_map;
3356
0
    serialize_array (c, input.lenP1, + input.iter ()
3357
0
             | hb_map (mapping));
3358
3359
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3360
0
    if (lookahead_map) mapping = lookahead_map;
3361
0
    serialize_array (c, lookahead.len, + lookahead.iter ()
3362
0
               | hb_map (mapping));
3363
3364
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3365
3366
0
    HBUINT16* lookupCount = c->embed (&(lookup.len));
3367
0
    if (!lookupCount) return_trace (false);
3368
3369
0
    unsigned count = serialize_lookuprecord_array (c, lookup.as_array (), lookup_map);
3370
0
    return_trace (c->check_assign (*lookupCount, count, HB_SERIALIZE_ERROR_INT_OVERFLOW));
3371
0
  }
3372
3373
  bool subset (hb_subset_context_t *c,
3374
         const hb_map_t *lookup_map,
3375
         const hb_map_t *backtrack_map = nullptr,
3376
         const hb_map_t *input_map = nullptr,
3377
         const hb_map_t *lookahead_map = nullptr) const
3378
0
  {
3379
0
    TRACE_SUBSET (this);
3380
3381
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3382
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3383
3384
0
    if (!backtrack_map)
3385
0
    {
3386
0
      const hb_set_t &glyphset = *c->plan->glyphset_gsub ();
3387
0
      if (!hb_all (backtrack, glyphset) ||
3388
0
    !hb_all (input, glyphset) ||
3389
0
    !hb_all (lookahead, glyphset))
3390
0
  return_trace (false);
3391
3392
0
      serialize (c->serializer, lookup_map, c->plan->glyph_map);
3393
0
    }
3394
0
    else
3395
0
    {
3396
0
      if (!hb_all (backtrack, backtrack_map) ||
3397
0
    !hb_all (input, input_map) ||
3398
0
    !hb_all (lookahead, lookahead_map))
3399
0
  return_trace (false);
3400
3401
0
      serialize (c->serializer, lookup_map, backtrack_map, input_map, lookahead_map);
3402
0
    }
3403
3404
0
    return_trace (true);
3405
0
  }
3406
3407
  bool sanitize (hb_sanitize_context_t *c) const
3408
0
  {
3409
0
    TRACE_SANITIZE (this);
3410
    /* Hyper-optimized sanitized because this is really hot. */
3411
0
    if (unlikely (!backtrack.len.sanitize (c))) return_trace (false);
3412
0
    hb_barrier ();
3413
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3414
0
    if (unlikely (!input.lenP1.sanitize (c))) return_trace (false);
3415
0
    hb_barrier ();
3416
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3417
0
    if (unlikely (!lookahead.len.sanitize (c))) return_trace (false);
3418
0
    hb_barrier ();
3419
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3420
0
    return_trace (likely (lookup.sanitize (c)));
3421
0
  }
3422
3423
  protected:
3424
  Array16Of<typename Types::HBUINT>
3425
    backtrack;    /* Array of backtracking values
3426
           * (to be matched before the input
3427
           * sequence) */
3428
  HeadlessArray16Of<typename Types::HBUINT>
3429
    inputX;     /* Array of input values (start with
3430
           * second glyph) */
3431
  Array16Of<typename Types::HBUINT>
3432
    lookaheadX;   /* Array of lookahead values's (to be
3433
           * matched after the input sequence) */
3434
  Array16Of<LookupRecord>
3435
    lookupX;    /* Array of LookupRecords--in
3436
           * design order) */
3437
  public:
3438
  DEFINE_SIZE_MIN (8);
3439
};
3440
3441
template <typename Types>
3442
struct ChainRuleSet
3443
{
3444
  using ChainRule = OT::ChainRule<Types>;
3445
3446
  bool intersects (const hb_set_t *glyphs, ChainContextClosureLookupContext &lookup_context) const
3447
0
  {
3448
0
    return
3449
0
    + hb_iter (rule)
3450
0
    | hb_map (hb_add (this))
3451
0
    | hb_map ([&] (const ChainRule &_) { return _.intersects (glyphs, lookup_context); })
3452
0
    | hb_any
3453
0
    ;
3454
0
  }
3455
  void closure (hb_closure_context_t *c, unsigned value, ChainContextClosureLookupContext &lookup_context) const
3456
0
  {
3457
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
3458
3459
0
    return
3460
0
    + hb_iter (rule)
3461
0
    | hb_map (hb_add (this))
3462
0
    | hb_apply ([&] (const ChainRule &_) { _.closure (c, value, lookup_context); })
3463
0
    ;
3464
0
  }
3465
3466
  void closure_lookups (hb_closure_lookups_context_t *c,
3467
                        ChainContextClosureLookupContext &lookup_context) const
3468
0
  {
3469
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
3470
3471
0
    + hb_iter (rule)
3472
0
    | hb_map (hb_add (this))
3473
0
    | hb_apply ([&] (const ChainRule &_) { _.closure_lookups (c, lookup_context); })
3474
0
    ;
3475
0
  }
3476
3477
  void collect_glyphs (hb_collect_glyphs_context_t *c, ChainContextCollectGlyphsLookupContext &lookup_context) const
3478
0
  {
3479
0
    return
3480
0
    + hb_iter (rule)
3481
0
    | hb_map (hb_add (this))
3482
0
    | hb_apply ([&] (const ChainRule &_) { _.collect_glyphs (c, lookup_context); })
3483
0
    ;
3484
0
  }
3485
3486
  bool would_apply (hb_would_apply_context_t *c,
3487
        const ChainContextApplyLookupContext &lookup_context) const
3488
0
  {
3489
0
    return
3490
0
    + hb_iter (rule)
3491
0
    | hb_map (hb_add (this))
3492
0
    | hb_map ([&] (const ChainRule &_) { return _.would_apply (c, lookup_context); })
3493
0
    | hb_any
3494
0
    ;
3495
0
  }
3496
3497
  bool apply (hb_ot_apply_context_t *c,
3498
        const ChainContextApplyLookupContext &lookup_context) const
3499
0
  {
3500
0
    TRACE_APPLY (this);
3501
3502
0
    unsigned num_rules = rule.len;
3503
3504
0
#ifndef HB_NO_OT_RULESETS_FAST_PATH
3505
0
    if (HB_OPTIMIZE_SIZE_VAL || num_rules <= 4)
3506
0
#endif
3507
0
    {
3508
0
    slow:
3509
0
      return_trace (
3510
0
      + hb_iter (rule)
3511
0
      | hb_map (hb_add (this))
3512
0
      | hb_map ([&] (const ChainRule &_) { return _.apply (c, lookup_context); })
3513
0
      | hb_any
3514
0
      )
3515
0
      ;
3516
0
    }
3517
3518
    /* This version is optimized for speed by matching the first & second
3519
     * components of the rule here, instead of calling into the matching code.
3520
     *
3521
     * Replicated from LigatureSet::apply(). */
3522
3523
    /* We use the iter_context instead of iter_input, to avoid skipping
3524
     * default-ignorables and such.
3525
     *
3526
     * Related: https://github.com/harfbuzz/harfbuzz/issues/4813
3527
     */
3528
0
    auto &skippy_iter = c->iter_context;
3529
0
    skippy_iter.reset (c->buffer->idx);
3530
0
    skippy_iter.set_match_func (match_always, nullptr);
3531
0
    skippy_iter.set_glyph_data ((HBUINT16 *) nullptr);
3532
0
    unsigned unsafe_to = (unsigned) -1, unsafe_to1, unsafe_to2 = 0;
3533
0
    hb_glyph_info_t *first = nullptr, *second = nullptr;
3534
0
    bool matched = skippy_iter.next ();
3535
0
    if (likely (matched))
3536
0
    {
3537
0
      if (skippy_iter.may_skip (c->buffer->info[skippy_iter.idx]))
3538
0
      {
3539
  /* Can't use the fast path if eg. the next char is a default-ignorable
3540
   * or other skippable. */
3541
0
        goto slow;
3542
0
      }
3543
3544
0
      first = &c->buffer->info[skippy_iter.idx];
3545
0
      unsafe_to1 = skippy_iter.idx + 1;
3546
0
    }
3547
0
    else
3548
0
    {
3549
      /* Failed to match a next glyph. Only try applying rules that have
3550
       * no further input and lookahead. */
3551
0
      return_trace (
3552
0
      + hb_iter (rule)
3553
0
      | hb_map (hb_add (this))
3554
0
      | hb_filter ([&] (const ChainRule &_)
3555
0
       {
3556
0
         const auto &input = StructAfter<decltype (_.inputX)> (_.backtrack);
3557
0
         const auto &lookahead = StructAfter<decltype (_.lookaheadX)> (input);
3558
0
         return input.lenP1 <= 1 && lookahead.len == 0;
3559
0
       })
3560
0
      | hb_map ([&] (const ChainRule &_) { return _.apply (c, lookup_context); })
3561
0
      | hb_any
3562
0
      )
3563
0
      ;
3564
0
    }
3565
0
    matched = skippy_iter.next ();
3566
0
    if (likely (matched))
3567
0
    {
3568
0
      if (skippy_iter.may_skip (c->buffer->info[skippy_iter.idx]))
3569
0
      {
3570
  /* Can't use the fast path if eg. the next char is a default-ignorable
3571
   * or other skippable. */
3572
0
        goto slow;
3573
0
      }
3574
3575
0
      second = &c->buffer->info[skippy_iter.idx];
3576
0
      unsafe_to2 = skippy_iter.idx + 1;
3577
0
    }
3578
3579
0
    auto match_input = lookup_context.funcs.match[1];
3580
0
    auto match_lookahead = lookup_context.funcs.match[2];
3581
0
    auto *input_data = lookup_context.match_data[1];
3582
0
    auto *lookahead_data = lookup_context.match_data[2];
3583
0
    for (unsigned int i = 0; i < num_rules; i++)
3584
0
    {
3585
0
      const auto &r = this+rule.arrayZ[i];
3586
3587
0
      const auto &input = StructAfter<decltype (r.inputX)> (r.backtrack);
3588
0
      const auto &lookahead = StructAfter<decltype (r.lookaheadX)> (input);
3589
3590
0
      unsigned lenP1 = input.lenP1;
3591
0
      if (lenP1 > 1 ?
3592
0
     (!match_input ||
3593
0
      match_input (*first, input.arrayZ[0], input_data))
3594
0
    :
3595
0
     (!lookahead.len || !match_lookahead ||
3596
0
      match_lookahead (*first, lookahead.arrayZ[0], lookahead_data)))
3597
0
      {
3598
0
  lenP1 = hb_max (lenP1, 1u);
3599
0
        if (!second ||
3600
0
      (lenP1 > 2 ?
3601
0
       (!match_input ||
3602
0
        match_input (*second, input.arrayZ[1], input_data))
3603
0
       :
3604
0
       (lookahead.len <= 2 - lenP1 || !match_lookahead ||
3605
0
        match_lookahead (*second, lookahead.arrayZ[2 - lenP1], lookahead_data))))
3606
0
  {
3607
0
    if (r.apply (c, lookup_context))
3608
0
    {
3609
0
      if (unsafe_to != (unsigned) -1)
3610
0
        c->buffer->unsafe_to_concat (c->buffer->idx, unsafe_to);
3611
0
      return_trace (true);
3612
0
    }
3613
0
  }
3614
0
  else
3615
0
    unsafe_to = unsafe_to2;
3616
0
      }
3617
0
      else
3618
0
      {
3619
0
  if (unsafe_to == (unsigned) -1)
3620
0
    unsafe_to = unsafe_to1;
3621
3622
0
  if (lenP1 > 1)
3623
0
  {
3624
    // Skip ahead to next possible first glyph match.
3625
0
    for (; i + 1 < num_rules; i++)
3626
0
    {
3627
0
      const auto &r2 = this+rule.arrayZ[i + 1];
3628
0
      const auto &input2 = StructAfter<decltype (r2.inputX)> (r2.backtrack);
3629
0
      if (input2.lenP1 <= 1 || input2.arrayZ[0] != input.arrayZ[0])
3630
0
        break;
3631
0
    }
3632
0
  }
3633
0
      }
3634
0
    }
3635
0
    if (likely (unsafe_to != (unsigned) -1))
3636
0
      c->buffer->unsafe_to_concat (c->buffer->idx, unsafe_to);
3637
3638
0
    return_trace (false);
3639
0
  }
3640
3641
  bool subset (hb_subset_context_t *c,
3642
         const hb_map_t *lookup_map,
3643
         const hb_map_t *backtrack_klass_map = nullptr,
3644
         const hb_map_t *input_klass_map = nullptr,
3645
         const hb_map_t *lookahead_klass_map = nullptr) const
3646
0
  {
3647
0
    TRACE_SUBSET (this);
3648
3649
0
    auto snap = c->serializer->snapshot ();
3650
0
    auto *out = c->serializer->start_embed (*this);
3651
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
3652
3653
0
    for (const Offset16To<ChainRule>& _ : rule)
3654
0
    {
3655
0
      if (!_) continue;
3656
0
      auto o_snap = c->serializer->snapshot ();
3657
0
      auto *o = out->rule.serialize_append (c->serializer);
3658
0
      if (unlikely (!o)) continue;
3659
3660
0
      if (!o->serialize_subset (c, _, this,
3661
0
        lookup_map,
3662
0
        backtrack_klass_map,
3663
0
        input_klass_map,
3664
0
        lookahead_klass_map))
3665
0
      {
3666
0
  out->rule.pop ();
3667
0
  c->serializer->revert (o_snap);
3668
0
      }
3669
0
    }
3670
3671
0
    bool ret = bool (out->rule);
3672
0
    if (!ret) c->serializer->revert (snap);
3673
3674
0
    return_trace (ret);
3675
0
  }
3676
3677
  bool sanitize (hb_sanitize_context_t *c) const
3678
0
  {
3679
0
    TRACE_SANITIZE (this);
3680
0
    return_trace (rule.sanitize (c, this));
3681
0
  }
3682
3683
  protected:
3684
  Array16OfOffset16To<ChainRule>
3685
    rule;     /* Array of ChainRule tables
3686
           * ordered by preference */
3687
  public:
3688
  DEFINE_SIZE_ARRAY (2, rule);
3689
};
3690
3691
template <typename Types>
3692
struct ChainContextFormat1_4
3693
{
3694
  using ChainRuleSet = OT::ChainRuleSet<Types>;
3695
3696
  bool intersects (const hb_set_t *glyphs) const
3697
0
  {
3698
0
    struct ChainContextClosureLookupContext lookup_context = {
3699
0
      {intersects_glyph, intersected_glyph},
3700
0
      ContextFormat::SimpleContext,
3701
0
      {nullptr, nullptr, nullptr}
3702
0
    };
3703
3704
0
    return
3705
0
    + hb_zip (this+coverage, ruleSet)
3706
0
    | hb_filter (*glyphs, hb_first)
3707
0
    | hb_map (hb_second)
3708
0
    | hb_map (hb_add (this))
3709
0
    | hb_map ([&] (const ChainRuleSet &_) { return _.intersects (glyphs, lookup_context); })
3710
0
    | hb_any
3711
0
    ;
3712
0
  }
3713
3714
  bool may_have_non_1to1 () const
3715
0
  { return true; }
3716
3717
  void closure (hb_closure_context_t *c) const
3718
0
  {
3719
0
    hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs ();
3720
0
    if (unlikely (!cur_active_glyphs)) return;
3721
0
    get_coverage ().intersect_set (c->previous_parent_active_glyphs (),
3722
0
           *cur_active_glyphs);
3723
3724
0
    struct ChainContextClosureLookupContext lookup_context = {
3725
0
      {intersects_glyph, intersected_glyph},
3726
0
      ContextFormat::SimpleContext,
3727
0
      {nullptr, nullptr, nullptr}
3728
0
    };
3729
3730
0
    + hb_zip (this+coverage, hb_range ((unsigned) ruleSet.len))
3731
0
    | hb_filter ([&] (hb_codepoint_t _) {
3732
0
      return c->previous_parent_active_glyphs ().has (_);
3733
0
    }, hb_first)
3734
0
    | hb_map ([&](const hb_pair_t<hb_codepoint_t, unsigned> _) { return hb_pair_t<unsigned, const ChainRuleSet&> (_.first, this+ruleSet[_.second]); })
3735
0
    | hb_apply ([&] (const hb_pair_t<unsigned, const ChainRuleSet&>& _) { _.second.closure (c, _.first, lookup_context); })
3736
0
    ;
3737
3738
0
    c->pop_cur_done_glyphs ();
3739
0
  }
3740
3741
  void closure_lookups (hb_closure_lookups_context_t *c) const
3742
0
  {
3743
0
    struct ChainContextClosureLookupContext lookup_context = {
3744
0
      {intersects_glyph, nullptr},
3745
0
      ContextFormat::SimpleContext,
3746
0
      {nullptr, nullptr, nullptr}
3747
0
    };
3748
3749
0
    + hb_zip (this+coverage, ruleSet)
3750
0
    | hb_filter (*c->glyphs, hb_first)
3751
0
    | hb_map (hb_second)
3752
0
    | hb_map (hb_add (this))
3753
0
    | hb_apply ([&] (const ChainRuleSet &_) { _.closure_lookups (c, lookup_context); })
3754
0
    ;
3755
0
  }
3756
3757
0
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const {}
3758
3759
  void collect_glyphs (hb_collect_glyphs_context_t *c) const
3760
0
  {
3761
0
    (this+coverage).collect_coverage (c->input);
3762
3763
0
    struct ChainContextCollectGlyphsLookupContext lookup_context = {
3764
0
      {collect_glyph},
3765
0
      {nullptr, nullptr, nullptr}
3766
0
    };
3767
3768
0
    + hb_iter (ruleSet)
3769
0
    | hb_map (hb_add (this))
3770
0
    | hb_apply ([&] (const ChainRuleSet &_) { _.collect_glyphs (c, lookup_context); })
3771
0
    ;
3772
0
  }
3773
3774
  bool would_apply (hb_would_apply_context_t *c) const
3775
0
  {
3776
0
    const ChainRuleSet &rule_set = this+ruleSet[(this+coverage).get_coverage (c->glyphs[0])];
3777
0
    struct ChainContextApplyLookupContext lookup_context = {
3778
0
      {{match_glyph, match_glyph, match_glyph}},
3779
0
      {nullptr, nullptr, nullptr}
3780
0
    };
3781
0
    return rule_set.would_apply (c, lookup_context);
3782
0
  }
3783
3784
0
  const Coverage &get_coverage () const { return this+coverage; }
3785
3786
  bool apply (hb_ot_apply_context_t *c) const
3787
0
  {
3788
0
    TRACE_APPLY (this);
3789
0
    unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
3790
0
    if (index == NOT_COVERED) return_trace (false);
3791
3792
0
    const ChainRuleSet &rule_set = this+ruleSet[index];
3793
0
    struct ChainContextApplyLookupContext lookup_context = {
3794
0
      {{match_glyph, match_glyph, match_glyph}},
3795
0
      {nullptr, nullptr, nullptr}
3796
0
    };
3797
0
    return_trace (rule_set.apply (c, lookup_context));
3798
0
  }
3799
3800
  bool subset (hb_subset_context_t *c) const
3801
0
  {
3802
0
    TRACE_SUBSET (this);
3803
0
    const hb_set_t &glyphset = *c->plan->glyphset_gsub ();
3804
0
    const hb_map_t &glyph_map = *c->plan->glyph_map;
3805
3806
0
    auto *out = c->serializer->start_embed (*this);
3807
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
3808
0
    out->format = format;
3809
3810
0
    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
3811
0
    hb_sorted_vector_t<hb_codepoint_t> new_coverage;
3812
0
    + hb_zip (this+coverage, ruleSet)
3813
0
    | hb_filter (glyphset, hb_first)
3814
0
    | hb_filter (subset_offset_array (c, out->ruleSet, this, lookup_map), hb_second)
3815
0
    | hb_map (hb_first)
3816
0
    | hb_map (glyph_map)
3817
0
    | hb_sink (new_coverage)
3818
0
    ;
3819
3820
0
    out->coverage.serialize_serialize (c->serializer, new_coverage.iter ());
3821
0
    return_trace (bool (new_coverage));
3822
0
  }
3823
3824
  bool sanitize (hb_sanitize_context_t *c) const
3825
0
  {
3826
0
    TRACE_SANITIZE (this);
3827
0
    return_trace (coverage.sanitize (c, this) && ruleSet.sanitize (c, this));
3828
0
  }
3829
3830
  protected:
3831
  HBUINT16  format;     /* Format identifier--format = 1 */
3832
  typename Types::template OffsetTo<Coverage>
3833
    coverage;   /* Offset to Coverage table--from
3834
           * beginning of table */
3835
  Array16Of<typename Types::template OffsetTo<ChainRuleSet>>
3836
    ruleSet;    /* Array of ChainRuleSet tables
3837
           * ordered by Coverage Index */
3838
  public:
3839
  DEFINE_SIZE_ARRAY (2 + 2 * Types::size, ruleSet);
3840
};
3841
3842
template <typename Types>
3843
struct ChainContextFormat2_5
3844
{
3845
  using ChainRuleSet = OT::ChainRuleSet<SmallTypes>;
3846
3847
  bool intersects (const hb_set_t *glyphs) const
3848
0
  {
3849
0
    if (!(this+coverage).intersects (glyphs))
3850
0
      return false;
3851
3852
0
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
3853
0
    const ClassDef &input_class_def = this+inputClassDef;
3854
0
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
3855
3856
0
    hb_map_t caches[3] = {};
3857
0
    struct ChainContextClosureLookupContext lookup_context = {
3858
0
      {intersects_class, nullptr},
3859
0
      ContextFormat::ClassBasedContext,
3860
0
      {&backtrack_class_def,
3861
0
       &input_class_def,
3862
0
       &lookahead_class_def},
3863
0
      {&caches[0], &caches[1], &caches[2]}
3864
0
    };
3865
3866
0
    hb_set_t retained_coverage_glyphs;
3867
0
    (this+coverage).intersect_set (*glyphs, retained_coverage_glyphs);
3868
3869
0
    hb_set_t coverage_glyph_classes;
3870
0
    input_class_def.intersected_classes (&retained_coverage_glyphs, &coverage_glyph_classes);
3871
3872
0
    return
3873
0
    + hb_iter (ruleSet)
3874
0
    | hb_map (hb_add (this))
3875
0
    | hb_enumerate
3876
0
    | hb_map ([&] (const hb_pair_t<unsigned, const ChainRuleSet &> p)
3877
0
        { return input_class_def.intersects_class (glyphs, p.first) &&
3878
0
           coverage_glyph_classes.has (p.first) &&
3879
0
           p.second.intersects (glyphs, lookup_context); })
3880
0
    | hb_any
3881
0
    ;
3882
0
  }
3883
3884
  bool may_have_non_1to1 () const
3885
0
  { return true; }
3886
3887
  void closure (hb_closure_context_t *c) const
3888
0
  {
3889
0
    if (!(this+coverage).intersects (c->glyphs))
3890
0
      return;
3891
3892
0
    hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs ();
3893
0
    if (unlikely (!cur_active_glyphs)) return;
3894
0
    get_coverage ().intersect_set (c->previous_parent_active_glyphs (),
3895
0
           *cur_active_glyphs);
3896
3897
0
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
3898
0
    const ClassDef &input_class_def = this+inputClassDef;
3899
0
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
3900
3901
0
    hb_map_t caches[3] = {};
3902
0
    intersected_class_cache_t intersected_cache;
3903
0
    struct ChainContextClosureLookupContext lookup_context = {
3904
0
      {intersects_class, intersected_class_glyphs},
3905
0
      ContextFormat::ClassBasedContext,
3906
0
      {&backtrack_class_def,
3907
0
       &input_class_def,
3908
0
       &lookahead_class_def},
3909
0
      {&caches[0], &caches[1], &caches[2]},
3910
0
      &intersected_cache
3911
0
    };
3912
3913
0
    + hb_enumerate (ruleSet)
3914
0
    | hb_filter ([&] (unsigned _)
3915
0
    { return input_class_def.intersects_class (&c->parent_active_glyphs (), _); },
3916
0
     hb_first)
3917
0
    | hb_apply ([&] (const hb_pair_t<unsigned, const typename Types::template OffsetTo<ChainRuleSet>&> _)
3918
0
                {
3919
0
                  const ChainRuleSet& chainrule_set = this+_.second;
3920
0
                  chainrule_set.closure (c, _.first, lookup_context);
3921
0
                })
3922
0
    ;
3923
3924
0
    c->pop_cur_done_glyphs ();
3925
0
  }
3926
3927
  void closure_lookups (hb_closure_lookups_context_t *c) const
3928
0
  {
3929
0
    if (!(this+coverage).intersects (c->glyphs))
3930
0
      return;
3931
3932
0
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
3933
0
    const ClassDef &input_class_def = this+inputClassDef;
3934
0
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
3935
3936
0
    hb_map_t caches[3] = {};
3937
0
    struct ChainContextClosureLookupContext lookup_context = {
3938
0
      {intersects_class, nullptr},
3939
0
      ContextFormat::ClassBasedContext,
3940
0
      {&backtrack_class_def,
3941
0
       &input_class_def,
3942
0
       &lookahead_class_def},
3943
0
      {&caches[0], &caches[1], &caches[2]}
3944
0
    };
3945
3946
0
    + hb_iter (ruleSet)
3947
0
    | hb_map (hb_add (this))
3948
0
    | hb_enumerate
3949
0
    | hb_filter([&] (unsigned klass)
3950
0
    { return input_class_def.intersects_class (c->glyphs, klass); }, hb_first)
3951
0
    | hb_map (hb_second)
3952
0
    | hb_apply ([&] (const ChainRuleSet &_)
3953
0
    { _.closure_lookups (c, lookup_context); })
3954
0
    ;
3955
0
  }
3956
3957
0
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const {}
3958
3959
  void collect_glyphs (hb_collect_glyphs_context_t *c) const
3960
0
  {
3961
0
    (this+coverage).collect_coverage (c->input);
3962
3963
0
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
3964
0
    const ClassDef &input_class_def = this+inputClassDef;
3965
0
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
3966
3967
0
    struct ChainContextCollectGlyphsLookupContext lookup_context = {
3968
0
      {collect_class},
3969
0
      {&backtrack_class_def,
3970
0
       &input_class_def,
3971
0
       &lookahead_class_def}
3972
0
    };
3973
3974
0
    + hb_iter (ruleSet)
3975
0
    | hb_map (hb_add (this))
3976
0
    | hb_apply ([&] (const ChainRuleSet &_) { _.collect_glyphs (c, lookup_context); })
3977
0
    ;
3978
0
  }
3979
3980
  bool would_apply (hb_would_apply_context_t *c) const
3981
0
  {
3982
0
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
3983
0
    const ClassDef &input_class_def = this+inputClassDef;
3984
0
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
3985
3986
0
    unsigned int index = input_class_def.get_class (c->glyphs[0]);
3987
0
    const ChainRuleSet &rule_set = this+ruleSet[index];
3988
0
    struct ChainContextApplyLookupContext lookup_context = {
3989
0
      {{match_class, match_class, match_class}},
3990
0
      {&backtrack_class_def,
3991
0
       &input_class_def,
3992
0
       &lookahead_class_def}
3993
0
    };
3994
0
    return rule_set.would_apply (c, lookup_context);
3995
0
  }
3996
3997
0
  const Coverage &get_coverage () const { return this+coverage; }
3998
3999
  unsigned cache_cost () const
4000
0
  {
4001
0
    return (this+inputClassDef).cost () + (this+lookaheadClassDef).cost ();
4002
0
  }
4003
  static bool cache_func (hb_ot_apply_context_t *c, hb_ot_subtable_cache_op_t op)
4004
0
  {
4005
0
    return context_cache_func (c, op);
4006
0
  }
4007
4008
  struct external_cache_t
4009
  {
4010
    hb_ot_layout_binary_cache_t coverage;
4011
  };
4012
  void *external_cache_create () const
4013
0
  {
4014
0
    external_cache_t *cache = (external_cache_t *) hb_malloc (sizeof (external_cache_t));
4015
0
    if (likely (cache))
4016
0
    {
4017
0
      cache->coverage.clear ();
4018
0
    }
4019
0
    return cache;
4020
0
  }
4021
0
  bool apply_cached (hb_ot_apply_context_t *c, void *external_cache) const { return _apply (c, true, external_cache); }
4022
0
  bool apply (hb_ot_apply_context_t *c, void *external_cache) const { return _apply (c, false, external_cache); }
4023
  bool _apply (hb_ot_apply_context_t *c, bool cached, void *external_cache) const
4024
0
  {
4025
0
    TRACE_APPLY (this);
4026
0
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4027
0
    external_cache_t *cache = (external_cache_t *) external_cache;
4028
0
    unsigned int index = (this+coverage).get_coverage_binary (c->buffer->cur().codepoint, cache ? &cache->coverage : nullptr);
4029
#else
4030
    unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
4031
#endif
4032
0
    if (index == NOT_COVERED) return_trace (false);
4033
4034
0
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
4035
0
    const ClassDef &input_class_def = this+inputClassDef;
4036
0
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
4037
4038
    /* match_class_caches1 is slightly faster. Use it for lookahead,
4039
     * which is typically longer. */
4040
0
    struct ChainContextApplyLookupContext lookup_context = {
4041
0
      {{cached && &backtrack_class_def == &lookahead_class_def ? match_class_cached1 : match_class,
4042
0
        cached ? match_class_cached2 : match_class,
4043
0
        cached ? match_class_cached1 : match_class}},
4044
0
      {&backtrack_class_def,
4045
0
       &input_class_def,
4046
0
       &lookahead_class_def}
4047
0
    };
4048
4049
0
    index = cached
4050
0
         ? get_class_cached2 (input_class_def, c->buffer->cur())
4051
0
          : input_class_def.get_class (c->buffer->cur().codepoint);
4052
0
    const ChainRuleSet &rule_set = this+ruleSet[index];
4053
0
    return_trace (rule_set.apply (c, lookup_context));
4054
0
  }
4055
4056
  bool subset (hb_subset_context_t *c) const
4057
0
  {
4058
0
    TRACE_SUBSET (this);
4059
0
    auto *out = c->serializer->start_embed (*this);
4060
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
4061
0
    out->format = format;
4062
0
    out->coverage.serialize_subset (c, coverage, this);
4063
4064
0
    hb_map_t backtrack_klass_map;
4065
0
    hb_map_t input_klass_map;
4066
0
    hb_map_t lookahead_klass_map;
4067
4068
0
    out->backtrackClassDef.serialize_subset (c, backtrackClassDef, this, &backtrack_klass_map);
4069
    // TODO: subset inputClassDef based on glyphs survived in Coverage subsetting
4070
0
    out->inputClassDef.serialize_subset (c, inputClassDef, this, &input_klass_map);
4071
0
    out->lookaheadClassDef.serialize_subset (c, lookaheadClassDef, this, &lookahead_klass_map);
4072
4073
0
    if (unlikely (!c->serializer->propagate_error (backtrack_klass_map,
4074
0
               input_klass_map,
4075
0
               lookahead_klass_map)))
4076
0
      return_trace (false);
4077
4078
0
    const hb_set_t* glyphset = c->plan->glyphset_gsub ();
4079
0
    hb_set_t retained_coverage_glyphs;
4080
0
    (this+coverage).intersect_set (*glyphset, retained_coverage_glyphs);
4081
4082
0
    hb_set_t coverage_glyph_classes;
4083
0
    (this+inputClassDef).intersected_classes (&retained_coverage_glyphs, &coverage_glyph_classes);
4084
4085
0
    int non_zero_index = -1, index = 0;
4086
0
    bool ret = true;
4087
0
    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
4088
0
    auto last_non_zero = c->serializer->snapshot ();
4089
0
    for (const auto& _ : + hb_enumerate (ruleSet)
4090
0
       | hb_filter (input_klass_map, hb_first))
4091
0
    {
4092
0
      auto *o = out->ruleSet.serialize_append (c->serializer);
4093
0
      if (unlikely (!o))
4094
0
      {
4095
0
  ret = false;
4096
0
  break;
4097
0
      }
4098
0
      if (coverage_glyph_classes.has (_.first) &&
4099
0
          o->serialize_subset (c, _.second, this,
4100
0
             lookup_map,
4101
0
             &backtrack_klass_map,
4102
0
             &input_klass_map,
4103
0
             &lookahead_klass_map))
4104
0
      {
4105
0
        last_non_zero = c->serializer->snapshot ();
4106
0
  non_zero_index = index;
4107
0
      }
4108
4109
0
      index++;
4110
0
    }
4111
4112
0
    if (!ret || non_zero_index == -1) return_trace (false);
4113
4114
    // prune empty trailing ruleSets
4115
0
    if (index > non_zero_index) {
4116
0
      c->serializer->revert (last_non_zero);
4117
0
      out->ruleSet.len = non_zero_index + 1;
4118
0
    }
4119
4120
0
    return_trace (bool (out->ruleSet));
4121
0
  }
4122
4123
  bool sanitize (hb_sanitize_context_t *c) const
4124
0
  {
4125
0
    TRACE_SANITIZE (this);
4126
0
    return_trace (coverage.sanitize (c, this) &&
4127
0
      backtrackClassDef.sanitize (c, this) &&
4128
0
      inputClassDef.sanitize (c, this) &&
4129
0
      lookaheadClassDef.sanitize (c, this) &&
4130
0
      ruleSet.sanitize (c, this));
4131
0
  }
4132
4133
  protected:
4134
  HBUINT16  format;     /* Format identifier--format = 2 */
4135
  typename Types::template OffsetTo<Coverage>
4136
    coverage;   /* Offset to Coverage table--from
4137
           * beginning of table */
4138
  typename Types::template OffsetTo<ClassDef>
4139
    backtrackClassDef;  /* Offset to glyph ClassDef table
4140
           * containing backtrack sequence
4141
           * data--from beginning of table */
4142
  typename Types::template OffsetTo<ClassDef>
4143
    inputClassDef;    /* Offset to glyph ClassDef
4144
           * table containing input sequence
4145
           * data--from beginning of table */
4146
  typename Types::template OffsetTo<ClassDef>
4147
    lookaheadClassDef;  /* Offset to glyph ClassDef table
4148
           * containing lookahead sequence
4149
           * data--from beginning of table */
4150
  Array16Of<typename Types::template OffsetTo<ChainRuleSet>>
4151
    ruleSet;    /* Array of ChainRuleSet tables
4152
           * ordered by class */
4153
  public:
4154
  DEFINE_SIZE_ARRAY (4 + 4 * Types::size, ruleSet);
4155
};
4156
4157
struct ChainContextFormat3
4158
{
4159
  using RuleSet = OT::RuleSet<SmallTypes>;
4160
4161
  bool intersects (const hb_set_t *glyphs) const
4162
0
  {
4163
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
4164
4165
0
    if (!(this+input[0]).intersects (glyphs))
4166
0
      return false;
4167
4168
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
4169
0
    struct ChainContextClosureLookupContext lookup_context = {
4170
0
      {intersects_coverage, nullptr},
4171
0
      ContextFormat::CoverageBasedContext,
4172
0
      {this, this, this}
4173
0
    };
4174
0
    return chain_context_intersects (glyphs,
4175
0
             backtrack.len, (const HBUINT16 *) backtrack.arrayZ,
4176
0
             input.len, (const HBUINT16 *) input.arrayZ + 1,
4177
0
             lookahead.len, (const HBUINT16 *) lookahead.arrayZ,
4178
0
             lookup_context);
4179
0
  }
4180
4181
  bool may_have_non_1to1 () const
4182
0
  { return true; }
4183
4184
  void closure (hb_closure_context_t *c) const
4185
0
  {
4186
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
4187
4188
0
    if (!(this+input[0]).intersects (c->glyphs))
4189
0
      return;
4190
4191
0
    hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs ();
4192
0
    if (unlikely (!cur_active_glyphs))
4193
0
      return;
4194
0
    get_coverage ().intersect_set (c->previous_parent_active_glyphs (),
4195
0
           *cur_active_glyphs);
4196
4197
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
4198
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
4199
0
    struct ChainContextClosureLookupContext lookup_context = {
4200
0
      {intersects_coverage, intersected_coverage_glyphs},
4201
0
      ContextFormat::CoverageBasedContext,
4202
0
      {this, this, this}
4203
0
    };
4204
0
    chain_context_closure_lookup (c,
4205
0
          backtrack.len, (const HBUINT16 *) backtrack.arrayZ,
4206
0
          input.len, (const HBUINT16 *) input.arrayZ + 1,
4207
0
          lookahead.len, (const HBUINT16 *) lookahead.arrayZ,
4208
0
          lookup.len, lookup.arrayZ,
4209
0
          0, lookup_context);
4210
4211
0
    c->pop_cur_done_glyphs ();
4212
0
  }
4213
4214
  void closure_lookups (hb_closure_lookups_context_t *c) const
4215
0
  {
4216
0
    if (!intersects (c->glyphs))
4217
0
      return;
4218
4219
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
4220
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
4221
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
4222
0
    recurse_lookups (c, lookup.len, lookup.arrayZ);
4223
0
  }
4224
4225
0
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const {}
4226
4227
  void collect_glyphs (hb_collect_glyphs_context_t *c) const
4228
0
  {
4229
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
4230
4231
0
    (this+input[0]).collect_coverage (c->input);
4232
4233
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
4234
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
4235
4236
0
    struct ChainContextCollectGlyphsLookupContext lookup_context = {
4237
0
      {collect_coverage},
4238
0
      {this, this, this}
4239
0
    };
4240
0
    chain_context_collect_glyphs_lookup (c,
4241
0
           backtrack.len, (const HBUINT16 *) backtrack.arrayZ,
4242
0
           input.len, (const HBUINT16 *) input.arrayZ + 1,
4243
0
           lookahead.len, (const HBUINT16 *) lookahead.arrayZ,
4244
0
           lookup.len, lookup.arrayZ,
4245
0
           lookup_context);
4246
0
  }
4247
4248
  bool would_apply (hb_would_apply_context_t *c) const
4249
0
  {
4250
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
4251
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
4252
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
4253
0
    struct ChainContextApplyLookupContext lookup_context = {
4254
0
      {{match_coverage, match_coverage, match_coverage}},
4255
0
      {this, this, this}
4256
0
    };
4257
0
    return chain_context_would_apply_lookup (c,
4258
0
               backtrack.len, (const HBUINT16 *) backtrack.arrayZ,
4259
0
               input.len, (const HBUINT16 *) input.arrayZ + 1,
4260
0
               lookahead.len, (const HBUINT16 *) lookahead.arrayZ,
4261
0
               lookup.len, lookup.arrayZ, lookup_context);
4262
0
  }
4263
4264
  const Coverage &get_coverage () const
4265
902
  {
4266
902
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
4267
902
    return this+input[0];
4268
902
  }
4269
4270
  bool apply (hb_ot_apply_context_t *c) const
4271
2.00M
  {
4272
2.00M
    TRACE_APPLY (this);
4273
2.00M
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
4274
4275
2.00M
    unsigned int index = (this+input[0]).get_coverage (c->buffer->cur().codepoint);
4276
2.00M
    if (index == NOT_COVERED) return_trace (false);
4277
4278
1.59M
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
4279
1.59M
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
4280
1.59M
    struct ChainContextApplyLookupContext lookup_context = {
4281
1.59M
      {{match_coverage, match_coverage, match_coverage}},
4282
1.59M
      {this, this, this}
4283
1.59M
    };
4284
1.59M
    return_trace (chain_context_apply_lookup (c,
4285
2.00M
                backtrack.len, (const HBUINT16 *) backtrack.arrayZ,
4286
2.00M
                input.len, (const HBUINT16 *) input.arrayZ + 1,
4287
2.00M
                lookahead.len, (const HBUINT16 *) lookahead.arrayZ,
4288
2.00M
                lookup.len, lookup.arrayZ, lookup_context));
4289
2.00M
  }
4290
4291
  template<typename Iterator,
4292
     hb_requires (hb_is_iterator (Iterator))>
4293
  bool serialize_coverage_offsets (hb_subset_context_t *c, Iterator it, const void* base) const
4294
0
  {
4295
0
    TRACE_SERIALIZE (this);
4296
0
    auto *out = c->serializer->start_embed<Array16OfOffset16To<Coverage>> ();
4297
4298
0
    if (unlikely (!c->serializer->allocate_size<HBUINT16> (HBUINT16::static_size)))
4299
0
      return_trace (false);
4300
4301
0
    for (auto& offset : it) {
4302
0
      auto *o = out->serialize_append (c->serializer);
4303
0
      if (unlikely (!o) || !o->serialize_subset (c, offset, base))
4304
0
        return_trace (false);
4305
0
    }
4306
4307
0
    return_trace (true);
4308
0
  }
4309
4310
  bool subset (hb_subset_context_t *c) const
4311
0
  {
4312
0
    TRACE_SUBSET (this);
4313
4314
0
    if (unlikely (!c->serializer->embed (this->format))) return_trace (false);
4315
4316
0
    if (!serialize_coverage_offsets (c, backtrack.iter (), this))
4317
0
      return_trace (false);
4318
4319
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
4320
0
    if (!serialize_coverage_offsets (c, input.iter (), this))
4321
0
      return_trace (false);
4322
4323
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
4324
0
    if (!serialize_coverage_offsets (c, lookahead.iter (), this))
4325
0
      return_trace (false);
4326
4327
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
4328
0
    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
4329
4330
0
    HBUINT16 *lookupCount = c->serializer->copy<HBUINT16> (lookup.len);
4331
0
    if (!lookupCount) return_trace (false);
4332
4333
0
    unsigned count = serialize_lookuprecord_array (c->serializer, lookup.as_array (), lookup_map);
4334
0
    return_trace (c->serializer->check_assign (*lookupCount, count, HB_SERIALIZE_ERROR_INT_OVERFLOW));
4335
0
  }
4336
4337
  bool sanitize (hb_sanitize_context_t *c) const
4338
2.58k
  {
4339
2.58k
    TRACE_SANITIZE (this);
4340
2.58k
    if (unlikely (!backtrack.sanitize (c, this))) return_trace (false);
4341
2.58k
    hb_barrier ();
4342
2.58k
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
4343
2.58k
    if (unlikely (!input.sanitize (c, this))) return_trace (false);
4344
2.58k
    hb_barrier ();
4345
2.58k
    if (unlikely (!input.len)) return_trace (false); /* To be consistent with Context. */
4346
2.58k
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
4347
2.58k
    if (unlikely (!lookahead.sanitize (c, this))) return_trace (false);
4348
2.58k
    hb_barrier ();
4349
2.58k
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
4350
2.58k
    return_trace (likely (lookup.sanitize (c)));
4351
2.58k
  }
4352
4353
  protected:
4354
  HBUINT16  format;     /* Format identifier--format = 3 */
4355
  Array16OfOffset16To<Coverage>
4356
    backtrack;    /* Array of coverage tables
4357
           * in backtracking sequence, in  glyph
4358
           * sequence order */
4359
  Array16OfOffset16To<Coverage>
4360
    inputX    ; /* Array of coverage
4361
           * tables in input sequence, in glyph
4362
           * sequence order */
4363
  Array16OfOffset16To<Coverage>
4364
    lookaheadX;   /* Array of coverage tables
4365
           * in lookahead sequence, in glyph
4366
           * sequence order */
4367
  Array16Of<LookupRecord>
4368
    lookupX;    /* Array of LookupRecords--in
4369
           * design order) */
4370
  public:
4371
  DEFINE_SIZE_MIN (10);
4372
};
4373
4374
struct ChainContext
4375
{
4376
  template <typename context_t, typename ...Ts>
4377
  typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
4378
3.48k
  {
4379
3.48k
    if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
4380
3.48k
    TRACE_DISPATCH (this, u.format.v);
4381
3.48k
    switch (u.format.v) {
4382
0
    case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
4383
0
    case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
4384
3.48k
    case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
4385
#ifndef HB_NO_BEYOND_64K
4386
    case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
4387
    case 5: hb_barrier (); return_trace (c->dispatch (u.format5, std::forward<Ts> (ds)...));
4388
#endif
4389
0
    default:return_trace (c->default_return_value ());
4390
3.48k
    }
4391
3.48k
  }
hb_sanitize_context_t::return_t OT::ChainContext::dispatch<hb_sanitize_context_t>(hb_sanitize_context_t*) const
Line
Count
Source
4378
2.58k
  {
4379
2.58k
    if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
4380
2.58k
    TRACE_DISPATCH (this, u.format.v);
4381
2.58k
    switch (u.format.v) {
4382
0
    case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
4383
0
    case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
4384
2.58k
    case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
4385
#ifndef HB_NO_BEYOND_64K
4386
    case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
4387
    case 5: hb_barrier (); return_trace (c->dispatch (u.format5, std::forward<Ts> (ds)...));
4388
#endif
4389
0
    default:return_trace (c->default_return_value ());
4390
2.58k
    }
4391
2.58k
  }
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::ChainContext::dispatch<OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::ChainContext::dispatch<OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::ChainContext::dispatch<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::ChainContext::dispatch<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: hb_subset_context_t::return_t OT::ChainContext::dispatch<hb_subset_context_t>(hb_subset_context_t*) const
Unexecuted instantiation: OT::hb_collect_variation_indices_context_t::return_t OT::ChainContext::dispatch<OT::hb_collect_variation_indices_context_t>(OT::hb_collect_variation_indices_context_t*) const
OT::hb_accelerate_subtables_context_t::return_t OT::ChainContext::dispatch<OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Line
Count
Source
4378
902
  {
4379
902
    if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
4380
902
    TRACE_DISPATCH (this, u.format.v);
4381
902
    switch (u.format.v) {
4382
0
    case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
4383
0
    case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
4384
902
    case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
4385
#ifndef HB_NO_BEYOND_64K
4386
    case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
4387
    case 5: hb_barrier (); return_trace (c->dispatch (u.format5, std::forward<Ts> (ds)...));
4388
#endif
4389
0
    default:return_trace (c->default_return_value ());
4390
902
    }
4391
902
  }
Unexecuted instantiation: OT::hb_have_non_1to1_context_t::return_t OT::ChainContext::dispatch<OT::hb_have_non_1to1_context_t>(OT::hb_have_non_1to1_context_t*) const
Unexecuted instantiation: OT::hb_closure_context_t::return_t OT::ChainContext::dispatch<OT::hb_closure_context_t>(OT::hb_closure_context_t*) const
Unexecuted instantiation: OT::hb_would_apply_context_t::return_t OT::ChainContext::dispatch<OT::hb_would_apply_context_t>(OT::hb_would_apply_context_t*) const
Unexecuted instantiation: hb_get_glyph_alternates_dispatch_t::return_t OT::ChainContext::dispatch<hb_get_glyph_alternates_dispatch_t, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&>(hb_get_glyph_alternates_dispatch_t*, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&) const
Unexecuted instantiation: hb_collect_glyph_alternates_dispatch_t::return_t OT::ChainContext::dispatch<hb_collect_glyph_alternates_dispatch_t, hb_map_t*&, hb_map_t*&>(hb_collect_glyph_alternates_dispatch_t*, hb_map_t*&, hb_map_t*&) const
Unexecuted instantiation: hb_position_single_dispatch_t::return_t OT::ChainContext::dispatch<hb_position_single_dispatch_t, hb_font_t*&, hb_blob_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&>(hb_position_single_dispatch_t*, hb_font_t*&, hb_blob_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&) const
4392
4393
  protected:
4394
  union {
4395
  struct { HBUINT16 v; }    format; /* Format identifier */
4396
  ChainContextFormat1_4<SmallTypes> format1;
4397
  ChainContextFormat2_5<SmallTypes> format2;
4398
  ChainContextFormat3     format3;
4399
#ifndef HB_NO_BEYOND_64K
4400
  ChainContextFormat1_4<MediumTypes>  format4;
4401
  ChainContextFormat2_5<MediumTypes>  format5;
4402
#endif
4403
  } u;
4404
};
4405
4406
4407
template <typename T>
4408
struct ExtensionFormat1
4409
{
4410
0
  unsigned int get_type () const { return extensionLookupType; }
Unexecuted instantiation: OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::get_type() const
Unexecuted instantiation: OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::get_type() const
4411
4412
  template <typename X>
4413
  const X& get_subtable () const
4414
0
  { return this + reinterpret_cast<const Offset32To<typename T::SubTable> &> (extensionOffset); }
Unexecuted instantiation: OT::Layout::GSUB_impl::SubstLookupSubTable const& OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::get_subtable<OT::Layout::GSUB_impl::SubstLookupSubTable>() const
Unexecuted instantiation: OT::Layout::GPOS_impl::PosLookupSubTable const& OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::get_subtable<OT::Layout::GPOS_impl::PosLookupSubTable>() const
4415
4416
  template <typename context_t, typename ...Ts>
4417
  typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
4418
0
  {
4419
0
    if (unlikely (!c->may_dispatch (this, this))) return c->no_dispatch_return_value ();
4420
0
    TRACE_DISPATCH (this, format);
4421
0
    return_trace (get_subtable<typename T::SubTable> ().dispatch (c, get_type (), std::forward<Ts> (ds)...));
4422
0
  }
Unexecuted instantiation: hb_sanitize_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<hb_sanitize_context_t>(hb_sanitize_context_t*) const
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: hb_sanitize_context_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<hb_sanitize_context_t>(hb_sanitize_context_t*) const
Unexecuted instantiation: OT::hb_collect_variation_indices_context_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_collect_variation_indices_context_t>(OT::hb_collect_variation_indices_context_t*) const
Unexecuted instantiation: OT::hb_accelerate_subtables_context_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
Unexecuted instantiation: OT::hb_have_non_1to1_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_have_non_1to1_context_t>(OT::hb_have_non_1to1_context_t*) const
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_closure_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_closure_context_t>(OT::hb_closure_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_would_apply_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_would_apply_context_t>(OT::hb_would_apply_context_t*) const
Unexecuted instantiation: OT::hb_accelerate_subtables_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Unexecuted instantiation: hb_get_glyph_alternates_dispatch_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<hb_get_glyph_alternates_dispatch_t, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&>(hb_get_glyph_alternates_dispatch_t*, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&) const
Unexecuted instantiation: hb_collect_glyph_alternates_dispatch_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<hb_collect_glyph_alternates_dispatch_t, hb_map_t*&, hb_map_t*&>(hb_collect_glyph_alternates_dispatch_t*, hb_map_t*&, hb_map_t*&) const
Unexecuted instantiation: hb_position_single_dispatch_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<hb_position_single_dispatch_t, hb_font_t*&, hb_blob_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&>(hb_position_single_dispatch_t*, hb_font_t*&, hb_blob_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&) const
4423
4424
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const
4425
  { dispatch (c); }
4426
4427
  /* This is called from may_dispatch() above with hb_sanitize_context_t. */
4428
  bool sanitize (hb_sanitize_context_t *c) const
4429
0
  {
4430
0
    TRACE_SANITIZE (this);
4431
0
    return_trace (c->check_struct (this) &&
4432
0
      hb_barrier () &&
4433
0
      extensionLookupType != T::SubTable::Extension);
4434
0
  }
Unexecuted instantiation: OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::sanitize(hb_sanitize_context_t*) const
4435
4436
  bool subset (hb_subset_context_t *c) const
4437
0
  {
4438
0
    TRACE_SUBSET (this);
4439
4440
0
    auto *out = c->serializer->start_embed (this);
4441
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
4442
4443
0
    out->format = format;
4444
0
    out->extensionLookupType = extensionLookupType;
4445
4446
0
    const auto& src_offset =
4447
0
        reinterpret_cast<const Offset32To<typename T::SubTable> &> (extensionOffset);
4448
0
    auto& dest_offset =
4449
0
        reinterpret_cast<Offset32To<typename T::SubTable> &> (out->extensionOffset);
4450
4451
0
    return_trace (dest_offset.serialize_subset (c, src_offset, this, get_type ()));
4452
0
  }
Unexecuted instantiation: OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::subset(hb_subset_context_t*) const
Unexecuted instantiation: OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::subset(hb_subset_context_t*) const
4453
4454
  protected:
4455
  HBUINT16  format;     /* Format identifier. Set to 1. */
4456
  HBUINT16  extensionLookupType;  /* Lookup type of subtable referenced
4457
           * by ExtensionOffset (i.e. the
4458
           * extension subtable). */
4459
  Offset32  extensionOffset;  /* Offset to the extension subtable,
4460
           * of lookup type subtable. */
4461
  public:
4462
  DEFINE_SIZE_STATIC (8);
4463
};
4464
4465
template <typename T>
4466
struct Extension
4467
{
4468
  unsigned int get_type () const
4469
0
  {
4470
0
    switch (u.format.v) {
4471
0
    case 1: hb_barrier (); return u.format1.get_type ();
4472
0
    default:return 0;
4473
0
    }
4474
0
  }
Unexecuted instantiation: OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::get_type() const
Unexecuted instantiation: OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::get_type() const
4475
  template <typename X>
4476
  const X& get_subtable () const
4477
  {
4478
    switch (u.format.v) {
4479
    case 1: hb_barrier (); return u.format1.template get_subtable<typename T::SubTable> ();
4480
    default:return Null (typename T::SubTable);
4481
    }
4482
  }
4483
4484
  // Specialization of dispatch for subset. dispatch() normally just
4485
  // dispatches to the sub table this points too, but for subset
4486
  // we need to run subset on this subtable too.
4487
  template <typename ...Ts>
4488
  typename hb_subset_context_t::return_t dispatch (hb_subset_context_t *c, Ts&&... ds) const
4489
0
  {
4490
0
    switch (u.format.v) {
4491
0
    case 1: hb_barrier (); return u.format1.subset (c);
4492
0
    default: return c->default_return_value ();
4493
0
    }
4494
0
  }
Unexecuted instantiation: bool OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<>(hb_subset_context_t*) const
Unexecuted instantiation: bool OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<>(hb_subset_context_t*) const
4495
4496
  template <typename context_t, typename ...Ts>
4497
  typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
4498
0
  {
4499
0
    if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
4500
0
    TRACE_DISPATCH (this, u.format.v);
4501
0
    switch (u.format.v) {
4502
0
    case 1: hb_barrier (); return_trace (u.format1.dispatch (c, std::forward<Ts> (ds)...));
4503
0
    default:return_trace (c->default_return_value ());
4504
0
    }
4505
0
  }
Unexecuted instantiation: hb_sanitize_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<hb_sanitize_context_t>(hb_sanitize_context_t*) const
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: hb_sanitize_context_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<hb_sanitize_context_t>(hb_sanitize_context_t*) const
Unexecuted instantiation: OT::hb_collect_variation_indices_context_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_collect_variation_indices_context_t>(OT::hb_collect_variation_indices_context_t*) const
Unexecuted instantiation: OT::hb_accelerate_subtables_context_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
Unexecuted instantiation: OT::hb_have_non_1to1_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_have_non_1to1_context_t>(OT::hb_have_non_1to1_context_t*) const
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_closure_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_closure_context_t>(OT::hb_closure_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_would_apply_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_would_apply_context_t>(OT::hb_would_apply_context_t*) const
Unexecuted instantiation: OT::hb_accelerate_subtables_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Unexecuted instantiation: hb_get_glyph_alternates_dispatch_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<hb_get_glyph_alternates_dispatch_t, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&>(hb_get_glyph_alternates_dispatch_t*, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&) const
Unexecuted instantiation: hb_collect_glyph_alternates_dispatch_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<hb_collect_glyph_alternates_dispatch_t, hb_map_t*&, hb_map_t*&>(hb_collect_glyph_alternates_dispatch_t*, hb_map_t*&, hb_map_t*&) const
Unexecuted instantiation: hb_position_single_dispatch_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<hb_position_single_dispatch_t, hb_font_t*&, hb_blob_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&>(hb_position_single_dispatch_t*, hb_font_t*&, hb_blob_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&) const
4506
4507
  protected:
4508
  union {
4509
  struct { HBUINT16 v; }  format;   /* Format identifier */
4510
  ExtensionFormat1<T> format1;
4511
  } u;
4512
};
4513
4514
4515
/*
4516
 * GSUB/GPOS Common
4517
 */
4518
4519
struct hb_ot_layout_lookup_accelerator_t
4520
{
4521
  template <typename TLookup>
4522
  static hb_ot_layout_lookup_accelerator_t *create (const TLookup &lookup)
4523
986
  {
4524
986
    unsigned count = lookup.get_subtable_count ();
4525
4526
986
    unsigned size = sizeof (hb_ot_layout_lookup_accelerator_t) -
4527
986
        HB_VAR_ARRAY * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t) +
4528
986
        count * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t);
4529
4530
    /* The following is a calloc because when we are collecting subtables,
4531
     * some of them might be invalid and hence not collect; as a result,
4532
     * we might not fill in all the count entries of the subtables array.
4533
     * Zeroing it allows the set digest to gatekeep it without having to
4534
     * initialize it further. */
4535
986
    auto *thiz = (hb_ot_layout_lookup_accelerator_t *) hb_calloc (1, size);
4536
986
    if (unlikely (!thiz))
4537
0
      return nullptr;
4538
4539
986
    hb_accelerate_subtables_context_t c_accelerate_subtables (thiz->subtables);
4540
986
    lookup.dispatch (&c_accelerate_subtables);
4541
4542
986
    thiz->digest.init ();
4543
986
    for (auto& subtable : hb_iter (thiz->subtables, count))
4544
1.69k
      thiz->digest.union_ (subtable.digest);
4545
4546
986
    thiz->count = count;
4547
4548
986
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4549
986
    thiz->subtable_cache_user_idx = c_accelerate_subtables.subtable_cache_user_idx;
4550
4551
2.67k
    for (unsigned i = 0; i < count; i++)
4552
1.69k
      if (i != thiz->subtable_cache_user_idx)
4553
1.69k
       thiz->subtables[i].apply_cached_func = thiz->subtables[i].apply_func;
4554
986
#endif
4555
4556
986
    return thiz;
4557
986
  }
OT::hb_ot_layout_lookup_accelerator_t* OT::hb_ot_layout_lookup_accelerator_t::create<OT::Layout::GPOS_impl::PosLookup>(OT::Layout::GPOS_impl::PosLookup const&)
Line
Count
Source
4523
889
  {
4524
889
    unsigned count = lookup.get_subtable_count ();
4525
4526
889
    unsigned size = sizeof (hb_ot_layout_lookup_accelerator_t) -
4527
889
        HB_VAR_ARRAY * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t) +
4528
889
        count * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t);
4529
4530
    /* The following is a calloc because when we are collecting subtables,
4531
     * some of them might be invalid and hence not collect; as a result,
4532
     * we might not fill in all the count entries of the subtables array.
4533
     * Zeroing it allows the set digest to gatekeep it without having to
4534
     * initialize it further. */
4535
889
    auto *thiz = (hb_ot_layout_lookup_accelerator_t *) hb_calloc (1, size);
4536
889
    if (unlikely (!thiz))
4537
0
      return nullptr;
4538
4539
889
    hb_accelerate_subtables_context_t c_accelerate_subtables (thiz->subtables);
4540
889
    lookup.dispatch (&c_accelerate_subtables);
4541
4542
889
    thiz->digest.init ();
4543
889
    for (auto& subtable : hb_iter (thiz->subtables, count))
4544
1.59k
      thiz->digest.union_ (subtable.digest);
4545
4546
889
    thiz->count = count;
4547
4548
889
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4549
889
    thiz->subtable_cache_user_idx = c_accelerate_subtables.subtable_cache_user_idx;
4550
4551
2.48k
    for (unsigned i = 0; i < count; i++)
4552
1.59k
      if (i != thiz->subtable_cache_user_idx)
4553
1.59k
       thiz->subtables[i].apply_cached_func = thiz->subtables[i].apply_func;
4554
889
#endif
4555
4556
889
    return thiz;
4557
889
  }
OT::hb_ot_layout_lookup_accelerator_t* OT::hb_ot_layout_lookup_accelerator_t::create<OT::Layout::GSUB_impl::SubstLookup>(OT::Layout::GSUB_impl::SubstLookup const&)
Line
Count
Source
4523
97
  {
4524
97
    unsigned count = lookup.get_subtable_count ();
4525
4526
97
    unsigned size = sizeof (hb_ot_layout_lookup_accelerator_t) -
4527
97
        HB_VAR_ARRAY * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t) +
4528
97
        count * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t);
4529
4530
    /* The following is a calloc because when we are collecting subtables,
4531
     * some of them might be invalid and hence not collect; as a result,
4532
     * we might not fill in all the count entries of the subtables array.
4533
     * Zeroing it allows the set digest to gatekeep it without having to
4534
     * initialize it further. */
4535
97
    auto *thiz = (hb_ot_layout_lookup_accelerator_t *) hb_calloc (1, size);
4536
97
    if (unlikely (!thiz))
4537
0
      return nullptr;
4538
4539
97
    hb_accelerate_subtables_context_t c_accelerate_subtables (thiz->subtables);
4540
97
    lookup.dispatch (&c_accelerate_subtables);
4541
4542
97
    thiz->digest.init ();
4543
97
    for (auto& subtable : hb_iter (thiz->subtables, count))
4544
97
      thiz->digest.union_ (subtable.digest);
4545
4546
97
    thiz->count = count;
4547
4548
97
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4549
97
    thiz->subtable_cache_user_idx = c_accelerate_subtables.subtable_cache_user_idx;
4550
4551
194
    for (unsigned i = 0; i < count; i++)
4552
97
      if (i != thiz->subtable_cache_user_idx)
4553
97
       thiz->subtables[i].apply_cached_func = thiz->subtables[i].apply_func;
4554
97
#endif
4555
4556
97
    return thiz;
4557
97
  }
4558
4559
  void fini ()
4560
0
  {
4561
0
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4562
0
    for (unsigned i = 0; i < count; i++)
4563
0
      hb_free (subtables[i].external_cache);
4564
0
#endif
4565
0
  }
4566
4567
  bool may_have (hb_codepoint_t g) const
4568
0
  { return digest.may_have (g); }
4569
4570
#ifndef HB_OPTIMIZE_SIZE
4571
  HB_ALWAYS_INLINE
4572
#endif
4573
  bool apply (hb_ot_apply_context_t *c, bool use_cache) const
4574
162M
  {
4575
162M
    c->lookup_accel = this;
4576
162M
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4577
162M
    if (use_cache)
4578
0
    {
4579
0
      return
4580
0
      + hb_iter (hb_iter (subtables, count))
4581
0
      | hb_map ([&c] (const hb_accelerate_subtables_context_t::hb_applicable_t &_) { return _.apply_cached (c); })
4582
0
      | hb_any
4583
0
      ;
4584
0
    }
4585
162M
    else
4586
162M
#endif
4587
162M
    {
4588
162M
      return
4589
162M
      + hb_iter (hb_iter (subtables, count))
4590
163M
      | hb_map ([&c] (const hb_accelerate_subtables_context_t::hb_applicable_t &_) { return _.apply (c); })
4591
162M
      | hb_any
4592
162M
      ;
4593
162M
    }
4594
0
    return false;
4595
162M
  }
4596
4597
  bool cache_enter (hb_ot_apply_context_t *c) const
4598
7.61M
  {
4599
7.61M
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4600
7.61M
    return subtable_cache_user_idx != (unsigned) -1 &&
4601
0
     subtables[subtable_cache_user_idx].cache_enter (c);
4602
#else
4603
    return false;
4604
#endif
4605
7.61M
  }
4606
  void cache_leave (hb_ot_apply_context_t *c) const
4607
0
  {
4608
0
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4609
0
    subtables[subtable_cache_user_idx].cache_leave (c);
4610
0
#endif
4611
0
  }
4612
4613
4614
  hb_set_digest_t digest;
4615
  private:
4616
  unsigned count = 0; /* Number of subtables in the array. */
4617
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4618
  unsigned subtable_cache_user_idx = (unsigned) -1;
4619
#endif
4620
  hb_accelerate_subtables_context_t::hb_applicable_t subtables[HB_VAR_ARRAY];
4621
};
4622
4623
template <typename Types>
4624
struct GSUBGPOSVersion1_2
4625
{
4626
  friend struct GSUBGPOS;
4627
4628
  protected:
4629
  FixedVersion<>version;  /* Version of the GSUB/GPOS table--initially set
4630
         * to 0x00010000u */
4631
  typename Types:: template OffsetTo<ScriptList>
4632
    scriptList; /* ScriptList table */
4633
  typename Types::template OffsetTo<FeatureList>
4634
    featureList;  /* FeatureList table */
4635
  typename Types::template OffsetTo<LookupList<Types>>
4636
    lookupList; /* LookupList table */
4637
  Offset32To<FeatureVariations>
4638
    featureVars;  /* Offset to Feature Variations
4639
           table--from beginning of table
4640
         * (may be NULL).  Introduced
4641
         * in version 0x00010001. */
4642
  public:
4643
  DEFINE_SIZE_MIN (4 + 3 * Types::size);
4644
4645
  unsigned int get_size () const
4646
0
  {
4647
0
    return min_size +
4648
0
     (version.to_int () >= 0x00010001u ? featureVars.static_size : 0);
4649
0
  }
4650
4651
  const typename Types::template OffsetTo<LookupList<Types>>* get_lookup_list_offset () const
4652
0
  {
4653
0
    return &lookupList;
4654
0
  }
4655
4656
  template <typename TLookup>
4657
  bool sanitize (hb_sanitize_context_t *c) const
4658
126
  {
4659
126
    TRACE_SANITIZE (this);
4660
126
    typedef List16OfOffsetTo<TLookup, typename Types::HBUINT> TLookupList;
4661
126
    if (unlikely (!(scriptList.sanitize (c, this) &&
4662
126
        featureList.sanitize (c, this) &&
4663
126
        reinterpret_cast<const typename Types::template OffsetTo<TLookupList> &> (lookupList).sanitize (c, this))))
4664
0
      return_trace (false);
4665
4666
126
#ifndef HB_NO_VAR
4667
126
    if (unlikely (!(version.to_int () < 0x00010001u || featureVars.sanitize (c, this))))
4668
0
      return_trace (false);
4669
126
#endif
4670
4671
126
    return_trace (true);
4672
126
  }
bool OT::GSUBGPOSVersion1_2<OT::Layout::SmallTypes>::sanitize<OT::Layout::GSUB_impl::SubstLookup>(hb_sanitize_context_t*) const
Line
Count
Source
4658
63
  {
4659
63
    TRACE_SANITIZE (this);
4660
63
    typedef List16OfOffsetTo<TLookup, typename Types::HBUINT> TLookupList;
4661
63
    if (unlikely (!(scriptList.sanitize (c, this) &&
4662
63
        featureList.sanitize (c, this) &&
4663
63
        reinterpret_cast<const typename Types::template OffsetTo<TLookupList> &> (lookupList).sanitize (c, this))))
4664
0
      return_trace (false);
4665
4666
63
#ifndef HB_NO_VAR
4667
63
    if (unlikely (!(version.to_int () < 0x00010001u || featureVars.sanitize (c, this))))
4668
0
      return_trace (false);
4669
63
#endif
4670
4671
63
    return_trace (true);
4672
63
  }
bool OT::GSUBGPOSVersion1_2<OT::Layout::SmallTypes>::sanitize<OT::Layout::GPOS_impl::PosLookup>(hb_sanitize_context_t*) const
Line
Count
Source
4658
63
  {
4659
63
    TRACE_SANITIZE (this);
4660
63
    typedef List16OfOffsetTo<TLookup, typename Types::HBUINT> TLookupList;
4661
63
    if (unlikely (!(scriptList.sanitize (c, this) &&
4662
63
        featureList.sanitize (c, this) &&
4663
63
        reinterpret_cast<const typename Types::template OffsetTo<TLookupList> &> (lookupList).sanitize (c, this))))
4664
0
      return_trace (false);
4665
4666
63
#ifndef HB_NO_VAR
4667
63
    if (unlikely (!(version.to_int () < 0x00010001u || featureVars.sanitize (c, this))))
4668
0
      return_trace (false);
4669
63
#endif
4670
4671
63
    return_trace (true);
4672
63
  }
4673
4674
  template <typename TLookup>
4675
  bool subset (hb_subset_layout_context_t *c) const
4676
0
  {
4677
0
    TRACE_SUBSET (this);
4678
4679
0
    auto *out = c->subset_context->serializer->start_embed (this);
4680
0
    if (unlikely (!c->subset_context->serializer->extend_min (out))) return_trace (false);
4681
4682
0
    out->version = version;
4683
4684
0
    typedef LookupOffsetList<TLookup, typename Types::HBUINT> TLookupList;
4685
0
    reinterpret_cast<typename Types::template OffsetTo<TLookupList> &> (out->lookupList)
4686
0
  .serialize_subset (c->subset_context,
4687
0
         reinterpret_cast<const typename Types::template OffsetTo<TLookupList> &> (lookupList),
4688
0
         this,
4689
0
         c);
4690
4691
0
    reinterpret_cast<typename Types::template OffsetTo<RecordListOfFeature> &> (out->featureList)
4692
0
  .serialize_subset (c->subset_context,
4693
0
         reinterpret_cast<const typename Types::template OffsetTo<RecordListOfFeature> &> (featureList),
4694
0
         this,
4695
0
         c);
4696
4697
0
    out->scriptList.serialize_subset (c->subset_context,
4698
0
              scriptList,
4699
0
              this,
4700
0
              c);
4701
4702
0
#ifndef HB_NO_VAR
4703
0
    if (version.to_int () >= 0x00010001u)
4704
0
    {
4705
0
      auto snapshot = c->subset_context->serializer->snapshot ();
4706
0
      if (!c->subset_context->serializer->extend_min (&out->featureVars))
4707
0
        return_trace (false);
4708
4709
      // if all axes are pinned all feature vars are dropped.
4710
0
      bool ret = !c->subset_context->plan->all_axes_pinned
4711
0
                 && out->featureVars.serialize_subset (c->subset_context, featureVars, this, c);
4712
0
      if (!ret && version.major == 1)
4713
0
      {
4714
0
        c->subset_context->serializer->revert (snapshot);
4715
0
  out->version.major = 1;
4716
0
  out->version.minor = 0;
4717
0
      }
4718
0
    }
4719
0
#endif
4720
4721
0
    return_trace (true);
4722
0
  }
Unexecuted instantiation: bool OT::GSUBGPOSVersion1_2<OT::Layout::SmallTypes>::subset<OT::Layout::GPOS_impl::PosLookup>(OT::hb_subset_layout_context_t*) const
Unexecuted instantiation: bool OT::GSUBGPOSVersion1_2<OT::Layout::SmallTypes>::subset<OT::Layout::GSUB_impl::SubstLookup>(OT::hb_subset_layout_context_t*) const
4723
};
4724
4725
struct GSUBGPOS
4726
{
4727
  unsigned int get_size () const
4728
0
  {
4729
0
    switch (u.version.major) {
4730
0
    case 1: hb_barrier (); return u.version1.get_size ();
4731
#ifndef HB_NO_BEYOND_64K
4732
    case 2: hb_barrier (); return u.version2.get_size ();
4733
#endif
4734
0
    default: return u.version.static_size;
4735
0
    }
4736
0
  }
4737
4738
  template <typename TLookup>
4739
  bool sanitize (hb_sanitize_context_t *c) const
4740
126
  {
4741
126
    TRACE_SANITIZE (this);
4742
126
    if (unlikely (!u.version.sanitize (c))) return_trace (false);
4743
126
    hb_barrier ();
4744
126
    switch (u.version.major) {
4745
126
    case 1: hb_barrier (); return_trace (u.version1.sanitize<TLookup> (c));
4746
#ifndef HB_NO_BEYOND_64K
4747
    case 2: hb_barrier (); return_trace (u.version2.sanitize<TLookup> (c));
4748
#endif
4749
0
    default: return_trace (true);
4750
126
    }
4751
126
  }
bool OT::GSUBGPOS::sanitize<OT::Layout::GSUB_impl::SubstLookup>(hb_sanitize_context_t*) const
Line
Count
Source
4740
63
  {
4741
63
    TRACE_SANITIZE (this);
4742
63
    if (unlikely (!u.version.sanitize (c))) return_trace (false);
4743
63
    hb_barrier ();
4744
63
    switch (u.version.major) {
4745
63
    case 1: hb_barrier (); return_trace (u.version1.sanitize<TLookup> (c));
4746
#ifndef HB_NO_BEYOND_64K
4747
    case 2: hb_barrier (); return_trace (u.version2.sanitize<TLookup> (c));
4748
#endif
4749
0
    default: return_trace (true);
4750
63
    }
4751
63
  }
bool OT::GSUBGPOS::sanitize<OT::Layout::GPOS_impl::PosLookup>(hb_sanitize_context_t*) const
Line
Count
Source
4740
63
  {
4741
63
    TRACE_SANITIZE (this);
4742
63
    if (unlikely (!u.version.sanitize (c))) return_trace (false);
4743
63
    hb_barrier ();
4744
63
    switch (u.version.major) {
4745
63
    case 1: hb_barrier (); return_trace (u.version1.sanitize<TLookup> (c));
4746
#ifndef HB_NO_BEYOND_64K
4747
    case 2: hb_barrier (); return_trace (u.version2.sanitize<TLookup> (c));
4748
#endif
4749
0
    default: return_trace (true);
4750
63
    }
4751
63
  }
4752
4753
  template <typename TLookup>
4754
  bool subset (hb_subset_layout_context_t *c) const
4755
0
  {
4756
0
    switch (u.version.major) {
4757
0
    case 1: hb_barrier (); return u.version1.subset<TLookup> (c);
4758
#ifndef HB_NO_BEYOND_64K
4759
    case 2: hb_barrier (); return u.version2.subset<TLookup> (c);
4760
#endif
4761
0
    default: return false;
4762
0
    }
4763
0
  }
Unexecuted instantiation: bool OT::GSUBGPOS::subset<OT::Layout::GPOS_impl::PosLookup>(OT::hb_subset_layout_context_t*) const
Unexecuted instantiation: bool OT::GSUBGPOS::subset<OT::Layout::GSUB_impl::SubstLookup>(OT::hb_subset_layout_context_t*) const
4764
4765
  const ScriptList &get_script_list () const
4766
105k
  {
4767
105k
    switch (u.version.major) {
4768
105k
    case 1: hb_barrier (); return this+u.version1.scriptList;
4769
#ifndef HB_NO_BEYOND_64K
4770
    case 2: hb_barrier (); return this+u.version2.scriptList;
4771
#endif
4772
0
    default: return Null (ScriptList);
4773
105k
    }
4774
105k
  }
4775
  const FeatureList &get_feature_list () const
4776
65.9k
  {
4777
65.9k
    switch (u.version.major) {
4778
65.9k
    case 1: hb_barrier (); return this+u.version1.featureList;
4779
#ifndef HB_NO_BEYOND_64K
4780
    case 2: hb_barrier (); return this+u.version2.featureList;
4781
#endif
4782
0
    default: return Null (FeatureList);
4783
65.9k
    }
4784
65.9k
  }
4785
  unsigned int get_lookup_count () const
4786
21.3k
  {
4787
21.3k
    switch (u.version.major) {
4788
21.3k
    case 1: hb_barrier (); return (this+u.version1.lookupList).len;
4789
#ifndef HB_NO_BEYOND_64K
4790
    case 2: hb_barrier (); return (this+u.version2.lookupList).len;
4791
#endif
4792
0
    default: return 0;
4793
21.3k
    }
4794
21.3k
  }
4795
  const Lookup& get_lookup (unsigned int i) const
4796
7.62M
  {
4797
7.62M
    switch (u.version.major) {
4798
7.62M
    case 1: hb_barrier (); return (this+u.version1.lookupList)[i];
4799
#ifndef HB_NO_BEYOND_64K
4800
    case 2: hb_barrier (); return (this+u.version2.lookupList)[i];
4801
#endif
4802
0
    default: return Null (Lookup);
4803
7.62M
    }
4804
7.62M
  }
4805
  const FeatureVariations &get_feature_variations () const
4806
61.9M
  {
4807
61.9M
    switch (u.version.major) {
4808
61.9M
    case 1: hb_barrier (); return (u.version.to_int () >= 0x00010001u && hb_barrier () ? this+u.version1.featureVars : Null (FeatureVariations));
4809
#ifndef HB_NO_BEYOND_64K
4810
    case 2: hb_barrier (); return this+u.version2.featureVars;
4811
#endif
4812
0
    default: return Null (FeatureVariations);
4813
61.9M
    }
4814
61.9M
  }
4815
4816
20.3k
  bool has_data () const { return u.version.to_int (); }
4817
  unsigned int get_script_count () const
4818
365
  { return get_script_list ().len; }
4819
  const Tag& get_script_tag (unsigned int i) const
4820
0
  { return get_script_list ().get_tag (i); }
4821
  unsigned int get_script_tags (unsigned int start_offset,
4822
        unsigned int *script_count /* IN/OUT */,
4823
        hb_tag_t     *script_tags /* OUT */) const
4824
0
  { return get_script_list ().get_tags (start_offset, script_count, script_tags); }
4825
  const Script& get_script (unsigned int i) const
4826
64.0k
  { return get_script_list ()[i]; }
4827
  bool find_script_index (hb_tag_t tag, unsigned int *index) const
4828
41.3k
  { return get_script_list ().find_index (tag, index); }
4829
4830
  unsigned int get_feature_count () const
4831
4.50k
  { return get_feature_list ().len; }
4832
  hb_tag_t get_feature_tag (unsigned int i) const
4833
60.5k
  { return i == Index::NOT_FOUND_INDEX ? HB_TAG_NONE : get_feature_list ().get_tag (i); }
4834
  unsigned int get_feature_tags (unsigned int start_offset,
4835
         unsigned int *feature_count /* IN/OUT */,
4836
         hb_tag_t     *feature_tags /* OUT */) const
4837
0
  { return get_feature_list ().get_tags (start_offset, feature_count, feature_tags); }
4838
  const Feature& get_feature (unsigned int i) const
4839
21.2k
  { return get_feature_list ()[i]; }
4840
  bool find_feature_index (hb_tag_t tag, unsigned int *index) const
4841
0
  { return get_feature_list ().find_index (tag, index); }
4842
4843
  bool find_variations_index (const int *coords, unsigned int num_coords,
4844
            unsigned int *index,
4845
            ItemVarStoreInstancer *instancer) const
4846
61.9M
  {
4847
#ifdef HB_NO_VAR
4848
    *index = FeatureVariations::NOT_FOUND_INDEX;
4849
    return false;
4850
#endif
4851
61.9M
    return get_feature_variations ().find_index (coords, num_coords, index, instancer);
4852
61.9M
  }
4853
  const Feature& get_feature_variation (unsigned int feature_index,
4854
          unsigned int variations_index) const
4855
21.2k
  {
4856
21.2k
#ifndef HB_NO_VAR
4857
21.2k
    if (FeatureVariations::NOT_FOUND_INDEX != variations_index &&
4858
0
  u.version.to_int () >= 0x00010001u)
4859
0
    {
4860
0
      const Feature *feature = get_feature_variations ().find_substitute (variations_index,
4861
0
                    feature_index);
4862
0
      if (feature)
4863
0
  return *feature;
4864
0
    }
4865
21.2k
#endif
4866
21.2k
    return get_feature (feature_index);
4867
21.2k
  }
4868
4869
  void feature_variation_collect_lookups (const hb_set_t *feature_indexes,
4870
            const hb_hashmap_t<unsigned, hb::shared_ptr<hb_set_t>> *feature_record_cond_idx_map,
4871
            hb_set_t       *lookup_indexes /* OUT */) const
4872
365
  {
4873
365
#ifndef HB_NO_VAR
4874
365
    get_feature_variations ().collect_lookups (feature_indexes, feature_record_cond_idx_map, lookup_indexes);
4875
365
#endif
4876
365
  }
4877
4878
#ifndef HB_NO_VAR
4879
  void collect_feature_substitutes_with_variations (hb_collect_feature_substitutes_with_var_context_t *c) const
4880
0
  { get_feature_variations ().collect_feature_substitutes_with_variations (c); }
4881
#endif
4882
4883
  template <typename TLookup>
4884
  void closure_lookups (hb_face_t      *face,
4885
      const hb_set_t *glyphs,
4886
      hb_set_t       *lookup_indexes /* IN/OUT */) const
4887
0
  {
4888
0
    hb_set_t visited_lookups, inactive_lookups;
4889
0
    hb_closure_lookups_context_t c (face, glyphs, &visited_lookups, &inactive_lookups);
4890
4891
0
    c.set_recurse_func (TLookup::template dispatch_recurse_func<hb_closure_lookups_context_t>);
4892
4893
0
    for (unsigned lookup_index : *lookup_indexes)
4894
0
      reinterpret_cast<const TLookup &> (get_lookup (lookup_index)).closure_lookups (&c, lookup_index);
4895
4896
0
    hb_set_union (lookup_indexes, &visited_lookups);
4897
0
    hb_set_subtract (lookup_indexes, &inactive_lookups);
4898
0
  }
Unexecuted instantiation: void OT::GSUBGPOS::closure_lookups<OT::Layout::GPOS_impl::PosLookup>(hb_face_t*, hb_set_t const*, hb_set_t*) const
Unexecuted instantiation: void OT::GSUBGPOS::closure_lookups<OT::Layout::GSUB_impl::SubstLookup>(hb_face_t*, hb_set_t const*, hb_set_t*) const
4899
4900
  void prune_langsys (const hb_map_t *duplicate_feature_map,
4901
                      const hb_set_t *layout_scripts,
4902
                      hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *script_langsys_map,
4903
                      hb_set_t       *new_feature_indexes /* OUT */) const
4904
0
  {
4905
0
    hb_prune_langsys_context_t c (this, script_langsys_map, duplicate_feature_map, new_feature_indexes);
4906
4907
0
    unsigned count = get_script_count ();
4908
0
    for (unsigned script_index = 0; script_index < count; script_index++)
4909
0
    {
4910
0
      const Tag& tag = get_script_tag (script_index);
4911
0
      if (!layout_scripts->has (tag)) continue;
4912
0
      const Script& s = get_script (script_index);
4913
0
      s.prune_langsys (&c, script_index);
4914
0
    }
4915
0
  }
4916
4917
  void prune_features (const hb_map_t *lookup_indices, /* IN */
4918
           const hb_hashmap_t<unsigned, hb::shared_ptr<hb_set_t>> *feature_record_cond_idx_map, /* IN */
4919
           const hb_hashmap_t<unsigned, const Feature*> *feature_substitutes_map, /* IN */
4920
           hb_set_t       *feature_indices /* IN/OUT */) const
4921
0
  {
4922
0
#ifndef HB_NO_VAR
4923
    // This is the set of feature indices which have alternate versions defined
4924
    // if the FeatureVariation's table and the alternate version(s) intersect the
4925
    // set of lookup indices.
4926
0
    hb_set_t alternate_feature_indices;
4927
0
    get_feature_variations ().closure_features (lookup_indices, feature_record_cond_idx_map, &alternate_feature_indices);
4928
0
    if (unlikely (alternate_feature_indices.in_error()))
4929
0
    {
4930
0
      feature_indices->err ();
4931
0
      return;
4932
0
    }
4933
0
#endif
4934
4935
0
    for (unsigned i : hb_iter (feature_indices))
4936
0
    {
4937
0
      hb_tag_t tag =  get_feature_tag (i);
4938
0
      if (tag == HB_TAG ('p', 'r', 'e', 'f'))
4939
        // Note: Never ever drop feature 'pref', even if it's empty.
4940
        // HarfBuzz chooses shaper for Khmer based on presence of this
4941
        // feature. See thread at:
4942
  // http://lists.freedesktop.org/archives/harfbuzz/2012-November/002660.html
4943
0
        continue;
4944
4945
4946
0
      const Feature *f = &(get_feature (i));
4947
0
      const Feature** p = nullptr;
4948
0
      if (feature_substitutes_map->has (i, &p))
4949
0
        f = *p;
4950
4951
0
      if (!f->featureParams.is_null () &&
4952
0
          tag == HB_TAG ('s', 'i', 'z', 'e'))
4953
0
        continue;
4954
4955
0
      if (!f->intersects_lookup_indexes (lookup_indices)
4956
0
#ifndef HB_NO_VAR
4957
0
          && !alternate_feature_indices.has (i)
4958
0
#endif
4959
0
    )
4960
0
  feature_indices->del (i);
4961
0
    }
4962
0
  }
4963
4964
  void collect_name_ids (const hb_map_t *feature_index_map,
4965
                         hb_set_t *nameids_to_retain /* OUT */) const
4966
0
  {
4967
0
    unsigned count = get_feature_count ();
4968
0
    for (unsigned i = 0 ; i < count; i++)
4969
0
    {
4970
0
      if (!feature_index_map->has (i)) continue;
4971
0
      hb_tag_t tag = get_feature_tag (i);
4972
0
      get_feature (i).collect_name_ids (tag, nameids_to_retain);
4973
0
    }
4974
0
  }
4975
4976
  template <typename T>
4977
  struct accelerator_t
4978
  {
4979
    accelerator_t (hb_face_t *face)
4980
126
    {
4981
126
      hb_sanitize_context_t sc;
4982
126
      sc.lazy_some_gpos = true;
4983
126
      this->table = sc.reference_table<T> (face);
4984
4985
126
      if (unlikely (this->table->is_blocklisted (this->table.get_blob (), face)))
4986
0
      {
4987
0
  hb_blob_destroy (this->table.get_blob ());
4988
0
  this->table = hb_blob_get_empty ();
4989
0
      }
4990
4991
126
      this->lookup_count = table->get_lookup_count ();
4992
4993
126
      this->accels = (hb_atomic_t<hb_ot_layout_lookup_accelerator_t *> *) hb_calloc (this->lookup_count, sizeof (*accels));
4994
126
      if (unlikely (!this->accels))
4995
0
      {
4996
0
  this->lookup_count = 0;
4997
0
  this->table.destroy ();
4998
0
  this->table = hb_blob_get_empty ();
4999
0
      }
5000
126
    }
OT::GSUBGPOS::accelerator_t<OT::Layout::GSUB>::accelerator_t(hb_face_t*)
Line
Count
Source
4980
63
    {
4981
63
      hb_sanitize_context_t sc;
4982
63
      sc.lazy_some_gpos = true;
4983
63
      this->table = sc.reference_table<T> (face);
4984
4985
63
      if (unlikely (this->table->is_blocklisted (this->table.get_blob (), face)))
4986
0
      {
4987
0
  hb_blob_destroy (this->table.get_blob ());
4988
0
  this->table = hb_blob_get_empty ();
4989
0
      }
4990
4991
63
      this->lookup_count = table->get_lookup_count ();
4992
4993
63
      this->accels = (hb_atomic_t<hb_ot_layout_lookup_accelerator_t *> *) hb_calloc (this->lookup_count, sizeof (*accels));
4994
63
      if (unlikely (!this->accels))
4995
0
      {
4996
0
  this->lookup_count = 0;
4997
0
  this->table.destroy ();
4998
0
  this->table = hb_blob_get_empty ();
4999
0
      }
5000
63
    }
OT::GSUBGPOS::accelerator_t<OT::Layout::GPOS>::accelerator_t(hb_face_t*)
Line
Count
Source
4980
63
    {
4981
63
      hb_sanitize_context_t sc;
4982
63
      sc.lazy_some_gpos = true;
4983
63
      this->table = sc.reference_table<T> (face);
4984
4985
63
      if (unlikely (this->table->is_blocklisted (this->table.get_blob (), face)))
4986
0
      {
4987
0
  hb_blob_destroy (this->table.get_blob ());
4988
0
  this->table = hb_blob_get_empty ();
4989
0
      }
4990
4991
63
      this->lookup_count = table->get_lookup_count ();
4992
4993
63
      this->accels = (hb_atomic_t<hb_ot_layout_lookup_accelerator_t *> *) hb_calloc (this->lookup_count, sizeof (*accels));
4994
63
      if (unlikely (!this->accels))
4995
0
      {
4996
0
  this->lookup_count = 0;
4997
0
  this->table.destroy ();
4998
0
  this->table = hb_blob_get_empty ();
4999
0
      }
5000
63
    }
5001
    ~accelerator_t ()
5002
0
    {
5003
0
      for (unsigned int i = 0; i < this->lookup_count; i++)
5004
0
      {
5005
0
  auto *accel = this->accels[i].get_relaxed ();
5006
0
  if (accel)
5007
0
    accel->fini ();
5008
0
  hb_free (accel);
5009
0
      }
5010
0
      hb_free (this->accels);
5011
0
      this->table.destroy ();
5012
0
    }
Unexecuted instantiation: OT::GSUBGPOS::accelerator_t<OT::Layout::GSUB>::~accelerator_t()
Unexecuted instantiation: OT::GSUBGPOS::accelerator_t<OT::Layout::GPOS>::~accelerator_t()
5013
5014
61.9M
    hb_blob_t *get_blob () const { return table.get_blob (); }
OT::GSUBGPOS::accelerator_t<OT::Layout::GSUB>::get_blob() const
Line
Count
Source
5014
30.9M
    hb_blob_t *get_blob () const { return table.get_blob (); }
OT::GSUBGPOS::accelerator_t<OT::Layout::GPOS>::get_blob() const
Line
Count
Source
5014
30.9M
    hb_blob_t *get_blob () const { return table.get_blob (); }
5015
5016
    hb_ot_layout_lookup_accelerator_t *get_accel (unsigned lookup_index) const
5017
128M
    {
5018
128M
      if (unlikely (lookup_index >= lookup_count)) return nullptr;
5019
5020
128M
    retry:
5021
128M
      auto *accel = accels[lookup_index].get_acquire ();
5022
128M
      if (unlikely (!accel))
5023
986
      {
5024
986
  accel = hb_ot_layout_lookup_accelerator_t::create (table->get_lookup (lookup_index));
5025
986
  if (unlikely (!accel))
5026
0
    return nullptr;
5027
5028
986
  if (unlikely (!accels[lookup_index].cmpexch (nullptr, accel)))
5029
0
  {
5030
0
    accel->fini ();
5031
0
    hb_free (accel);
5032
0
    goto retry;
5033
0
  }
5034
986
      }
5035
5036
128M
      return accel;
5037
128M
    }
OT::GSUBGPOS::accelerator_t<OT::Layout::GPOS>::get_accel(unsigned int) const
Line
Count
Source
5017
117M
    {
5018
117M
      if (unlikely (lookup_index >= lookup_count)) return nullptr;
5019
5020
117M
    retry:
5021
117M
      auto *accel = accels[lookup_index].get_acquire ();
5022
117M
      if (unlikely (!accel))
5023
889
      {
5024
889
  accel = hb_ot_layout_lookup_accelerator_t::create (table->get_lookup (lookup_index));
5025
889
  if (unlikely (!accel))
5026
0
    return nullptr;
5027
5028
889
  if (unlikely (!accels[lookup_index].cmpexch (nullptr, accel)))
5029
0
  {
5030
0
    accel->fini ();
5031
0
    hb_free (accel);
5032
0
    goto retry;
5033
0
  }
5034
889
      }
5035
5036
117M
      return accel;
5037
117M
    }
OT::GSUBGPOS::accelerator_t<OT::Layout::GSUB>::get_accel(unsigned int) const
Line
Count
Source
5017
11.0M
    {
5018
11.0M
      if (unlikely (lookup_index >= lookup_count)) return nullptr;
5019
5020
11.0M
    retry:
5021
11.0M
      auto *accel = accels[lookup_index].get_acquire ();
5022
11.0M
      if (unlikely (!accel))
5023
97
      {
5024
97
  accel = hb_ot_layout_lookup_accelerator_t::create (table->get_lookup (lookup_index));
5025
97
  if (unlikely (!accel))
5026
0
    return nullptr;
5027
5028
97
  if (unlikely (!accels[lookup_index].cmpexch (nullptr, accel)))
5029
0
  {
5030
0
    accel->fini ();
5031
0
    hb_free (accel);
5032
0
    goto retry;
5033
0
  }
5034
97
      }
5035
5036
11.0M
      return accel;
5037
11.0M
    }
5038
5039
    hb_blob_ptr_t<T> table;
5040
    unsigned int lookup_count;
5041
    hb_atomic_t<hb_ot_layout_lookup_accelerator_t *> *accels;
5042
  };
5043
5044
  protected:
5045
  union {
5046
  FixedVersion<>      version;  /* Version identifier */
5047
  GSUBGPOSVersion1_2<SmallTypes>  version1;
5048
#ifndef HB_NO_BEYOND_64K
5049
  GSUBGPOSVersion1_2<MediumTypes> version2;
5050
#endif
5051
  } u;
5052
  public:
5053
  DEFINE_SIZE_MIN (4);
5054
};
5055
5056
5057
} /* namespace OT */
5058
5059
5060
#endif /* HB_OT_LAYOUT_GSUBGPOS_HH */