Coverage Report

Created: 2025-10-13 06:24

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/harfbuzz/src/hb-ot-layout-common.hh
Line
Count
Source
1
/*
2
 * Copyright © 2007,2008,2009  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_COMMON_HH
30
#define HB_OT_LAYOUT_COMMON_HH
31
32
#include "hb.hh"
33
#include "hb-ot-layout.hh"
34
#include "hb-open-type.hh"
35
#include "hb-set.hh"
36
#include "hb-bimap.hh"
37
#include "hb-cache.hh"
38
39
#include "OT/Layout/Common/Coverage.hh"
40
#include "OT/Layout/types.hh"
41
42
// TODO(garretrieger): cleanup these after migration.
43
using OT::Layout::Common::Coverage;
44
using OT::Layout::Common::RangeRecord;
45
using OT::Layout::SmallTypes;
46
using OT::Layout::MediumTypes;
47
48
49
namespace OT {
50
51
template<typename Iterator>
52
static inline bool ClassDef_serialize (hb_serialize_context_t *c,
53
               Iterator it);
54
55
static bool ClassDef_remap_and_serialize (
56
    hb_serialize_context_t *c,
57
    const hb_set_t &klasses,
58
    bool use_class_zero,
59
    hb_sorted_vector_t<hb_codepoint_pair_t> &glyph_and_klass, /* IN/OUT */
60
    hb_map_t *klass_map /*IN/OUT*/);
61
62
struct hb_collect_feature_substitutes_with_var_context_t
63
{
64
  const hb_map_t *axes_index_tag_map;
65
  const hb_hashmap_t<hb_tag_t, Triple> *axes_location;
66
  hb_hashmap_t<unsigned, hb::shared_ptr<hb_set_t>> *record_cond_idx_map;
67
  hb_hashmap_t<unsigned, const Feature*> *feature_substitutes_map;
68
  hb_set_t& catch_all_record_feature_idxes;
69
70
  // not stored in subset_plan
71
  hb_set_t *feature_indices;
72
  bool apply;
73
  bool variation_applied;
74
  bool universal;
75
  unsigned cur_record_idx;
76
  hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned> *conditionset_map;
77
};
78
79
struct hb_prune_langsys_context_t
80
{
81
  hb_prune_langsys_context_t (const void         *table_,
82
                              hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *script_langsys_map_,
83
                              const hb_map_t     *duplicate_feature_map_,
84
                              hb_set_t           *new_collected_feature_indexes_)
85
      :table (table_),
86
      script_langsys_map (script_langsys_map_),
87
      duplicate_feature_map (duplicate_feature_map_),
88
      new_feature_indexes (new_collected_feature_indexes_),
89
0
      script_count (0),langsys_feature_count (0) {}
90
91
  bool visitScript ()
92
0
  { return script_count++ < HB_MAX_SCRIPTS; }
93
94
  bool visitLangsys (unsigned feature_count)
95
0
  {
96
0
    langsys_feature_count += feature_count;
97
0
    return langsys_feature_count < HB_MAX_LANGSYS_FEATURE_COUNT;
98
0
  }
99
100
  public:
101
  const void *table;
102
  hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *script_langsys_map;
103
  const hb_map_t     *duplicate_feature_map;
104
  hb_set_t           *new_feature_indexes;
105
106
  private:
107
  unsigned script_count;
108
  unsigned langsys_feature_count;
109
};
110
111
struct hb_subset_layout_context_t :
112
  hb_dispatch_context_t<hb_subset_layout_context_t, hb_empty_t, HB_DEBUG_SUBSET>
113
{
114
0
  const char *get_name () { return "SUBSET_LAYOUT"; }
115
0
  static return_t default_return_value () { return hb_empty_t (); }
116
117
  bool visitScript ()
118
0
  {
119
0
    return script_count++ < HB_MAX_SCRIPTS;
120
0
  }
121
122
  bool visitLangSys ()
123
0
  {
124
0
    return langsys_count++ < HB_MAX_LANGSYS;
125
0
  }
126
127
  bool visitFeatureIndex (int count)
128
0
  {
129
0
    feature_index_count += count;
130
0
    return feature_index_count < HB_MAX_FEATURE_INDICES;
131
0
  }
132
133
  bool visitLookupIndex()
134
0
  {
135
0
    lookup_index_count++;
136
0
    return lookup_index_count < HB_MAX_LOOKUP_VISIT_COUNT;
137
0
  }
138
139
  hb_subset_context_t *subset_context;
140
  const hb_tag_t table_tag;
141
  const hb_map_t *lookup_index_map;
142
  const hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *script_langsys_map;
143
  const hb_map_t *feature_index_map;
144
  const hb_map_t *feature_map_w_duplicates;
145
  const hb_hashmap_t<unsigned, const Feature*> *feature_substitutes_map;
146
  hb_hashmap_t<unsigned, hb::shared_ptr<hb_set_t>> *feature_record_cond_idx_map;
147
  const hb_set_t *catch_all_record_feature_idxes;
148
  const hb_hashmap_t<unsigned, hb_pair_t<const void*, const void*>> *feature_idx_tag_map;
149
150
  unsigned cur_script_index;
151
  unsigned cur_feature_var_record_idx;
152
153
  hb_subset_layout_context_t (hb_subset_context_t *c_,
154
            hb_tag_t tag_) :
155
        subset_context (c_),
156
        table_tag (tag_),
157
        cur_script_index (0xFFFFu),
158
        cur_feature_var_record_idx (0u),
159
        script_count (0),
160
        langsys_count (0),
161
        feature_index_count (0),
162
        lookup_index_count (0)
163
0
  {
164
0
    if (tag_ == HB_OT_TAG_GSUB)
165
0
    {
166
0
      lookup_index_map = &c_->plan->gsub_lookups;
167
0
      script_langsys_map = &c_->plan->gsub_langsys;
168
0
      feature_index_map = &c_->plan->gsub_features;
169
0
      feature_map_w_duplicates = &c_->plan->gsub_features_w_duplicates;
170
0
      feature_substitutes_map = &c_->plan->gsub_feature_substitutes_map;
171
0
      feature_record_cond_idx_map = c_->plan->user_axes_location.is_empty () ? nullptr : &c_->plan->gsub_feature_record_cond_idx_map;
172
0
      catch_all_record_feature_idxes = &c_->plan->gsub_old_features;
173
0
      feature_idx_tag_map = &c_->plan->gsub_old_feature_idx_tag_map;
174
0
    }
175
0
    else
176
0
    {
177
0
      lookup_index_map = &c_->plan->gpos_lookups;
178
0
      script_langsys_map = &c_->plan->gpos_langsys;
179
0
      feature_index_map = &c_->plan->gpos_features;
180
0
      feature_map_w_duplicates = &c_->plan->gpos_features_w_duplicates;
181
0
      feature_substitutes_map = &c_->plan->gpos_feature_substitutes_map;
182
0
      feature_record_cond_idx_map = c_->plan->user_axes_location.is_empty () ? nullptr : &c_->plan->gpos_feature_record_cond_idx_map;
183
0
      catch_all_record_feature_idxes = &c_->plan->gpos_old_features;
184
0
      feature_idx_tag_map = &c_->plan->gpos_old_feature_idx_tag_map;
185
0
    }
186
0
  }
187
188
  private:
189
  unsigned script_count;
190
  unsigned langsys_count;
191
  unsigned feature_index_count;
192
  unsigned lookup_index_count;
193
};
194
195
struct ItemVariationStore;
196
struct hb_collect_variation_indices_context_t :
197
       hb_dispatch_context_t<hb_collect_variation_indices_context_t>
198
{
199
  template <typename T>
200
0
  return_t dispatch (const T &obj) { obj.collect_variation_indices (this); return hb_empty_t (); }
Unexecuted instantiation: hb_empty_t OT::hb_collect_variation_indices_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::Layout::GPOS_impl::SinglePosFormat1 const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_variation_indices_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::Layout::GPOS_impl::SinglePosFormat2 const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_variation_indices_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_variation_indices_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_variation_indices_context_t::dispatch<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::Layout::GPOS_impl::CursivePosFormat1 const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_variation_indices_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_variation_indices_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_variation_indices_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_variation_indices_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_variation_indices_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_variation_indices_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_variation_indices_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_variation_indices_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_variation_indices_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
201
0
  static return_t default_return_value () { return hb_empty_t (); }
202
203
  hb_set_t *layout_variation_indices;
204
  const hb_set_t *glyph_set;
205
  const hb_map_t *gpos_lookups;
206
207
  hb_collect_variation_indices_context_t (hb_set_t *layout_variation_indices_,
208
            const hb_set_t *glyph_set_,
209
            const hb_map_t *gpos_lookups_) :
210
          layout_variation_indices (layout_variation_indices_),
211
          glyph_set (glyph_set_),
212
0
          gpos_lookups (gpos_lookups_) {}
213
};
214
215
template<typename OutputArray>
216
struct subset_offset_array_t
217
{
218
  subset_offset_array_t (hb_subset_context_t *subset_context_,
219
       OutputArray& out_,
220
       const void *base_) : subset_context (subset_context_),
221
                out (out_), base (base_) {}
222
223
  template <typename T>
224
  bool operator () (T&& offset)
225
0
  {
226
0
    auto snap = subset_context->serializer->snapshot ();
227
0
    auto *o = out.serialize_append (subset_context->serializer);
228
0
    if (unlikely (!o)) return false;
229
0
    bool ret = o->serialize_subset (subset_context, offset, base);
230
0
    if (!ret)
231
0
    {
232
0
      out.pop ();
233
0
      subset_context->serializer->revert (snap);
234
0
    }
235
0
    return ret;
236
0
  }
Unexecuted instantiation: bool OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >::operator()<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true> const&>(OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true> const&)
Unexecuted instantiation: bool OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >::operator()<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true> const&>(OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true> const&)
Unexecuted instantiation: bool OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >::operator()<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true> const&>(OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true> const&)
Unexecuted instantiation: bool OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >::operator()<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true> const&>(OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true> const&)
Unexecuted instantiation: bool OT::subset_offset_array_t<OT::LookupOffsetList<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u> > >::operator()<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u>, void, true> const&>(OT::OffsetTo<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u>, void, true> const&)
Unexecuted instantiation: bool OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >::operator()<OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true> const&>(OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true> const&)
Unexecuted instantiation: bool OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >::operator()<OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true> const&>(OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true> const&)
Unexecuted instantiation: bool OT::subset_offset_array_t<OT::LookupOffsetList<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u> > >::operator()<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u>, void, true> const&>(OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u>, void, true> const&)
Unexecuted instantiation: bool OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::BaseCoord, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >::operator()<OT::OffsetTo<OT::BaseCoord, OT::NumType<true, unsigned short, 2u>, void, true> const&>(OT::OffsetTo<OT::BaseCoord, OT::NumType<true, unsigned short, 2u>, void, true> const&)
237
238
  private:
239
  hb_subset_context_t *subset_context;
240
  OutputArray &out;
241
  const void *base;
242
};
243
244
245
template<typename OutputArray, typename Arg>
246
struct subset_offset_array_arg_t
247
{
248
  subset_offset_array_arg_t (hb_subset_context_t *subset_context_,
249
           OutputArray& out_,
250
           const void *base_,
251
           Arg &&arg_) : subset_context (subset_context_), out (out_),
252
            base (base_), arg (arg_) {}
253
254
  template <typename T>
255
  bool operator () (T&& offset)
256
0
  {
257
0
    auto snap = subset_context->serializer->snapshot ();
258
0
    auto *o = out.serialize_append (subset_context->serializer);
259
0
    if (unlikely (!o)) return false;
260
0
    bool ret = o->serialize_subset (subset_context, offset, base, arg);
261
0
    if (!ret)
262
0
    {
263
0
      out.pop ();
264
0
      subset_context->serializer->revert (snap);
265
0
    }
266
0
    return ret;
267
0
  }
Unexecuted instantiation: bool OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>::operator()<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true> const&>(OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true> const&)
Unexecuted instantiation: bool OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&>::operator()<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true> const&>(OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true> const&)
Unexecuted instantiation: bool OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&>::operator()<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true> const&>(OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true> const&)
Unexecuted instantiation: bool OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>::operator()<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true> const&>(OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true> const&)
Unexecuted instantiation: bool OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>::operator()<OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true> const&>(OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true> const&)
Unexecuted instantiation: bool OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>::operator()<OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true> const&>(OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true> const&)
268
269
  private:
270
  hb_subset_context_t *subset_context;
271
  OutputArray &out;
272
  const void *base;
273
  Arg &&arg;
274
};
275
276
/*
277
 * Helper to subset an array of offsets. Subsets the thing pointed to by each offset
278
 * and discards the offset in the array if the subset operation results in an empty
279
 * thing.
280
 */
281
struct
282
{
283
  template<typename OutputArray>
284
  subset_offset_array_t<OutputArray>
285
  operator () (hb_subset_context_t *subset_context, OutputArray& out,
286
         const void *base) const
287
0
  { return subset_offset_array_t<OutputArray> (subset_context, out, base); }
Unexecuted instantiation: hb-face.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-font.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_offset_array_t<OT::LookupOffsetList<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::LookupOffsetList<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::LookupOffsetList<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_offset_array_t<OT::LookupOffsetList<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::LookupOffsetList<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::LookupOffsetList<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-font.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: VARC.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: VARC.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: VARC.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: VARC.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-metrics.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shape.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shape.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shape.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shape.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-var.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-static.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-static.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-static.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-static.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ft.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_offset_array_t<OT::LookupOffsetList<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::LookupOffsetList<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::LookupOffsetList<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_offset_array_t<OT::LookupOffsetList<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::LookupOffsetList<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::LookupOffsetList<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-aat-map.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-aat-map.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-aat-map.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-aat-map.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-cff1-table.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-cff2-table.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_t<OT::LookupOffsetList<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::LookupOffsetList<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::LookupOffsetList<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_t<OT::LookupOffsetList<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::LookupOffsetList<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::LookupOffsetList<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::BaseCoord, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::BaseCoord, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::BaseCoord, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Sequence<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::AlternateSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_offset_array_t<OT::LookupOffsetList<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::LookupOffsetList<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::LookupOffsetList<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Condition, OT::NumType<true, unsigned int, 4u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::AttachPoint, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::CaretValue, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::subset_offset_array_t<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::LigGlyph, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*) const
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::subset_offset_array_t<OT::LookupOffsetList<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u> > > OT::$_39::operator()<OT::LookupOffsetList<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u> > >(hb_subset_context_t*, OT::LookupOffsetList<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u> >&, void const*) const
288
289
  /* Variant with one extra argument passed to serialize_subset */
290
  template<typename OutputArray, typename Arg>
291
  subset_offset_array_arg_t<OutputArray, Arg>
292
  operator () (hb_subset_context_t *subset_context, OutputArray& out,
293
         const void *base, Arg &&arg) const
294
0
  { return subset_offset_array_arg_t<OutputArray, Arg> (subset_context, out, base, arg); }
Unexecuted instantiation: hb-ot-face.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, hb_map_t const*&) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, hb_map_t const*&) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, hb_map_t const*&) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, hb_map_t const*&) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, hb_map_t const*&) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, hb_map_t const*&) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::LigatureSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::Ligature<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, hb_map_t const*&) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, hb_map_t const*&) const
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, unsigned int&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, unsigned int&) const
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, hb_map_t const*&) const
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::subset_offset_array_arg_t<OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&> OT::$_39::operator()<OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >, hb_map_t const*&>(hb_subset_context_t*, OT::ArrayOf<OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >&, void const*, hb_map_t const*&) const
295
}
296
HB_FUNCOBJ (subset_offset_array);
297
298
template<typename OutputArray>
299
struct subset_record_array_t
300
{
301
  subset_record_array_t (hb_subset_layout_context_t *c_, OutputArray* out_,
302
       const void *base_) : subset_layout_context (c_),
303
                out (out_), base (base_) {}
304
305
  template <typename T>
306
  void
307
  operator () (T&& record)
308
0
  {
309
0
    auto snap = subset_layout_context->subset_context->serializer->snapshot ();
310
0
    bool ret = record.subset (subset_layout_context, base);
311
0
    if (!ret) subset_layout_context->subset_context->serializer->revert (snap);
312
0
    else out->len++;
313
0
  }
Unexecuted instantiation: void OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> >::operator()<OT::Record<OT::LangSys> const&>(OT::Record<OT::LangSys> const&)
Unexecuted instantiation: void OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >::operator()<OT::FeatureTableSubstitutionRecord const&>(OT::FeatureTableSubstitutionRecord const&)
Unexecuted instantiation: void OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >::operator()<OT::FeatureVariationRecord const&>(OT::FeatureVariationRecord const&)
314
315
  private:
316
  hb_subset_layout_context_t *subset_layout_context;
317
  OutputArray *out;
318
  const void *base;
319
};
320
321
template<typename OutputArray, typename Arg>
322
struct subset_record_array_arg_t
323
{
324
  subset_record_array_arg_t (hb_subset_layout_context_t *c_, OutputArray* out_,
325
           const void *base_,
326
           Arg &&arg_) : subset_layout_context (c_),
327
             out (out_), base (base_), arg (arg_) {}
328
329
  template <typename T>
330
  void
331
  operator () (T&& record)
332
0
  {
333
0
    auto snap = subset_layout_context->subset_context->serializer->snapshot ();
334
0
    bool ret = record.subset (subset_layout_context, base, arg);
335
0
    if (!ret) subset_layout_context->subset_context->serializer->revert (snap);
336
0
    else out->len++;
337
0
  }
Unexecuted instantiation: void OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&>::operator()<OT::Record<OT::Feature> const&>(OT::Record<OT::Feature> const&)
Unexecuted instantiation: void OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>::operator()<OT::FeatureVariationRecord const&>(OT::FeatureVariationRecord const&)
338
339
  private:
340
  hb_subset_layout_context_t *subset_layout_context;
341
  OutputArray *out;
342
  const void *base;
343
  Arg &&arg;
344
};
345
346
/*
347
 * Helper to subset a RecordList/record array. Subsets each Record in the array and
348
 * discards the record if the subset operation returns false.
349
 */
350
struct
351
{
352
  template<typename OutputArray>
353
  subset_record_array_t<OutputArray>
354
  operator () (hb_subset_layout_context_t *c, OutputArray* out,
355
         const void *base) const
356
0
  { return subset_record_array_t<OutputArray> (c, out, base); }
Unexecuted instantiation: hb-face.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_37::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-face.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-face.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-font.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_37::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-font.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-font.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_36::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_36::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_36::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-ot-font.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_36::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-ot-font.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_36::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-ot-font.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_36::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: VARC.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_37::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: VARC.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: VARC.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-ot-metrics.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_37::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-ot-metrics.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-ot-metrics.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-ot-shape.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_37::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-ot-shape.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-ot-shape.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-ot-var.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_37::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-ot-var.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-ot-var.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-static.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_36::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-static.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_36::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-static.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_36::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-ft.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_37::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-ft.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-ft.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_36::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_36::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_36::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-aat-map.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_37::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-aat-map.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-aat-map.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-ot-cff1-table.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_37::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-ot-cff1-table.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-ot-cff1-table.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-ot-cff2-table.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_37::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-ot-cff2-table.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-ot-cff2-table.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_36::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_36::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_36::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_37::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::subset_record_array_t<OT::RecordArrayOf<OT::LangSys> > OT::$_36::operator()<OT::RecordArrayOf<OT::LangSys> >(OT::hb_subset_layout_context_t*, OT::RecordArrayOf<OT::LangSys>*, void const*) const
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > > OT::$_36::operator()<OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureTableSubstitutionRecord, OT::NumType<true, unsigned short, 2u> >*, void const*) const
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::subset_record_array_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > > OT::$_36::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> > >(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*) const
357
358
  /* Variant with one extra argument passed to subset */
359
  template<typename OutputArray, typename Arg>
360
  subset_record_array_arg_t<OutputArray, Arg>
361
  operator () (hb_subset_layout_context_t *c, OutputArray* out,
362
               const void *base, Arg &&arg) const
363
0
  { return subset_record_array_arg_t<OutputArray, Arg> (c, out, base, arg); }
Unexecuted instantiation: hb-face.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_37::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-face.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-font.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_37::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-font.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_36::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-ot-face.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_36::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-ot-font.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_36::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-ot-font.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_36::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: VARC.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_37::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: VARC.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-ot-metrics.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_37::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-ot-metrics.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-ot-shape.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_37::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-ot-shape.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-ot-var.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_37::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-ot-var.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-static.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_36::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-static.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_36::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-ft.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_37::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-ft.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_36::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-aat-layout.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_36::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-aat-map.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_37::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-aat-map.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-ot-cff1-table.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_37::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-ot-cff1-table.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-ot-cff2-table.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_37::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-ot-cff2-table.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_36::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-ot-layout.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_36::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_37::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_37::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::subset_record_array_arg_t<OT::RecordListOfFeature, OT::Feature const*&> OT::$_36::operator()<OT::RecordListOfFeature, OT::Feature const*&>(OT::hb_subset_layout_context_t*, OT::RecordListOfFeature*, void const*, OT::Feature const*&) const
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::subset_record_array_arg_t<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&> OT::$_36::operator()<OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >, bool&>(OT::hb_subset_layout_context_t*, OT::ArrayOf<OT::FeatureVariationRecord, OT::NumType<true, unsigned int, 4u> >*, void const*, bool&) const
364
}
365
HB_FUNCOBJ (subset_record_array);
366
367
368
template<typename OutputArray>
369
struct serialize_math_record_array_t
370
{
371
  serialize_math_record_array_t (hb_serialize_context_t *serialize_context_,
372
                         OutputArray& out_,
373
                         const void *base_) : serialize_context (serialize_context_),
374
                                              out (out_), base (base_) {}
375
376
  template <typename T>
377
  bool operator () (T&& record)
378
  {
379
    if (!serialize_context->copy (record, base)) return false;
380
    out.len++;
381
    return true;
382
  }
383
384
  private:
385
  hb_serialize_context_t *serialize_context;
386
  OutputArray &out;
387
  const void *base;
388
};
389
390
/*
391
 * Helper to serialize an array of MATH records.
392
 */
393
struct
394
{
395
  template<typename OutputArray>
396
  serialize_math_record_array_t<OutputArray>
397
  operator () (hb_serialize_context_t *serialize_context, OutputArray& out,
398
               const void *base) const
399
  { return serialize_math_record_array_t<OutputArray> (serialize_context, out, base); }
400
401
}
402
HB_FUNCOBJ (serialize_math_record_array);
403
404
/*
405
 *
406
 * OpenType Layout Common Table Formats
407
 *
408
 */
409
410
411
/*
412
 * Script, ScriptList, LangSys, Feature, FeatureList, Lookup, LookupList
413
 */
414
415
struct IndexArray : Array16Of<Index>
416
{
417
  bool intersects (const hb_map_t *indexes) const
418
0
  { return hb_any (*this, indexes); }
419
420
  template <typename Iterator,
421
      hb_requires (hb_is_iterator (Iterator))>
422
  void serialize (hb_serialize_context_t *c,
423
      hb_subset_layout_context_t *l,
424
      Iterator it)
425
0
  {
426
0
    if (!it) return;
427
0
    if (unlikely (!c->extend_min ((*this)))) return;
428
0
429
0
    for (const auto _ : it)
430
0
    {
431
0
      if (!l->visitLookupIndex()) break;
432
0
433
0
      Index i;
434
0
      i = _;
435
0
      c->copy (i);
436
0
      this->len++;
437
0
    }
438
0
  }
Unexecuted instantiation: hb-face.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_18LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-font.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_18LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-ot-face.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_19LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-ot-font.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_18LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: VARC.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_19LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-ot-metrics.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_18LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-ot-shape.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_19LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-ot-var.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_18LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-static.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_19LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-ft.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_18LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-aat-layout.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_19LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-aat-map.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_19LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-ot-cff1-table.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_18LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-ot-cff2-table.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_18LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-ot-layout.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_19LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-ot-shaper-arabic.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_19LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
Unexecuted instantiation: hb-ot-shape-fallback.cc:_ZN2OT10IndexArray9serializeI13hb_map_iter_tI16hb_filter_iter_tI10hb_array_tIKNS_5IndexEERPK8hb_map_tRK4$_19LPv0EESB_L24hb_function_sortedness_t0ELSF_0EETnPN12hb_enable_ifIXsr17hb_is_iterator_ofIT_NSK_6item_tEEE5valueEvE4typeELSF_0EEEvP22hb_serialize_context_tPNS_26hb_subset_layout_context_tESK_
439
440
  unsigned int get_indexes (unsigned int start_offset,
441
          unsigned int *_count /* IN/OUT */,
442
          unsigned int *_indexes /* OUT */) const
443
4.46k
  {
444
4.46k
    if (_count)
445
179
    {
446
179
      + this->as_array ().sub_array (start_offset, _count)
447
179
      | hb_sink (hb_array (_indexes, *_count))
448
179
      ;
449
179
    }
450
4.46k
    return this->len;
451
4.46k
  }
452
453
  void add_indexes_to (hb_set_t* output /* OUT */) const
454
0
  {
455
0
    output->add_array (as_array ());
456
0
  }
457
};
458
459
460
/* https://docs.microsoft.com/en-us/typography/opentype/spec/features_pt#size */
461
struct FeatureParamsSize
462
{
463
  bool sanitize (hb_sanitize_context_t *c) const
464
0
  {
465
0
    TRACE_SANITIZE (this);
466
0
    if (unlikely (!c->check_struct (this))) return_trace (false);
467
0
    hb_barrier ();
468
469
    /* This subtable has some "history", if you will.  Some earlier versions of
470
     * Adobe tools calculated the offset of the FeatureParams subtable from the
471
     * beginning of the FeatureList table!  Now, that is dealt with in the
472
     * Feature implementation.  But we still need to be able to tell junk from
473
     * real data.  Note: We don't check that the nameID actually exists.
474
     *
475
     * Read Roberts wrote on 9/15/06 on opentype-list@indx.co.uk :
476
     *
477
     * Yes, it is correct that a new version of the AFDKO (version 2.0) will be
478
     * coming out soon, and that the makeotf program will build a font with a
479
     * 'size' feature that is correct by the specification.
480
     *
481
     * The specification for this feature tag is in the "OpenType Layout Tag
482
     * Registry". You can see a copy of this at:
483
     * https://docs.microsoft.com/en-us/typography/opentype/spec/features_pt#tag-size
484
     *
485
     * Here is one set of rules to determine if the 'size' feature is built
486
     * correctly, or as by the older versions of MakeOTF. You may be able to do
487
     * better.
488
     *
489
     * Assume that the offset to the size feature is according to specification,
490
     * and make the following value checks. If it fails, assume the size
491
     * feature is calculated as versions of MakeOTF before the AFDKO 2.0 built it.
492
     * If this fails, reject the 'size' feature. The older makeOTF's calculated the
493
     * offset from the beginning of the FeatureList table, rather than from the
494
     * beginning of the 'size' Feature table.
495
     *
496
     * If "design size" == 0:
497
     *     fails check
498
     *
499
     * Else if ("subfamily identifier" == 0 and
500
     *     "range start" == 0 and
501
     *     "range end" == 0 and
502
     *     "range start" == 0 and
503
     *     "menu name ID" == 0)
504
     *     passes check: this is the format used when there is a design size
505
     * specified, but there is no recommended size range.
506
     *
507
     * Else if ("design size" <  "range start" or
508
     *     "design size" >   "range end" or
509
     *     "range end" <= "range start" or
510
     *     "menu name ID"  < 256 or
511
     *     "menu name ID"  > 32767 or
512
     *     menu name ID is not a name ID which is actually in the name table)
513
     *     fails test
514
     * Else
515
     *     passes test.
516
     */
517
518
0
    if (!designSize)
519
0
      return_trace (false);
520
0
    else if (subfamilyID == 0 &&
521
0
       subfamilyNameID == 0 &&
522
0
       rangeStart == 0 &&
523
0
       rangeEnd == 0)
524
0
      return_trace (true);
525
0
    else if (designSize < rangeStart ||
526
0
       designSize > rangeEnd ||
527
0
       subfamilyNameID < 256 ||
528
0
       subfamilyNameID > 32767)
529
0
      return_trace (false);
530
0
    else
531
0
      return_trace (true);
532
0
  }
533
534
  void collect_name_ids (hb_set_t *nameids_to_retain /* OUT */) const
535
0
  { nameids_to_retain->add (subfamilyNameID); }
536
537
  bool subset (hb_subset_context_t *c) const
538
0
  {
539
0
    TRACE_SUBSET (this);
540
0
    return_trace ((bool) c->serializer->embed (*this));
541
0
  }
542
543
  HBUINT16  designSize; /* Represents the design size in 720/inch
544
         * units (decipoints).  The design size entry
545
         * must be non-zero.  When there is a design
546
         * size but no recommended size range, the
547
         * rest of the array will consist of zeros. */
548
  HBUINT16  subfamilyID;  /* Has no independent meaning, but serves
549
         * as an identifier that associates fonts
550
         * in a subfamily. All fonts which share a
551
         * Preferred or Font Family name and which
552
         * differ only by size range shall have the
553
         * same subfamily value, and no fonts which
554
         * differ in weight or style shall have the
555
         * same subfamily value. If this value is
556
         * zero, the remaining fields in the array
557
         * will be ignored. */
558
  NameID  subfamilyNameID;/* If the preceding value is non-zero, this
559
         * value must be set in the range 256 - 32767
560
         * (inclusive). It records the value of a
561
         * field in the name table, which must
562
         * contain English-language strings encoded
563
         * in Windows Unicode and Macintosh Roman,
564
         * and may contain additional strings
565
         * localized to other scripts and languages.
566
         * Each of these strings is the name an
567
         * application should use, in combination
568
         * with the family name, to represent the
569
         * subfamily in a menu.  Applications will
570
         * choose the appropriate version based on
571
         * their selection criteria. */
572
  HBUINT16  rangeStart; /* Large end of the recommended usage range
573
         * (inclusive), stored in 720/inch units
574
         * (decipoints). */
575
  HBUINT16  rangeEnd; /* Small end of the recommended usage range
576
           (exclusive), stored in 720/inch units
577
         * (decipoints). */
578
  public:
579
  DEFINE_SIZE_STATIC (10);
580
};
581
582
/* https://docs.microsoft.com/en-us/typography/opentype/spec/features_pt#ssxx */
583
struct FeatureParamsStylisticSet
584
{
585
  bool sanitize (hb_sanitize_context_t *c) const
586
0
  {
587
0
    TRACE_SANITIZE (this);
588
    /* Right now minorVersion is at zero.  Which means, any table supports
589
     * the uiNameID field. */
590
0
    return_trace (c->check_struct (this));
591
0
  }
592
593
  void collect_name_ids (hb_set_t *nameids_to_retain /* OUT */) const
594
0
  { nameids_to_retain->add (uiNameID); }
595
596
  bool subset (hb_subset_context_t *c) const
597
0
  {
598
0
    TRACE_SUBSET (this);
599
0
    return_trace ((bool) c->serializer->embed (*this));
600
0
  }
601
602
  HBUINT16  version;  /* (set to 0): This corresponds to a “minor”
603
         * version number. Additional data may be
604
         * added to the end of this Feature Parameters
605
         * table in the future. */
606
607
  NameID  uiNameID; /* The 'name' table name ID that specifies a
608
         * string (or strings, for multiple languages)
609
         * for a user-interface label for this
610
         * feature.  The values of uiLabelNameId and
611
         * sampleTextNameId are expected to be in the
612
         * font-specific name ID range (256-32767),
613
         * though that is not a requirement in this
614
         * Feature Parameters specification. The
615
         * user-interface label for the feature can
616
         * be provided in multiple languages. An
617
         * English string should be included as a
618
         * fallback. The string should be kept to a
619
         * minimal length to fit comfortably with
620
         * different application interfaces. */
621
  public:
622
  DEFINE_SIZE_STATIC (4);
623
};
624
625
/* https://docs.microsoft.com/en-us/typography/opentype/spec/features_ae#cv01-cv99 */
626
struct FeatureParamsCharacterVariants
627
{
628
  unsigned
629
  get_characters (unsigned start_offset, unsigned *char_count, hb_codepoint_t *chars) const
630
0
  {
631
0
    if (char_count)
632
0
    {
633
0
      + characters.as_array ().sub_array (start_offset, char_count)
634
0
      | hb_sink (hb_array (chars, *char_count))
635
0
      ;
636
0
    }
637
0
    return characters.len;
638
0
  }
639
640
  unsigned get_size () const
641
0
  { return min_size + characters.len * HBUINT24::static_size; }
642
643
  void collect_name_ids (hb_set_t *nameids_to_retain /* OUT */) const
644
0
  {
645
0
    if (featUILableNameID) nameids_to_retain->add (featUILableNameID);
646
0
    if (featUITooltipTextNameID) nameids_to_retain->add (featUITooltipTextNameID);
647
0
    if (sampleTextNameID) nameids_to_retain->add (sampleTextNameID);
648
0
649
0
    if (!firstParamUILabelNameID || !numNamedParameters || numNamedParameters >= 0x7FFF)
650
0
      return;
651
0
652
0
    unsigned last_name_id = (unsigned) firstParamUILabelNameID + (unsigned) numNamedParameters - 1;
653
0
    nameids_to_retain->add_range (firstParamUILabelNameID, last_name_id);
654
0
  }
655
656
  bool subset (hb_subset_context_t *c) const
657
0
  {
658
0
    TRACE_SUBSET (this);
659
0
    return_trace ((bool) c->serializer->embed (*this));
660
0
  }
661
662
  bool sanitize (hb_sanitize_context_t *c) const
663
0
  {
664
0
    TRACE_SANITIZE (this);
665
0
    return_trace (c->check_struct (this) &&
666
0
      characters.sanitize (c));
667
0
  }
668
669
  HBUINT16  format;     /* Format number is set to 0. */
670
  NameID  featUILableNameID;  /* The ‘name’ table name ID that
671
           * specifies a string (or strings,
672
           * for multiple languages) for a
673
           * user-interface label for this
674
           * feature. (May be NULL.) */
675
  NameID  featUITooltipTextNameID;/* The ‘name’ table name ID that
676
           * specifies a string (or strings,
677
           * for multiple languages) that an
678
           * application can use for tooltip
679
           * text for this feature. (May be
680
           * nullptr.) */
681
  NameID  sampleTextNameID; /* The ‘name’ table name ID that
682
           * specifies sample text that
683
           * illustrates the effect of this
684
           * feature. (May be NULL.) */
685
  HBUINT16  numNamedParameters; /* Number of named parameters. (May
686
           * be zero.) */
687
  NameID  firstParamUILabelNameID;/* The first ‘name’ table name ID
688
           * used to specify strings for
689
           * user-interface labels for the
690
           * feature parameters. (Must be zero
691
           * if numParameters is zero.) */
692
  Array16Of<HBUINT24>
693
    characters;   /* Array of the Unicode Scalar Value
694
           * of the characters for which this
695
           * feature provides glyph variants.
696
           * (May be zero.) */
697
  public:
698
  DEFINE_SIZE_ARRAY (14, characters);
699
};
700
701
struct FeatureParams
702
{
703
  bool sanitize (hb_sanitize_context_t *c, hb_tag_t tag) const
704
0
  {
705
#ifdef HB_NO_LAYOUT_FEATURE_PARAMS
706
    return true;
707
#endif
708
0
    TRACE_SANITIZE (this);
709
0
    if (tag == HB_TAG ('s','i','z','e'))
710
0
      return_trace (u.size.sanitize (c));
711
0
    if ((tag & 0xFFFF0000u) == HB_TAG ('s','s','\0','\0')) /* ssXX */
712
0
      return_trace (u.stylisticSet.sanitize (c));
713
0
    if ((tag & 0xFFFF0000u) == HB_TAG ('c','v','\0','\0')) /* cvXX */
714
0
      return_trace (u.characterVariants.sanitize (c));
715
0
    return_trace (true);
716
0
  }
717
718
  void collect_name_ids (hb_tag_t tag, hb_set_t *nameids_to_retain /* OUT */) const
719
0
  {
720
0
#ifdef HB_NO_LAYOUT_FEATURE_PARAMS
721
0
    return;
722
0
#endif
723
0
    if (tag == HB_TAG ('s','i','z','e'))
724
0
      return (u.size.collect_name_ids (nameids_to_retain));
725
0
    if ((tag & 0xFFFF0000u) == HB_TAG ('s','s','\0','\0')) /* ssXX */
726
0
      return (u.stylisticSet.collect_name_ids (nameids_to_retain));
727
0
    if ((tag & 0xFFFF0000u) == HB_TAG ('c','v','\0','\0')) /* cvXX */
728
0
      return (u.characterVariants.collect_name_ids (nameids_to_retain));
729
0
  }
730
731
  bool subset (hb_subset_context_t *c, const Tag* tag) const
732
0
  {
733
0
    TRACE_SUBSET (this);
734
0
    if (!tag) return_trace (false);
735
0
    if (*tag == HB_TAG ('s','i','z','e'))
736
0
      return_trace (u.size.subset (c));
737
0
    if ((*tag & 0xFFFF0000u) == HB_TAG ('s','s','\0','\0')) /* ssXX */
738
0
      return_trace (u.stylisticSet.subset (c));
739
0
    if ((*tag & 0xFFFF0000u) == HB_TAG ('c','v','\0','\0')) /* cvXX */
740
0
      return_trace (u.characterVariants.subset (c));
741
0
    return_trace (false);
742
0
  }
743
744
#ifndef HB_NO_LAYOUT_FEATURE_PARAMS
745
  const FeatureParamsSize& get_size_params (hb_tag_t tag) const
746
0
  {
747
0
    if (tag == HB_TAG ('s','i','z','e'))
748
0
      return u.size;
749
0
    return Null (FeatureParamsSize);
750
0
  }
751
  const FeatureParamsStylisticSet& get_stylistic_set_params (hb_tag_t tag) const
752
0
  {
753
0
    if ((tag & 0xFFFF0000u) == HB_TAG ('s','s','\0','\0')) /* ssXX */
754
0
      return u.stylisticSet;
755
0
    return Null (FeatureParamsStylisticSet);
756
0
  }
757
  const FeatureParamsCharacterVariants& get_character_variants_params (hb_tag_t tag) const
758
0
  {
759
0
    if ((tag & 0xFFFF0000u) == HB_TAG ('c','v','\0','\0')) /* cvXX */
760
0
      return u.characterVariants;
761
0
    return Null (FeatureParamsCharacterVariants);
762
0
  }
763
#endif
764
765
  private:
766
  union {
767
  FeatureParamsSize     size;
768
  FeatureParamsStylisticSet   stylisticSet;
769
  FeatureParamsCharacterVariants  characterVariants;
770
  } u;
771
  public:
772
  DEFINE_SIZE_MIN (0);
773
};
774
775
struct Record_sanitize_closure_t {
776
  hb_tag_t tag;
777
  const void *list_base;
778
};
779
780
struct Feature
781
{
782
  unsigned int get_lookup_count () const
783
0
  { return lookupIndex.len; }
784
  hb_tag_t get_lookup_index (unsigned int i) const
785
0
  { return lookupIndex[i]; }
786
  unsigned int get_lookup_indexes (unsigned int start_index,
787
           unsigned int *lookup_count /* IN/OUT */,
788
           unsigned int *lookup_tags /* OUT */) const
789
102
  { return lookupIndex.get_indexes (start_index, lookup_count, lookup_tags); }
790
  void add_lookup_indexes_to (hb_set_t *lookup_indexes) const
791
0
  { lookupIndex.add_indexes_to (lookup_indexes); }
792
793
  const FeatureParams &get_feature_params () const
794
0
  { return this+featureParams; }
795
796
  bool intersects_lookup_indexes (const hb_map_t *lookup_indexes) const
797
0
  { return lookupIndex.intersects (lookup_indexes); }
798
799
  void collect_name_ids (hb_tag_t tag, hb_set_t *nameids_to_retain /* OUT */) const
800
0
  {
801
0
    if (featureParams)
802
0
      get_feature_params ().collect_name_ids (tag, nameids_to_retain);
803
0
  }
804
805
  bool subset (hb_subset_context_t         *c,
806
         hb_subset_layout_context_t  *l,
807
         const Tag                   *tag = nullptr) const
808
0
  {
809
0
    TRACE_SUBSET (this);
810
0
    auto *out = c->serializer->start_embed (*this);
811
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
812
0
813
0
    out->featureParams.serialize_subset (c, featureParams, this, tag);
814
0
815
0
    auto it =
816
0
    + hb_iter (lookupIndex)
817
0
    | hb_filter (l->lookup_index_map)
818
0
    | hb_map (l->lookup_index_map)
819
0
    ;
820
0
821
0
    out->lookupIndex.serialize (c->serializer, l, it);
822
0
    // The decision to keep or drop this feature is already made before we get here
823
0
    // so always retain it.
824
0
    return_trace (true);
825
0
  }
826
827
  bool sanitize (hb_sanitize_context_t *c,
828
     const Record_sanitize_closure_t *closure = nullptr) const
829
5.68k
  {
830
5.68k
    TRACE_SANITIZE (this);
831
5.68k
    if (unlikely (!(c->check_struct (this) && lookupIndex.sanitize (c))))
832
0
      return_trace (false);
833
5.68k
    hb_barrier ();
834
835
    /* Some earlier versions of Adobe tools calculated the offset of the
836
     * FeatureParams subtable from the beginning of the FeatureList table!
837
     *
838
     * If sanitizing "failed" for the FeatureParams subtable, try it with the
839
     * alternative location.  We would know sanitize "failed" if old value
840
     * of the offset was non-zero, but it's zeroed now.
841
     *
842
     * Only do this for the 'size' feature, since at the time of the faulty
843
     * Adobe tools, only the 'size' feature had FeatureParams defined.
844
     */
845
846
5.68k
    if (likely (featureParams.is_null ()))
847
5.68k
      return_trace (true);
848
849
0
    unsigned int orig_offset = featureParams;
850
0
    if (unlikely (!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE)))
851
0
      return_trace (false);
852
0
    hb_barrier ();
853
854
0
    if (featureParams == 0 && closure &&
855
0
  closure->tag == HB_TAG ('s','i','z','e') &&
856
0
  closure->list_base && closure->list_base < this)
857
0
    {
858
0
      unsigned int new_offset_int = orig_offset -
859
0
            (((char *) this) - ((char *) closure->list_base));
860
861
0
      Offset16To<FeatureParams> new_offset;
862
      /* Check that it would not overflow. */
863
0
      new_offset = new_offset_int;
864
0
      if (new_offset == new_offset_int &&
865
0
    c->try_set (&featureParams, new_offset_int) &&
866
0
    !featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE))
867
0
  return_trace (false);
868
0
    }
869
870
0
    return_trace (true);
871
0
  }
872
873
  Offset16To<FeatureParams>
874
     featureParams; /* Offset to Feature Parameters table (if one
875
         * has been defined for the feature), relative
876
         * to the beginning of the Feature Table; = Null
877
         * if not required */
878
  IndexArray   lookupIndex; /* Array of LookupList indices */
879
  public:
880
  DEFINE_SIZE_ARRAY_SIZED (4, lookupIndex);
881
};
882
883
template <typename Type>
884
struct Record
885
{
886
17.1k
  int cmp (hb_tag_t a) const { return tag.cmp (a); }
OT::Record<OT::LangSys>::cmp(unsigned int) const
Line
Count
Source
886
55
  int cmp (hb_tag_t a) const { return tag.cmp (a); }
OT::Record<OT::Script>::cmp(unsigned int) const
Line
Count
Source
886
17.1k
  int cmp (hb_tag_t a) const { return tag.cmp (a); }
Unexecuted instantiation: OT::Record<OT::Feature>::cmp(unsigned int) const
Unexecuted instantiation: OT::Record<OT::JstfLangSys>::cmp(unsigned int) const
Unexecuted instantiation: OT::Record<OT::JstfScript>::cmp(unsigned int) const
887
888
  bool subset (hb_subset_layout_context_t *c, const void *base, const void *f_sub = nullptr) const
889
0
  {
890
0
    TRACE_SUBSET (this);
891
0
    auto *out = c->subset_context->serializer->embed (this);
892
0
    if (unlikely (!out)) return_trace (false);
893
0
894
0
    if (!f_sub)
895
0
      return_trace (out->offset.serialize_subset (c->subset_context, offset, base, c, &tag));
896
0
897
0
    const Feature& f = *reinterpret_cast<const Feature *> (f_sub);
898
0
    auto *s = c->subset_context->serializer;
899
0
    s->push ();
900
0
901
0
    out->offset = 0;
902
0
    bool ret = f.subset (c->subset_context, c, &tag);
903
0
    if (ret)
904
0
      s->add_link (out->offset, s->pop_pack ());
905
0
    else
906
0
      s->pop_discard ();
907
0
908
0
    return_trace (ret);
909
0
  }
Unexecuted instantiation: OT::Record<OT::Feature>::subset(OT::hb_subset_layout_context_t*, void const*, void const*) const
Unexecuted instantiation: OT::Record<OT::LangSys>::subset(OT::hb_subset_layout_context_t*, void const*, void const*) const
Unexecuted instantiation: OT::Record<OT::Script>::subset(OT::hb_subset_layout_context_t*, void const*, void const*) const
910
911
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
912
9.77k
  {
913
9.77k
    TRACE_SANITIZE (this);
914
9.77k
    const Record_sanitize_closure_t closure = {tag, base};
915
9.77k
    return_trace (c->check_struct (this) &&
916
9.77k
      offset.sanitize (c, base, &closure));
917
9.77k
  }
OT::Record<OT::LangSys>::sanitize(hb_sanitize_context_t*, void const*) const
Line
Count
Source
912
230
  {
913
230
    TRACE_SANITIZE (this);
914
230
    const Record_sanitize_closure_t closure = {tag, base};
915
230
    return_trace (c->check_struct (this) &&
916
230
      offset.sanitize (c, base, &closure));
917
230
  }
OT::Record<OT::Script>::sanitize(hb_sanitize_context_t*, void const*) const
Line
Count
Source
912
3.86k
  {
913
3.86k
    TRACE_SANITIZE (this);
914
3.86k
    const Record_sanitize_closure_t closure = {tag, base};
915
3.86k
    return_trace (c->check_struct (this) &&
916
3.86k
      offset.sanitize (c, base, &closure));
917
3.86k
  }
OT::Record<OT::Feature>::sanitize(hb_sanitize_context_t*, void const*) const
Line
Count
Source
912
5.68k
  {
913
5.68k
    TRACE_SANITIZE (this);
914
5.68k
    const Record_sanitize_closure_t closure = {tag, base};
915
5.68k
    return_trace (c->check_struct (this) &&
916
5.68k
      offset.sanitize (c, base, &closure));
917
5.68k
  }
Unexecuted instantiation: OT::Record<OT::JstfLangSys>::sanitize(hb_sanitize_context_t*, void const*) const
Unexecuted instantiation: OT::Record<OT::JstfScript>::sanitize(hb_sanitize_context_t*, void const*) const
918
919
  Tag           tag;            /* 4-byte Tag identifier */
920
  Offset16To<Type>
921
                offset;         /* Offset from beginning of object holding
922
                                 * the Record */
923
  public:
924
  DEFINE_SIZE_STATIC (6);
925
};
926
927
template <typename Type>
928
struct RecordArrayOf : SortedArray16Of<Record<Type>>
929
{
930
  const Offset16To<Type>& get_offset (unsigned int i) const
931
12.9k
  { return (*this)[i].offset; }
OT::RecordArrayOf<OT::Script>::get_offset(unsigned int) const
Line
Count
Source
931
12.8k
  { return (*this)[i].offset; }
OT::RecordArrayOf<OT::Feature>::get_offset(unsigned int) const
Line
Count
Source
931
102
  { return (*this)[i].offset; }
932
  Offset16To<Type>& get_offset (unsigned int i)
933
  { return (*this)[i].offset; }
934
  const Tag& get_tag (unsigned int i) const
935
79
  { return (*this)[i].tag; }
Unexecuted instantiation: OT::RecordArrayOf<OT::LangSys>::get_tag(unsigned int) const
Unexecuted instantiation: OT::RecordArrayOf<OT::Script>::get_tag(unsigned int) const
OT::RecordArrayOf<OT::Feature>::get_tag(unsigned int) const
Line
Count
Source
935
79
  { return (*this)[i].tag; }
Unexecuted instantiation: OT::RecordArrayOf<OT::JstfLangSys>::get_tag(unsigned int) const
Unexecuted instantiation: OT::RecordArrayOf<OT::JstfScript>::get_tag(unsigned int) const
936
  unsigned int get_tags (unsigned int start_offset,
937
                         unsigned int *record_count /* IN/OUT */,
938
                         hb_tag_t     *record_tags /* OUT */) const
939
0
  {
940
0
    if (record_count)
941
0
    {
942
0
      + this->as_array ().sub_array (start_offset, record_count)
943
0
      | hb_map (&Record<Type>::tag)
944
0
      | hb_sink (hb_array (record_tags, *record_count))
945
0
      ;
946
0
    }
947
0
    return this->len;
948
0
  }
Unexecuted instantiation: OT::RecordArrayOf<OT::LangSys>::get_tags(unsigned int, unsigned int*, unsigned int*) const
Unexecuted instantiation: OT::RecordArrayOf<OT::Script>::get_tags(unsigned int, unsigned int*, unsigned int*) const
Unexecuted instantiation: OT::RecordArrayOf<OT::Feature>::get_tags(unsigned int, unsigned int*, unsigned int*) const
Unexecuted instantiation: OT::RecordArrayOf<OT::JstfLangSys>::get_tags(unsigned int, unsigned int*, unsigned int*) const
Unexecuted instantiation: OT::RecordArrayOf<OT::JstfScript>::get_tags(unsigned int, unsigned int*, unsigned int*) const
949
  bool find_index (hb_tag_t tag, unsigned int *index) const
950
23.8k
  {
951
23.8k
    return this->bfind (tag, index, HB_NOT_FOUND_STORE, Index::NOT_FOUND_INDEX);
952
23.8k
  }
OT::RecordArrayOf<OT::LangSys>::find_index(unsigned int, unsigned int*) const
Line
Count
Source
950
6.85k
  {
951
6.85k
    return this->bfind (tag, index, HB_NOT_FOUND_STORE, Index::NOT_FOUND_INDEX);
952
6.85k
  }
OT::RecordArrayOf<OT::Script>::find_index(unsigned int, unsigned int*) const
Line
Count
Source
950
17.0k
  {
951
17.0k
    return this->bfind (tag, index, HB_NOT_FOUND_STORE, Index::NOT_FOUND_INDEX);
952
17.0k
  }
Unexecuted instantiation: OT::RecordArrayOf<OT::Feature>::find_index(unsigned int, unsigned int*) const
Unexecuted instantiation: OT::RecordArrayOf<OT::JstfLangSys>::find_index(unsigned int, unsigned int*) const
Unexecuted instantiation: OT::RecordArrayOf<OT::JstfScript>::find_index(unsigned int, unsigned int*) const
953
};
954
955
template <typename Type>
956
struct RecordListOf : RecordArrayOf<Type>
957
{
958
  const Type& operator [] (unsigned int i) const
959
12.9k
  { return this+this->get_offset (i); }
OT::RecordListOf<OT::Script>::operator[](unsigned int) const
Line
Count
Source
959
12.8k
  { return this+this->get_offset (i); }
OT::RecordListOf<OT::Feature>::operator[](unsigned int) const
Line
Count
Source
959
102
  { return this+this->get_offset (i); }
960
961
  bool subset (hb_subset_context_t *c,
962
               hb_subset_layout_context_t *l) const
963
  {
964
    TRACE_SUBSET (this);
965
    auto *out = c->serializer->start_embed (*this);
966
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
967
968
    + this->iter ()
969
    | hb_apply (subset_record_array (l, out, this))
970
    ;
971
    return_trace (true);
972
  }
973
974
  bool sanitize (hb_sanitize_context_t *c) const
975
7.33k
  {
976
7.33k
    TRACE_SANITIZE (this);
977
7.33k
    return_trace (RecordArrayOf<Type>::sanitize (c, this));
978
7.33k
  }
OT::RecordListOf<OT::Script>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
975
3.66k
  {
976
3.66k
    TRACE_SANITIZE (this);
977
3.66k
    return_trace (RecordArrayOf<Type>::sanitize (c, this));
978
3.66k
  }
OT::RecordListOf<OT::Feature>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
975
3.66k
  {
976
3.66k
    TRACE_SANITIZE (this);
977
3.66k
    return_trace (RecordArrayOf<Type>::sanitize (c, this));
978
3.66k
  }
979
};
980
981
struct RecordListOfFeature : RecordListOf<Feature>
982
{
983
  bool subset (hb_subset_context_t *c,
984
         hb_subset_layout_context_t *l) const
985
0
  {
986
0
    TRACE_SUBSET (this);
987
0
    auto *out = c->serializer->start_embed (*this);
988
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
989
0
990
0
    + hb_enumerate (*this)
991
0
    | hb_filter (l->feature_index_map, hb_first)
992
0
    | hb_apply ([l, out, this] (const hb_pair_t<unsigned, const Record<Feature>&>& _)
993
0
                {
994
0
                  const Feature *f_sub = nullptr;
995
0
                  const Feature **f = nullptr;
996
0
                  if (l->feature_substitutes_map->has (_.first, &f))
997
0
                    f_sub = *f;
998
0
999
0
                  subset_record_array (l, out, this, f_sub) (_.second);
1000
0
                })
1001
0
    ;
1002
0
1003
0
    return_trace (true);
1004
0
  }
1005
};
1006
1007
typedef RecordListOf<Feature> FeatureList;
1008
1009
1010
struct LangSys
1011
{
1012
  unsigned int get_feature_count () const
1013
6
  { return featureIndex.len; }
1014
  hb_tag_t get_feature_index (unsigned int i) const
1015
0
  { return featureIndex[i]; }
1016
  unsigned int get_feature_indexes (unsigned int start_offset,
1017
            unsigned int *feature_count /* IN/OUT */,
1018
            unsigned int *feature_indexes /* OUT */) const
1019
4.35k
  { return featureIndex.get_indexes (start_offset, feature_count, feature_indexes); }
1020
  void add_feature_indexes_to (hb_set_t *feature_indexes) const
1021
0
  { featureIndex.add_indexes_to (feature_indexes); }
1022
1023
4.28k
  bool has_required_feature () const { return reqFeatureIndex != 0xFFFFu; }
1024
  unsigned int get_required_feature_index () const
1025
4.28k
  {
1026
4.28k
    if (reqFeatureIndex == 0xFFFFu)
1027
4.28k
      return Index::NOT_FOUND_INDEX;
1028
2
   return reqFeatureIndex;
1029
4.28k
  }
1030
1031
  LangSys* copy (hb_serialize_context_t *c) const
1032
0
  {
1033
0
    TRACE_SERIALIZE (this);
1034
0
    return_trace (c->embed (*this));
1035
0
  }
1036
1037
  bool compare (const LangSys& o, const hb_map_t *feature_index_map) const
1038
0
  {
1039
0
    if (reqFeatureIndex != o.reqFeatureIndex)
1040
0
      return false;
1041
0
1042
0
    auto iter =
1043
0
    + hb_iter (featureIndex)
1044
0
    | hb_filter (feature_index_map)
1045
0
    | hb_map (feature_index_map)
1046
0
    ;
1047
0
1048
0
    auto o_iter =
1049
0
    + hb_iter (o.featureIndex)
1050
0
    | hb_filter (feature_index_map)
1051
0
    | hb_map (feature_index_map)
1052
0
    ;
1053
0
1054
0
    for (; iter && o_iter; iter++, o_iter++)
1055
0
    {
1056
0
      unsigned a = *iter;
1057
0
      unsigned b = *o_iter;
1058
0
      if (a != b) return false;
1059
0
    }
1060
0
1061
0
    if (iter || o_iter) return false;
1062
0
1063
0
    return true;
1064
0
  }
1065
1066
  void collect_features (hb_prune_langsys_context_t *c) const
1067
0
  {
1068
0
    if (!has_required_feature () && !get_feature_count ()) return;
1069
0
    if (has_required_feature () &&
1070
0
        c->duplicate_feature_map->has (reqFeatureIndex))
1071
0
      c->new_feature_indexes->add (get_required_feature_index ());
1072
0
1073
0
    + hb_iter (featureIndex)
1074
0
    | hb_filter (c->duplicate_feature_map)
1075
0
    | hb_sink (c->new_feature_indexes)
1076
0
    ;
1077
0
  }
1078
1079
  bool subset (hb_subset_context_t        *c,
1080
         hb_subset_layout_context_t *l,
1081
         const Tag                  *tag = nullptr) const
1082
0
  {
1083
0
    TRACE_SUBSET (this);
1084
0
    auto *out = c->serializer->start_embed (*this);
1085
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
1086
0
1087
0
    const uint32_t *v;
1088
0
    out->reqFeatureIndex = l->feature_map_w_duplicates->has (reqFeatureIndex, &v) ? *v : 0xFFFFu;
1089
0
1090
0
    if (!l->visitFeatureIndex (featureIndex.len))
1091
0
      return_trace (false);
1092
0
1093
0
    auto it =
1094
0
    + hb_iter (featureIndex)
1095
0
    | hb_filter (l->feature_map_w_duplicates)
1096
0
    | hb_map (l->feature_map_w_duplicates)
1097
0
    ;
1098
0
1099
0
    bool ret = bool (it);
1100
0
    out->featureIndex.serialize (c->serializer, l, it);
1101
0
    return_trace (ret);
1102
0
  }
1103
1104
  bool sanitize (hb_sanitize_context_t *c,
1105
     const Record_sanitize_closure_t * = nullptr) const
1106
4.09k
  {
1107
4.09k
    TRACE_SANITIZE (this);
1108
4.09k
    return_trace (c->check_struct (this) && featureIndex.sanitize (c));
1109
4.09k
  }
1110
1111
  Offset16  lookupOrderZ; /* = Null (reserved for an offset to a
1112
         * reordering table) */
1113
  HBUINT16  reqFeatureIndex;/* Index of a feature required for this
1114
         * language system--if no required features
1115
         * = 0xFFFFu */
1116
  IndexArray  featureIndex; /* Array of indices into the FeatureList */
1117
  public:
1118
  DEFINE_SIZE_ARRAY_SIZED (6, featureIndex);
1119
};
1120
DECLARE_NULL_NAMESPACE_BYTES (OT, LangSys);
1121
1122
struct Script
1123
{
1124
  unsigned int get_lang_sys_count () const
1125
0
  { return langSys.len; }
1126
  const Tag& get_lang_sys_tag (unsigned int i) const
1127
0
  { return langSys.get_tag (i); }
1128
  unsigned int get_lang_sys_tags (unsigned int start_offset,
1129
          unsigned int *lang_sys_count /* IN/OUT */,
1130
          hb_tag_t     *lang_sys_tags /* OUT */) const
1131
0
  { return langSys.get_tags (start_offset, lang_sys_count, lang_sys_tags); }
1132
  const LangSys& get_lang_sys (unsigned int i) const
1133
8.57k
  {
1134
8.57k
    if (i == Index::NOT_FOUND_INDEX) return get_default_lang_sys ();
1135
0
    return this+langSys[i].offset;
1136
8.57k
  }
1137
  bool find_lang_sys_index (hb_tag_t tag, unsigned int *index) const
1138
6.85k
  { return langSys.find_index (tag, index); }
1139
1140
0
  bool has_default_lang_sys () const           { return defaultLangSys != 0; }
1141
8.57k
  const LangSys& get_default_lang_sys () const { return this+defaultLangSys; }
1142
1143
  void prune_langsys (hb_prune_langsys_context_t *c,
1144
                      unsigned script_index) const
1145
0
  {
1146
0
    if (!has_default_lang_sys () && !get_lang_sys_count ()) return;
1147
0
    if (!c->visitScript ()) return;
1148
0
1149
0
    if (!c->script_langsys_map->has (script_index))
1150
0
    {
1151
0
      if (unlikely (!c->script_langsys_map->set (script_index, hb::unique_ptr<hb_set_t> {hb_set_create ()})))
1152
0
  return;
1153
0
    }
1154
0
1155
0
    if (has_default_lang_sys ())
1156
0
    {
1157
0
      //only collect features from non-redundant langsys
1158
0
      const LangSys& d = get_default_lang_sys ();
1159
0
      if (c->visitLangsys (d.get_feature_count ())) {
1160
0
        d.collect_features (c);
1161
0
      }
1162
0
1163
0
      for (auto _ : + hb_enumerate (langSys))
1164
0
      {
1165
0
        const LangSys& l = this+_.second.offset;
1166
0
        if (!c->visitLangsys (l.get_feature_count ())) continue;
1167
0
        if (l.compare (d, c->duplicate_feature_map)) continue;
1168
0
1169
0
        l.collect_features (c);
1170
0
        c->script_langsys_map->get (script_index)->add (_.first);
1171
0
      }
1172
0
    }
1173
0
    else
1174
0
    {
1175
0
      for (auto _ : + hb_enumerate (langSys))
1176
0
      {
1177
0
        const LangSys& l = this+_.second.offset;
1178
0
        if (!c->visitLangsys (l.get_feature_count ())) continue;
1179
0
        l.collect_features (c);
1180
0
        c->script_langsys_map->get (script_index)->add (_.first);
1181
0
      }
1182
0
    }
1183
0
  }
1184
1185
  bool subset (hb_subset_context_t         *c,
1186
         hb_subset_layout_context_t  *l,
1187
         const Tag                   *tag) const
1188
0
  {
1189
0
    TRACE_SUBSET (this);
1190
0
    if (!l->visitScript ()) return_trace (false);
1191
0
    if (tag && !c->plan->layout_scripts.has (*tag))
1192
0
      return false;
1193
0
1194
0
    auto *out = c->serializer->start_embed (*this);
1195
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
1196
0
1197
0
    bool defaultLang = false;
1198
0
    if (has_default_lang_sys ())
1199
0
    {
1200
0
      c->serializer->push ();
1201
0
      const LangSys& ls = this+defaultLangSys;
1202
0
      bool ret = ls.subset (c, l);
1203
0
      if (!ret && tag && *tag != HB_TAG ('D', 'F', 'L', 'T'))
1204
0
      {
1205
0
  c->serializer->pop_discard ();
1206
0
  out->defaultLangSys = 0;
1207
0
      }
1208
0
      else
1209
0
      {
1210
0
  c->serializer->add_link (out->defaultLangSys, c->serializer->pop_pack ());
1211
0
  defaultLang = true;
1212
0
      }
1213
0
    }
1214
0
1215
0
    const hb_set_t *active_langsys = l->script_langsys_map->get (l->cur_script_index);
1216
0
    if (active_langsys)
1217
0
    {
1218
0
      + hb_enumerate (langSys)
1219
0
      | hb_filter (active_langsys, hb_first)
1220
0
      | hb_map (hb_second)
1221
0
      | hb_filter ([=] (const Record<LangSys>& record) {return l->visitLangSys (); })
1222
0
      | hb_apply (subset_record_array (l, &(out->langSys), this))
1223
0
      ;
1224
0
    }
1225
0
1226
0
    return_trace (bool (out->langSys.len) || defaultLang || l->table_tag == HB_OT_TAG_GSUB);
1227
0
  }
1228
1229
  bool sanitize (hb_sanitize_context_t *c,
1230
     const Record_sanitize_closure_t * = nullptr) const
1231
3.86k
  {
1232
3.86k
    TRACE_SANITIZE (this);
1233
3.86k
    return_trace (defaultLangSys.sanitize (c, this) && langSys.sanitize (c, this));
1234
3.86k
  }
1235
1236
  protected:
1237
  Offset16To<LangSys>
1238
    defaultLangSys; /* Offset to DefaultLangSys table--from
1239
         * beginning of Script table--may be Null */
1240
  RecordArrayOf<LangSys>
1241
    langSys;  /* Array of LangSysRecords--listed
1242
         * alphabetically by LangSysTag */
1243
  public:
1244
  DEFINE_SIZE_ARRAY_SIZED (4, langSys);
1245
};
1246
1247
struct RecordListOfScript : RecordListOf<Script>
1248
{
1249
  bool subset (hb_subset_context_t *c,
1250
               hb_subset_layout_context_t *l) const
1251
0
  {
1252
0
    TRACE_SUBSET (this);
1253
0
    auto *out = c->serializer->start_embed (*this);
1254
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
1255
0
1256
0
    for (auto _ : + hb_enumerate (*this))
1257
0
    {
1258
0
      auto snap = c->serializer->snapshot ();
1259
0
      l->cur_script_index = _.first;
1260
0
      bool ret = _.second.subset (l, this);
1261
0
      if (!ret) c->serializer->revert (snap);
1262
0
      else out->len++;
1263
0
    }
1264
0
1265
0
    return_trace (true);
1266
0
  }
1267
};
1268
1269
typedef RecordListOfScript ScriptList;
1270
1271
1272
1273
struct LookupFlag : HBUINT16
1274
{
1275
  enum Flags {
1276
    RightToLeft   = 0x0001u,
1277
    IgnoreBaseGlyphs  = 0x0002u,
1278
    IgnoreLigatures = 0x0004u,
1279
    IgnoreMarks   = 0x0008u,
1280
    IgnoreFlags   = 0x000Eu,
1281
    UseMarkFilteringSet = 0x0010u,
1282
    Reserved    = 0x00E0u,
1283
    MarkAttachmentType  = 0xFF00u
1284
  };
1285
  public:
1286
  DEFINE_SIZE_STATIC (2);
1287
};
1288
1289
} /* namespace OT */
1290
/* This has to be outside the namespace. */
1291
HB_MARK_AS_FLAG_T (OT::LookupFlag::Flags);
1292
namespace OT {
1293
1294
struct Lookup
1295
{
1296
5.86k
  unsigned int get_subtable_count () const { return subTable.len; }
1297
1298
  template <typename TSubTable>
1299
  const Array16OfOffset16To<TSubTable>& get_subtables () const
1300
5.87k
  { return reinterpret_cast<const Array16OfOffset16To<TSubTable> &> (subTable); }
OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > const& OT::Lookup::get_subtables<OT::Layout::GPOS_impl::PosLookupSubTable>() const
Line
Count
Source
1300
154
  { return reinterpret_cast<const Array16OfOffset16To<TSubTable> &> (subTable); }
OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> > const& OT::Lookup::get_subtables<OT::Layout::GSUB_impl::SubstLookupSubTable>() const
Line
Count
Source
1300
5.72k
  { return reinterpret_cast<const Array16OfOffset16To<TSubTable> &> (subTable); }
1301
  template <typename TSubTable>
1302
  Array16OfOffset16To<TSubTable>& get_subtables ()
1303
0
  { return reinterpret_cast<Array16OfOffset16To<TSubTable> &> (subTable); }
Unexecuted instantiation: OT::ArrayOf<OT::OffsetTo<OT::Layout::GPOS_impl::PosLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >& OT::Lookup::get_subtables<OT::Layout::GPOS_impl::PosLookupSubTable>()
Unexecuted instantiation: OT::ArrayOf<OT::OffsetTo<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::NumType<true, unsigned short, 2u>, void, true>, OT::NumType<true, unsigned short, 2u> >& OT::Lookup::get_subtables<OT::Layout::GSUB_impl::SubstLookupSubTable>()
1304
1305
  template <typename TSubTable>
1306
  const TSubTable& get_subtable (unsigned int i) const
1307
103
  { return this+get_subtables<TSubTable> ()[i]; }
OT::Layout::GPOS_impl::PosLookupSubTable const& OT::Lookup::get_subtable<OT::Layout::GPOS_impl::PosLookupSubTable>(unsigned int) const
Line
Count
Source
1307
56
  { return this+get_subtables<TSubTable> ()[i]; }
OT::Layout::GSUB_impl::SubstLookupSubTable const& OT::Lookup::get_subtable<OT::Layout::GSUB_impl::SubstLookupSubTable>(unsigned int) const
Line
Count
Source
1307
47
  { return this+get_subtables<TSubTable> ()[i]; }
1308
  template <typename TSubTable>
1309
  TSubTable& get_subtable (unsigned int i)
1310
  { return this+get_subtables<TSubTable> ()[i]; }
1311
1312
  unsigned int get_size () const
1313
0
  {
1314
0
    const HBUINT16 &markFilteringSet = StructAfter<const HBUINT16> (subTable);
1315
0
    if (lookupFlag & LookupFlag::UseMarkFilteringSet)
1316
0
      return (const char *) &StructAfter<const char> (markFilteringSet) - (const char *) this;
1317
0
    return (const char *) &markFilteringSet - (const char *) this;
1318
0
  }
1319
1320
11.5k
  unsigned int get_type () const { return lookupType; }
1321
1322
  /* lookup_props is a 32-bit integer where the lower 16-bit is LookupFlag and
1323
   * higher 16-bit is mark-filtering-set if the lookup uses one.
1324
   * Not to be confused with glyph_props which is very similar. */
1325
  uint32_t get_props () const
1326
0
  {
1327
0
    unsigned int flag = lookupFlag;
1328
0
    if (unlikely (flag & LookupFlag::UseMarkFilteringSet))
1329
0
    {
1330
0
      const HBUINT16 &markFilteringSet = StructAfter<HBUINT16> (subTable);
1331
0
      flag += (markFilteringSet << 16);
1332
0
    }
1333
0
    return flag;
1334
0
  }
1335
1336
  template <typename TSubTable, typename context_t, typename ...Ts>
1337
  typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
1338
46
  {
1339
46
    unsigned int lookup_type = get_type ();
1340
46
    TRACE_DISPATCH (this, lookup_type);
1341
46
    unsigned int count = get_subtable_count ();
1342
149
    for (unsigned int i = 0; i < count; i++) {
1343
103
      typename context_t::return_t r = get_subtable<TSubTable> (i).dispatch (c, lookup_type, ds...);
1344
103
      if (c->stop_sublookup_iteration (r))
1345
0
  return_trace (r);
1346
103
    }
1347
46
    return_trace (c->default_return_value ());
1348
46
  }
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::Lookup::dispatch<OT::Layout::GPOS_impl::PosLookupSubTable, OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::Lookup::dispatch<OT::Layout::GPOS_impl::PosLookupSubTable, OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::Lookup::dispatch<OT::Layout::GPOS_impl::PosLookupSubTable, OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::Lookup::dispatch<OT::Layout::GPOS_impl::PosLookupSubTable, OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: OT::hb_collect_variation_indices_context_t::return_t OT::Lookup::dispatch<OT::Layout::GPOS_impl::PosLookupSubTable, OT::hb_collect_variation_indices_context_t>(OT::hb_collect_variation_indices_context_t*) const
OT::hb_accelerate_subtables_context_t::return_t OT::Lookup::dispatch<OT::Layout::GPOS_impl::PosLookupSubTable, OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Line
Count
Source
1338
26
  {
1339
26
    unsigned int lookup_type = get_type ();
1340
26
    TRACE_DISPATCH (this, lookup_type);
1341
26
    unsigned int count = get_subtable_count ();
1342
82
    for (unsigned int i = 0; i < count; i++) {
1343
56
      typename context_t::return_t r = get_subtable<TSubTable> (i).dispatch (c, lookup_type, ds...);
1344
56
      if (c->stop_sublookup_iteration (r))
1345
0
  return_trace (r);
1346
56
    }
1347
26
    return_trace (c->default_return_value ());
1348
26
  }
Unexecuted instantiation: OT::hb_have_non_1to1_context_t::return_t OT::Lookup::dispatch<OT::Layout::GSUB_impl::SubstLookupSubTable, 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::Lookup::dispatch<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::Lookup::dispatch<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
Unexecuted instantiation: OT::hb_closure_context_t::return_t OT::Lookup::dispatch<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::hb_closure_context_t>(OT::hb_closure_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::Lookup::dispatch<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::Lookup::dispatch<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_would_apply_context_t::return_t OT::Lookup::dispatch<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::hb_would_apply_context_t>(OT::hb_would_apply_context_t*) const
OT::hb_accelerate_subtables_context_t::return_t OT::Lookup::dispatch<OT::Layout::GSUB_impl::SubstLookupSubTable, OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Line
Count
Source
1338
20
  {
1339
20
    unsigned int lookup_type = get_type ();
1340
20
    TRACE_DISPATCH (this, lookup_type);
1341
20
    unsigned int count = get_subtable_count ();
1342
67
    for (unsigned int i = 0; i < count; i++) {
1343
47
      typename context_t::return_t r = get_subtable<TSubTable> (i).dispatch (c, lookup_type, ds...);
1344
47
      if (c->stop_sublookup_iteration (r))
1345
0
  return_trace (r);
1346
47
    }
1347
20
    return_trace (c->default_return_value ());
1348
20
  }
Unexecuted instantiation: hb_get_glyph_alternates_dispatch_t::return_t OT::Lookup::dispatch<OT::Layout::GSUB_impl::SubstLookupSubTable, 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::Lookup::dispatch<OT::Layout::GSUB_impl::SubstLookupSubTable, 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::Lookup::dispatch<OT::Layout::GPOS_impl::PosLookupSubTable, 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
1349
1350
  bool serialize (hb_serialize_context_t *c,
1351
      unsigned int lookup_type,
1352
      uint32_t lookup_props,
1353
      unsigned int num_subtables)
1354
0
  {
1355
0
    TRACE_SERIALIZE (this);
1356
0
    if (unlikely (!c->extend_min (this))) return_trace (false);
1357
0
    lookupType = lookup_type;
1358
0
    lookupFlag = lookup_props & 0xFFFFu;
1359
0
    if (unlikely (!subTable.serialize (c, num_subtables))) return_trace (false);
1360
0
    if (lookupFlag & LookupFlag::UseMarkFilteringSet)
1361
0
    {
1362
0
      if (unlikely (!c->extend (this))) return_trace (false);
1363
0
      HBUINT16 &markFilteringSet = StructAfter<HBUINT16> (subTable);
1364
0
      markFilteringSet = lookup_props >> 16;
1365
0
    }
1366
0
    return_trace (true);
1367
0
  }
1368
1369
  template <typename TSubTable>
1370
  bool subset (hb_subset_context_t *c) const
1371
0
  {
1372
0
    TRACE_SUBSET (this);
1373
0
    auto *out = c->serializer->start_embed (*this);
1374
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
1375
0
    out->lookupType = lookupType;
1376
0
    out->lookupFlag = lookupFlag;
1377
0
1378
0
    const hb_set_t *glyphset = c->plan->glyphset_gsub ();
1379
0
    unsigned int lookup_type = get_type ();
1380
0
    + hb_iter (get_subtables <TSubTable> ())
1381
0
    | hb_filter ([this, glyphset, lookup_type] (const Offset16To<TSubTable> &_) { return (this+_).intersects (glyphset, lookup_type); })
1382
0
    | hb_apply (subset_offset_array (c, out->get_subtables<TSubTable> (), this, lookup_type))
1383
0
    ;
1384
0
1385
0
    if (lookupFlag & LookupFlag::UseMarkFilteringSet)
1386
0
    {
1387
0
      const HBUINT16 &markFilteringSet = StructAfter<HBUINT16> (subTable);
1388
0
      hb_codepoint_t *idx;
1389
0
      if (!c->plan->used_mark_sets_map.has (markFilteringSet, &idx))
1390
0
      {
1391
0
        unsigned new_flag = lookupFlag;
1392
0
        new_flag &= ~LookupFlag::UseMarkFilteringSet;
1393
0
        // https://github.com/harfbuzz/harfbuzz/issues/5499
1394
0
        // If we remove UseMarkFilteringSet flag because the set is now empty,
1395
0
        // we need to add IgnoreMarks flag, otherwise the lookup will not
1396
0
        // ignore any marks, which changes the behavior.
1397
0
        new_flag |= LookupFlag::IgnoreMarks;
1398
0
        out->lookupFlag = new_flag;
1399
0
      }
1400
0
      else
1401
0
      {
1402
0
        if (unlikely (!c->serializer->extend (out))) return_trace (false);
1403
0
        HBUINT16 &outMarkFilteringSet = StructAfter<HBUINT16> (out->subTable);
1404
0
        outMarkFilteringSet = *idx;
1405
0
      }
1406
0
    }
1407
0
1408
0
    // Always keep the lookup even if it's empty. The rest of layout subsetting depends on lookup
1409
0
    // indices being consistent with those computed during planning. So if an empty lookup is
1410
0
    // discarded during the subset phase it will invalidate all subsequent lookup indices.
1411
0
    // Generally we shouldn't end up with an empty lookup as we pre-prune them during the planning
1412
0
    // phase, but it can happen in rare cases such as when during closure subtable is considered
1413
0
    // degenerate (see: https://github.com/harfbuzz/harfbuzz/issues/3853)
1414
0
    return_trace (true);
1415
0
  }
Unexecuted instantiation: bool OT::Lookup::subset<OT::Layout::GPOS_impl::PosLookupSubTable>(hb_subset_context_t*) const
Unexecuted instantiation: bool OT::Lookup::subset<OT::Layout::GSUB_impl::SubstLookupSubTable>(hb_subset_context_t*) const
1416
1417
  template <typename TSubTable>
1418
  bool sanitize (hb_sanitize_context_t *c) const
1419
5.77k
  {
1420
5.77k
    TRACE_SANITIZE (this);
1421
5.77k
    if (!(c->check_struct (this) && subTable.sanitize (c))) return_trace (false);
1422
5.77k
    hb_barrier ();
1423
1424
5.77k
    unsigned subtables = get_subtable_count ();
1425
5.77k
    if (unlikely (!c->visit_subtables (subtables))) return_trace (false);
1426
1427
5.77k
    if (lookupFlag & LookupFlag::UseMarkFilteringSet)
1428
0
    {
1429
0
      const HBUINT16 &markFilteringSet = StructAfter<HBUINT16> (subTable);
1430
0
      if (!markFilteringSet.sanitize (c)) return_trace (false);
1431
0
    }
1432
1433
5.77k
    if (unlikely (!get_subtables<TSubTable> ().sanitize (c, this, get_type ())))
1434
0
      return_trace (false);
1435
1436
5.77k
    if (unlikely (get_type () == TSubTable::Extension && !c->get_edit_count ()))
1437
0
    {
1438
0
      hb_barrier ();
1439
1440
      /* The spec says all subtables of an Extension lookup should
1441
       * have the same type, which shall not be the Extension type
1442
       * itself (but we already checked for that).
1443
       * This is specially important if one has a reverse type!
1444
       *
1445
       * We only do this if sanitizer edit_count is zero.  Otherwise,
1446
       * some of the subtables might have become insane after they
1447
       * were sanity-checked by the edits of subsequent subtables.
1448
       * https://bugs.chromium.org/p/chromium/issues/detail?id=960331
1449
       */
1450
0
      unsigned int type = get_subtable<TSubTable> (0).u.extension.get_type ();
1451
0
      for (unsigned int i = 1; i < subtables; i++)
1452
0
  if (get_subtable<TSubTable> (i).u.extension.get_type () != type)
1453
0
    return_trace (false);
1454
0
    }
1455
5.77k
    return_trace (true);
1456
5.77k
  }
bool OT::Lookup::sanitize<OT::Layout::GPOS_impl::PosLookupSubTable>(hb_sanitize_context_t*) const
Line
Count
Source
1419
98
  {
1420
98
    TRACE_SANITIZE (this);
1421
98
    if (!(c->check_struct (this) && subTable.sanitize (c))) return_trace (false);
1422
98
    hb_barrier ();
1423
1424
98
    unsigned subtables = get_subtable_count ();
1425
98
    if (unlikely (!c->visit_subtables (subtables))) return_trace (false);
1426
1427
98
    if (lookupFlag & LookupFlag::UseMarkFilteringSet)
1428
0
    {
1429
0
      const HBUINT16 &markFilteringSet = StructAfter<HBUINT16> (subTable);
1430
0
      if (!markFilteringSet.sanitize (c)) return_trace (false);
1431
0
    }
1432
1433
98
    if (unlikely (!get_subtables<TSubTable> ().sanitize (c, this, get_type ())))
1434
0
      return_trace (false);
1435
1436
98
    if (unlikely (get_type () == TSubTable::Extension && !c->get_edit_count ()))
1437
0
    {
1438
0
      hb_barrier ();
1439
1440
      /* The spec says all subtables of an Extension lookup should
1441
       * have the same type, which shall not be the Extension type
1442
       * itself (but we already checked for that).
1443
       * This is specially important if one has a reverse type!
1444
       *
1445
       * We only do this if sanitizer edit_count is zero.  Otherwise,
1446
       * some of the subtables might have become insane after they
1447
       * were sanity-checked by the edits of subsequent subtables.
1448
       * https://bugs.chromium.org/p/chromium/issues/detail?id=960331
1449
       */
1450
0
      unsigned int type = get_subtable<TSubTable> (0).u.extension.get_type ();
1451
0
      for (unsigned int i = 1; i < subtables; i++)
1452
0
  if (get_subtable<TSubTable> (i).u.extension.get_type () != type)
1453
0
    return_trace (false);
1454
0
    }
1455
98
    return_trace (true);
1456
98
  }
bool OT::Lookup::sanitize<OT::Layout::GSUB_impl::SubstLookupSubTable>(hb_sanitize_context_t*) const
Line
Count
Source
1419
5.67k
  {
1420
5.67k
    TRACE_SANITIZE (this);
1421
5.67k
    if (!(c->check_struct (this) && subTable.sanitize (c))) return_trace (false);
1422
5.67k
    hb_barrier ();
1423
1424
5.67k
    unsigned subtables = get_subtable_count ();
1425
5.67k
    if (unlikely (!c->visit_subtables (subtables))) return_trace (false);
1426
1427
5.67k
    if (lookupFlag & LookupFlag::UseMarkFilteringSet)
1428
0
    {
1429
0
      const HBUINT16 &markFilteringSet = StructAfter<HBUINT16> (subTable);
1430
0
      if (!markFilteringSet.sanitize (c)) return_trace (false);
1431
0
    }
1432
1433
5.67k
    if (unlikely (!get_subtables<TSubTable> ().sanitize (c, this, get_type ())))
1434
0
      return_trace (false);
1435
1436
5.67k
    if (unlikely (get_type () == TSubTable::Extension && !c->get_edit_count ()))
1437
0
    {
1438
0
      hb_barrier ();
1439
1440
      /* The spec says all subtables of an Extension lookup should
1441
       * have the same type, which shall not be the Extension type
1442
       * itself (but we already checked for that).
1443
       * This is specially important if one has a reverse type!
1444
       *
1445
       * We only do this if sanitizer edit_count is zero.  Otherwise,
1446
       * some of the subtables might have become insane after they
1447
       * were sanity-checked by the edits of subsequent subtables.
1448
       * https://bugs.chromium.org/p/chromium/issues/detail?id=960331
1449
       */
1450
0
      unsigned int type = get_subtable<TSubTable> (0).u.extension.get_type ();
1451
0
      for (unsigned int i = 1; i < subtables; i++)
1452
0
  if (get_subtable<TSubTable> (i).u.extension.get_type () != type)
1453
0
    return_trace (false);
1454
0
    }
1455
5.67k
    return_trace (true);
1456
5.67k
  }
1457
1458
  protected:
1459
  HBUINT16  lookupType;   /* Different enumerations for GSUB and GPOS */
1460
  HBUINT16  lookupFlag;   /* Lookup qualifiers */
1461
  Array16Of<Offset16>
1462
    subTable;   /* Array of SubTables */
1463
/*HBUINT16  markFilteringSetX[HB_VAR_ARRAY];*//* Index (base 0) into GDEF mark glyph sets
1464
           * structure. This field is only present if bit
1465
           * UseMarkFilteringSet of lookup flags is set. */
1466
  public:
1467
  DEFINE_SIZE_ARRAY (6, subTable);
1468
};
1469
1470
template <typename Types>
1471
using LookupList = List16OfOffsetTo<Lookup, typename Types::HBUINT>;
1472
1473
template <typename TLookup, typename OffsetType>
1474
struct LookupOffsetList : List16OfOffsetTo<TLookup, OffsetType>
1475
{
1476
  bool subset (hb_subset_context_t        *c,
1477
         hb_subset_layout_context_t *l) const
1478
0
  {
1479
0
    TRACE_SUBSET (this);
1480
0
    auto *out = c->serializer->start_embed (this);
1481
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
1482
0
1483
0
    + hb_enumerate (*this)
1484
0
    | hb_filter (l->lookup_index_map, hb_first)
1485
0
    | hb_map (hb_second)
1486
0
    | hb_apply (subset_offset_array (c, *out, this))
1487
0
    ;
1488
0
    return_trace (true);
1489
0
  }
Unexecuted instantiation: OT::LookupOffsetList<OT::Layout::GPOS_impl::PosLookup, OT::NumType<true, unsigned short, 2u> >::subset(hb_subset_context_t*, OT::hb_subset_layout_context_t*) const
Unexecuted instantiation: OT::LookupOffsetList<OT::Layout::GSUB_impl::SubstLookup, OT::NumType<true, unsigned short, 2u> >::subset(hb_subset_context_t*, OT::hb_subset_layout_context_t*) const
1490
1491
  bool sanitize (hb_sanitize_context_t *c) const
1492
  {
1493
    TRACE_SANITIZE (this);
1494
    return_trace (List16OfOffset16To<TLookup>::sanitize (c, this));
1495
  }
1496
};
1497
1498
1499
/*
1500
 * Coverage Table
1501
 */
1502
1503
1504
static bool ClassDef_remap_and_serialize (hb_serialize_context_t *c,
1505
            const hb_set_t &klasses,
1506
                                          bool use_class_zero,
1507
                                          hb_sorted_vector_t<hb_codepoint_pair_t> &glyph_and_klass, /* IN/OUT */
1508
            hb_map_t *klass_map /*IN/OUT*/)
1509
0
{
1510
0
  if (!klass_map)
1511
0
    return ClassDef_serialize (c, glyph_and_klass.iter ());
1512
0
1513
0
  /* any glyph not assigned a class value falls into Class zero (0),
1514
0
   * if any glyph assigned to class 0, remapping must start with 0->0*/
1515
0
  if (!use_class_zero)
1516
0
    klass_map->set (0, 0);
1517
0
1518
0
  unsigned idx = klass_map->has (0) ? 1 : 0;
1519
0
  for (const unsigned k: klasses)
1520
0
  {
1521
0
    if (klass_map->has (k)) continue;
1522
0
    klass_map->set (k, idx);
1523
0
    idx++;
1524
0
  }
1525
0
1526
0
1527
0
  for (unsigned i = 0; i < glyph_and_klass.length; i++)
1528
0
  {
1529
0
    hb_codepoint_t klass = glyph_and_klass[i].second;
1530
0
    glyph_and_klass[i].second = klass_map->get (klass);
1531
0
  }
1532
0
1533
0
  c->propagate_error (glyph_and_klass, klasses);
1534
0
  return ClassDef_serialize (c, glyph_and_klass.iter ());
1535
0
}
Unexecuted instantiation: hb-face.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-font.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-ot-face.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-ot-font.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: VARC.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-ot-metrics.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-ot-shape.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-ot-var.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-static.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-ft.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-aat-layout.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-aat-map.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-ot-cff1-table.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-ot-cff2-table.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-ot-layout.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::ClassDef_remap_and_serialize(hb_serialize_context_t*, hb_set_t const&, bool, hb_vector_t<hb_pair_t<unsigned int, unsigned int>, true>&, hb_map_t*)
1536
1537
/*
1538
 * Class Definition Table
1539
 */
1540
1541
template <typename Types>
1542
struct ClassDefFormat1_3
1543
{
1544
  friend struct ClassDef;
1545
1546
  private:
1547
  unsigned int get_class (hb_codepoint_t glyph_id) const
1548
0
  {
1549
0
    return classValue[(unsigned int) (glyph_id - startGlyph)];
1550
0
  }
1551
1552
  unsigned get_population () const
1553
0
  {
1554
0
    return classValue.len;
1555
0
  }
1556
1557
  template<typename Iterator,
1558
     hb_requires (hb_is_sorted_source_of (Iterator, hb_codepoint_t))>
1559
  bool serialize (hb_serialize_context_t *c,
1560
      Iterator it)
1561
0
  {
1562
0
    TRACE_SERIALIZE (this);
1563
0
    if (unlikely (!c->extend_min (this))) return_trace (false);
1564
0
1565
0
    if (unlikely (!it))
1566
0
    {
1567
0
      classFormat = 1;
1568
0
      startGlyph = 0;
1569
0
      classValue.len = 0;
1570
0
      return_trace (true);
1571
0
    }
1572
0
1573
0
    hb_codepoint_t glyph_min = (*it).first;
1574
0
    hb_codepoint_t glyph_max = + it
1575
0
             | hb_map (hb_first)
1576
0
             | hb_reduce (hb_max, 0u);
1577
0
    unsigned glyph_count = glyph_max - glyph_min + 1;
1578
0
1579
0
    startGlyph = glyph_min;
1580
0
    if (unlikely (!classValue.serialize (c, glyph_count))) return_trace (false);
1581
0
    for (const hb_pair_t<hb_codepoint_t, uint32_t> gid_klass_pair : + it)
1582
0
    {
1583
0
      unsigned idx = gid_klass_pair.first - glyph_min;
1584
0
      classValue[idx] = gid_klass_pair.second;
1585
0
    }
1586
0
    return_trace (true);
1587
0
  }
Unexecuted instantiation: hb-face.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_32RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-font.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_32RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-face.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-font.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_30RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: VARC.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-metrics.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_32RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-shape.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-var.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_32RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-static.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ft.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_32RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-aat-layout.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-aat-map.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-cff1-table.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_32RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-cff2-table.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_32RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-layout.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-shaper-arabic.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-shape-fallback.cc:_ZN2OT17ClassDefFormat1_3INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
1588
1589
  bool subset (hb_subset_context_t *c,
1590
         hb_map_t *klass_map = nullptr /*OUT*/,
1591
               bool keep_empty_table = true,
1592
               bool use_class_zero = true,
1593
               const Coverage* glyph_filter = nullptr) const
1594
0
  {
1595
0
    TRACE_SUBSET (this);
1596
0
    const hb_map_t &glyph_map = c->plan->glyph_map_gsub;
1597
0
1598
0
    hb_sorted_vector_t<hb_codepoint_pair_t> glyph_and_klass;
1599
0
    hb_set_t orig_klasses;
1600
0
1601
0
    hb_codepoint_t start = startGlyph;
1602
0
    hb_codepoint_t end   = start + classValue.len;
1603
0
1604
0
    for (const hb_codepoint_t gid : + hb_range (start, end))
1605
0
    {
1606
0
      hb_codepoint_t new_gid = glyph_map[gid];
1607
0
      if (new_gid == HB_MAP_VALUE_INVALID) continue;
1608
0
      if (glyph_filter && !glyph_filter->has(gid)) continue;
1609
0
1610
0
      unsigned klass = classValue[gid - start];
1611
0
      if (!klass) continue;
1612
0
1613
0
      glyph_and_klass.push (hb_pair (new_gid, klass));
1614
0
      orig_klasses.add (klass);
1615
0
    }
1616
0
1617
0
    if (use_class_zero)
1618
0
    {
1619
0
      unsigned glyph_count = glyph_filter
1620
0
           ? hb_len (hb_iter (glyph_map.keys()) | hb_filter (glyph_filter))
1621
0
           : glyph_map.get_population ();
1622
0
      use_class_zero = glyph_count <= glyph_and_klass.length;
1623
0
    }
1624
0
    if (!ClassDef_remap_and_serialize (c->serializer,
1625
0
                                       orig_klasses,
1626
0
                                       use_class_zero,
1627
0
                                       glyph_and_klass,
1628
0
                                       klass_map))
1629
0
      return_trace (false);
1630
0
    return_trace (keep_empty_table || (bool) glyph_and_klass);
1631
0
  }
1632
1633
  bool sanitize (hb_sanitize_context_t *c) const
1634
59
  {
1635
59
    TRACE_SANITIZE (this);
1636
59
    return_trace (c->check_struct (this) && classValue.sanitize (c));
1637
59
  }
1638
1639
33
  unsigned cost () const { return 1; }
1640
1641
  template <typename set_t>
1642
  bool collect_coverage (set_t *glyphs) const
1643
0
  {
1644
0
    unsigned int start = 0;
1645
0
    unsigned int count = classValue.len;
1646
0
    for (unsigned int i = 0; i < count; i++)
1647
0
    {
1648
0
      if (classValue[i])
1649
0
  continue;
1650
1651
0
      if (start != i)
1652
0
  if (unlikely (!glyphs->add_range (startGlyph + start, startGlyph + i)))
1653
0
    return false;
1654
1655
0
      start = i + 1;
1656
0
    }
1657
0
    if (start != count)
1658
0
      if (unlikely (!glyphs->add_range (startGlyph + start, startGlyph + count)))
1659
0
  return false;
1660
1661
0
    return true;
1662
0
  }
1663
1664
  template <typename set_t>
1665
  bool collect_class (set_t *glyphs, unsigned klass) const
1666
0
  {
1667
0
    unsigned int count = classValue.len;
1668
0
    for (unsigned int i = 0; i < count; i++)
1669
0
      if (classValue[i] == klass) glyphs->add (startGlyph + i);
1670
0
    return true;
1671
0
  }
1672
1673
  bool intersects (const hb_set_t *glyphs) const
1674
0
  {
1675
0
    hb_codepoint_t start = startGlyph;
1676
0
    hb_codepoint_t end = startGlyph + classValue.len;
1677
0
    for (hb_codepoint_t iter = startGlyph - 1;
1678
0
   glyphs->next (&iter) && iter < end;)
1679
0
      if (classValue[iter - start]) return true;
1680
0
    return false;
1681
0
  }
1682
  bool intersects_class (const hb_set_t *glyphs, uint16_t klass) const
1683
0
  {
1684
0
    unsigned int count = classValue.len;
1685
0
    if (klass == 0)
1686
0
    {
1687
      /* Match if there's any glyph that is not listed! */
1688
0
      hb_codepoint_t g = HB_SET_VALUE_INVALID;
1689
0
      if (!glyphs->next (&g)) return false;
1690
0
      if (g < startGlyph) return true;
1691
0
      g = startGlyph + count - 1;
1692
0
      if (glyphs->next (&g)) return true;
1693
      /* Fall through. */
1694
0
    }
1695
    /* TODO Speed up, using set overlap first? */
1696
    /* TODO(iter) Rewrite as dagger. */
1697
0
    const HBUINT16 *arr = classValue.arrayZ;
1698
0
    for (unsigned int i = 0; i < count; i++)
1699
0
      if (arr[i] == klass && glyphs->has (startGlyph + i))
1700
0
  return true;
1701
0
    return false;
1702
0
  }
1703
1704
  void intersected_class_glyphs (const hb_set_t *glyphs, unsigned klass, hb_set_t *intersect_glyphs) const
1705
0
  {
1706
0
    unsigned count = classValue.len;
1707
0
    if (klass == 0)
1708
0
    {
1709
0
      unsigned start_glyph = startGlyph;
1710
0
      for (uint32_t g = HB_SET_VALUE_INVALID;
1711
0
     glyphs->next (&g) && g < start_glyph;)
1712
0
  intersect_glyphs->add (g);
1713
1714
0
      for (uint32_t g = startGlyph + count - 1;
1715
0
     glyphs-> next (&g);)
1716
0
  intersect_glyphs->add (g);
1717
1718
0
      return;
1719
0
    }
1720
1721
0
    for (unsigned i = 0; i < count; i++)
1722
0
      if (classValue[i] == klass && glyphs->has (startGlyph + i))
1723
0
  intersect_glyphs->add (startGlyph + i);
1724
1725
#if 0
1726
    /* The following implementation is faster asymptotically, but slower
1727
     * in practice. */
1728
    unsigned start_glyph = startGlyph;
1729
    unsigned end_glyph = start_glyph + count;
1730
    for (unsigned g = startGlyph - 1;
1731
   glyphs->next (&g) && g < end_glyph;)
1732
      if (classValue.arrayZ[g - start_glyph] == klass)
1733
        intersect_glyphs->add (g);
1734
#endif
1735
0
  }
1736
1737
  void intersected_classes (const hb_set_t *glyphs, hb_set_t *intersect_classes) const
1738
0
  {
1739
0
    if (glyphs->is_empty ()) return;
1740
0
    hb_codepoint_t end_glyph = startGlyph + classValue.len - 1;
1741
0
    if (glyphs->get_min () < startGlyph ||
1742
0
        glyphs->get_max () > end_glyph)
1743
0
      intersect_classes->add (0);
1744
0
1745
0
    for (const auto& _ : + hb_enumerate (classValue))
1746
0
    {
1747
0
      hb_codepoint_t g = startGlyph + _.first;
1748
0
      if (glyphs->has (g))
1749
0
        intersect_classes->add (_.second);
1750
0
    }
1751
0
  }
1752
1753
  protected:
1754
  HBUINT16  classFormat;  /* Format identifier--format = 1 */
1755
  typename Types::HBGlyphID
1756
     startGlyph;  /* First GlyphID of the classValueArray */
1757
  typename Types::template ArrayOf<HBUINT16>
1758
    classValue; /* Array of Class Values--one per GlyphID */
1759
  public:
1760
  DEFINE_SIZE_ARRAY (2 + 2 * Types::size, classValue);
1761
};
1762
1763
template <typename Types>
1764
struct ClassDefFormat2_4
1765
{
1766
  friend struct ClassDef;
1767
1768
  private:
1769
  unsigned int get_class (hb_codepoint_t glyph_id) const
1770
16
  {
1771
16
    return rangeRecord.bsearch (glyph_id).value;
1772
16
  }
1773
1774
  unsigned get_population () const
1775
0
  {
1776
0
    typename Types::large_int ret = 0;
1777
0
    for (const auto &r : rangeRecord)
1778
0
      ret += r.get_population ();
1779
0
    return ret > UINT_MAX ? UINT_MAX : (unsigned) ret;
1780
0
  }
1781
1782
  template<typename Iterator,
1783
     hb_requires (hb_is_sorted_source_of (Iterator, hb_codepoint_t))>
1784
  bool serialize (hb_serialize_context_t *c,
1785
      Iterator it)
1786
0
  {
1787
0
    TRACE_SERIALIZE (this);
1788
0
    if (unlikely (!c->extend_min (this))) return_trace (false);
1789
0
1790
0
    if (unlikely (!it))
1791
0
    {
1792
0
      classFormat = 2;
1793
0
      rangeRecord.len = 0;
1794
0
      return_trace (true);
1795
0
    }
1796
0
1797
0
    unsigned unsorted = false;
1798
0
    unsigned num_ranges = 1;
1799
0
    hb_codepoint_t prev_gid = (*it).first;
1800
0
    unsigned prev_klass = (*it).second;
1801
0
1802
0
    RangeRecord<Types> range_rec;
1803
0
    range_rec.first = prev_gid;
1804
0
    range_rec.last = prev_gid;
1805
0
    range_rec.value = prev_klass;
1806
0
1807
0
    auto *record = c->copy (range_rec);
1808
0
    if (unlikely (!record)) return_trace (false);
1809
0
1810
0
    for (const auto gid_klass_pair : + (++it))
1811
0
    {
1812
0
      hb_codepoint_t cur_gid = gid_klass_pair.first;
1813
0
      unsigned cur_klass = gid_klass_pair.second;
1814
0
1815
0
      if (cur_gid != prev_gid + 1 ||
1816
0
    cur_klass != prev_klass)
1817
0
      {
1818
0
1819
0
  if (unlikely (cur_gid < prev_gid))
1820
0
    unsorted = true;
1821
0
1822
0
  if (unlikely (!record)) break;
1823
0
  record->last = prev_gid;
1824
0
  num_ranges++;
1825
0
1826
0
  range_rec.first = cur_gid;
1827
0
  range_rec.last = cur_gid;
1828
0
  range_rec.value = cur_klass;
1829
0
1830
0
  record = c->copy (range_rec);
1831
0
      }
1832
0
1833
0
      prev_klass = cur_klass;
1834
0
      prev_gid = cur_gid;
1835
0
    }
1836
0
1837
0
    if (unlikely (c->in_error ())) return_trace (false);
1838
0
1839
0
    if (likely (record)) record->last = prev_gid;
1840
0
    rangeRecord.len = num_ranges;
1841
0
1842
0
    if (unlikely (unsorted))
1843
0
      rangeRecord.as_array ().qsort (RangeRecord<Types>::cmp_range);
1844
0
1845
0
    return_trace (true);
1846
0
  }
Unexecuted instantiation: hb-face.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_32RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-font.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_32RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-face.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-font.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_30RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: VARC.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-metrics.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_32RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-shape.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-var.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_32RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-static.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ft.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_32RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-aat-layout.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-aat-map.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-cff1-table.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_32RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-cff2-table.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK4$_32RK4$_18LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-layout.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-shaper-arabic.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
Unexecuted instantiation: hb-ot-shape-fallback.cc:_ZN2OT17ClassDefFormat2_4INS_6Layout10SmallTypesEE9serializeI16hb_filter_iter_tI17hb_sorted_array_tIK9hb_pair_tIjjEERK3$_7RK4$_19LPv0EETnPN12hb_enable_ifIXaasr15hb_is_source_ofIT_jEE5valuesrSK_18is_sorted_iteratorEvE4typeELSH_0EEEbP22hb_serialize_context_tSK_
1847
1848
  bool subset (hb_subset_context_t *c,
1849
         hb_map_t *klass_map = nullptr /*OUT*/,
1850
               bool keep_empty_table = true,
1851
               bool use_class_zero = true,
1852
               const Coverage* glyph_filter = nullptr) const
1853
0
  {
1854
0
    TRACE_SUBSET (this);
1855
0
    const hb_map_t &glyph_map = c->plan->glyph_map_gsub;
1856
0
    const hb_set_t &glyph_set = *c->plan->glyphset_gsub ();
1857
0
1858
0
    hb_sorted_vector_t<hb_codepoint_pair_t> glyph_and_klass;
1859
0
    hb_set_t orig_klasses;
1860
0
1861
0
    if (glyph_set.get_population () * hb_bit_storage ((unsigned) rangeRecord.len)
1862
0
  < get_population ())
1863
0
    {
1864
0
      for (hb_codepoint_t g : glyph_set)
1865
0
      {
1866
0
  unsigned klass = get_class (g);
1867
0
  if (!klass) continue;
1868
0
  hb_codepoint_t new_gid = glyph_map[g];
1869
0
  if (new_gid == HB_MAP_VALUE_INVALID) continue;
1870
0
  if (glyph_filter && !glyph_filter->has (g)) continue;
1871
0
  glyph_and_klass.push (hb_pair (new_gid, klass));
1872
0
  orig_klasses.add (klass);
1873
0
      }
1874
0
    }
1875
0
    else
1876
0
    {
1877
0
      unsigned num_source_glyphs = c->plan->source->get_num_glyphs ();
1878
0
      for (auto &range : rangeRecord)
1879
0
      {
1880
0
  unsigned klass = range.value;
1881
0
  if (!klass) continue;
1882
0
  hb_codepoint_t start = range.first;
1883
0
  hb_codepoint_t end   = hb_min (range.last + 1, num_source_glyphs);
1884
0
  for (hb_codepoint_t g = start; g < end; g++)
1885
0
  {
1886
0
    hb_codepoint_t new_gid = glyph_map[g];
1887
0
    if (new_gid == HB_MAP_VALUE_INVALID) continue;
1888
0
    if (glyph_filter && !glyph_filter->has (g)) continue;
1889
0
1890
0
    glyph_and_klass.push (hb_pair (new_gid, klass));
1891
0
    orig_klasses.add (klass);
1892
0
  }
1893
0
      }
1894
0
    }
1895
0
1896
0
    const hb_set_t& glyphset = *c->plan->glyphset_gsub ();
1897
0
    unsigned glyph_count = glyph_filter
1898
0
                           ? hb_len (hb_iter (glyphset) | hb_filter (glyph_filter))
1899
0
                           : glyph_map.get_population ();
1900
0
    use_class_zero = use_class_zero && glyph_count <= glyph_and_klass.length;
1901
0
    if (!ClassDef_remap_and_serialize (c->serializer,
1902
0
                                       orig_klasses,
1903
0
                                       use_class_zero,
1904
0
                                       glyph_and_klass,
1905
0
                                       klass_map))
1906
0
      return_trace (false);
1907
0
    return_trace (keep_empty_table || (bool) glyph_and_klass);
1908
0
  }
1909
1910
  bool sanitize (hb_sanitize_context_t *c) const
1911
154
  {
1912
154
    TRACE_SANITIZE (this);
1913
154
    return_trace (rangeRecord.sanitize (c));
1914
154
  }
1915
1916
49
  unsigned cost () const { return hb_bit_storage ((unsigned) rangeRecord.len); /* bsearch cost */ }
1917
1918
  template <typename set_t>
1919
  bool collect_coverage (set_t *glyphs) const
1920
0
  {
1921
0
    for (auto &range : rangeRecord)
1922
0
      if (range.value)
1923
0
  if (unlikely (!range.collect_coverage (glyphs)))
1924
0
    return false;
1925
0
    return true;
1926
0
  }
1927
1928
  template <typename set_t>
1929
  bool collect_class (set_t *glyphs, unsigned int klass) const
1930
0
  {
1931
0
    for (auto &range : rangeRecord)
1932
0
    {
1933
0
      if (range.value == klass)
1934
0
  if (unlikely (!range.collect_coverage (glyphs)))
1935
0
    return false;
1936
0
    }
1937
0
    return true;
1938
0
  }
1939
1940
  bool intersects (const hb_set_t *glyphs) const
1941
0
  {
1942
0
    if (rangeRecord.len > glyphs->get_population () * hb_bit_storage ((unsigned) rangeRecord.len))
1943
0
    {
1944
0
      for (auto g : *glyphs)
1945
0
        if (get_class (g))
1946
0
    return true;
1947
0
      return false;
1948
0
    }
1949
0
1950
0
    return hb_any (+ hb_iter (rangeRecord)
1951
0
                   | hb_map ([glyphs] (const RangeRecord<Types> &range) { return range.intersects (*glyphs) && range.value; }));
1952
0
  }
1953
  bool intersects_class (const hb_set_t *glyphs, uint16_t klass) const
1954
0
  {
1955
0
    if (klass == 0)
1956
0
    {
1957
      /* Match if there's any glyph that is not listed! */
1958
0
      hb_codepoint_t g = HB_SET_VALUE_INVALID;
1959
0
      hb_codepoint_t last = HB_SET_VALUE_INVALID;
1960
0
      auto it = hb_iter (rangeRecord);
1961
0
      for (auto &range : it)
1962
0
      {
1963
0
        if (it->first == last + 1)
1964
0
  {
1965
0
    it++;
1966
0
    continue;
1967
0
  }
1968
1969
0
  if (!glyphs->next (&g))
1970
0
    break;
1971
0
  if (g < range.first)
1972
0
    return true;
1973
0
  g = range.last;
1974
0
  last = g;
1975
0
      }
1976
0
      if (g != HB_SET_VALUE_INVALID && glyphs->next (&g))
1977
0
  return true;
1978
      /* Fall through. */
1979
0
    }
1980
0
    for (const auto &range : rangeRecord)
1981
0
      if (range.value == klass && range.intersects (*glyphs))
1982
0
  return true;
1983
0
    return false;
1984
0
  }
1985
1986
  void intersected_class_glyphs (const hb_set_t *glyphs, unsigned klass, hb_set_t *intersect_glyphs) const
1987
0
  {
1988
0
    if (klass == 0)
1989
0
    {
1990
0
      hb_codepoint_t g = HB_SET_VALUE_INVALID;
1991
0
      for (auto &range : rangeRecord)
1992
0
      {
1993
0
  if (!glyphs->next (&g))
1994
0
    goto done;
1995
0
  while (g < range.first)
1996
0
  {
1997
0
    intersect_glyphs->add (g);
1998
0
    if (!glyphs->next (&g))
1999
0
      goto done;
2000
0
        }
2001
0
        g = range.last;
2002
0
      }
2003
0
      while (glyphs->next (&g))
2004
0
  intersect_glyphs->add (g);
2005
0
      done:
2006
2007
0
      return;
2008
0
    }
2009
2010
0
    unsigned count = rangeRecord.len;
2011
0
    if (count > glyphs->get_population () * hb_bit_storage (count))
2012
0
    {
2013
0
      for (auto g : *glyphs)
2014
0
      {
2015
0
        unsigned i;
2016
0
        if (rangeRecord.as_array ().bfind (g, &i) &&
2017
0
      rangeRecord.arrayZ[i].value == klass)
2018
0
    intersect_glyphs->add (g);
2019
0
      }
2020
0
      return;
2021
0
    }
2022
2023
0
    for (auto &range : rangeRecord)
2024
0
    {
2025
0
      if (range.value != klass) continue;
2026
2027
0
      unsigned end = range.last + 1;
2028
0
      for (hb_codepoint_t g = range.first - 1;
2029
0
     glyphs->next (&g) && g < end;)
2030
0
  intersect_glyphs->add (g);
2031
0
    }
2032
0
  }
2033
2034
  void intersected_classes (const hb_set_t *glyphs, hb_set_t *intersect_classes) const
2035
0
  {
2036
0
    if (glyphs->is_empty ()) return;
2037
0
2038
0
    hb_codepoint_t g = HB_SET_VALUE_INVALID;
2039
0
    for (auto &range : rangeRecord)
2040
0
    {
2041
0
      if (!glyphs->next (&g))
2042
0
        break;
2043
0
      if (g < range.first)
2044
0
      {
2045
0
        intersect_classes->add (0);
2046
0
        break;
2047
0
      }
2048
0
      g = range.last;
2049
0
    }
2050
0
    if (g != HB_SET_VALUE_INVALID && glyphs->next (&g))
2051
0
      intersect_classes->add (0);
2052
0
2053
0
    for (const auto& range : rangeRecord)
2054
0
      if (range.intersects (*glyphs))
2055
0
        intersect_classes->add (range.value);
2056
0
  }
2057
2058
  protected:
2059
  HBUINT16  classFormat;  /* Format identifier--format = 2 */
2060
  typename Types::template SortedArrayOf<RangeRecord<Types>>
2061
    rangeRecord;  /* Array of glyph ranges--ordered by
2062
         * Start GlyphID */
2063
  public:
2064
  DEFINE_SIZE_ARRAY (2 + Types::size, rangeRecord);
2065
};
2066
2067
struct ClassDef
2068
{
2069
  /* Has interface. */
2070
0
  unsigned operator [] (hb_codepoint_t k) const { return get (k); }
2071
0
  bool has (hb_codepoint_t k) const { return (*this)[k]; }
2072
  /* Projection. */
2073
0
  hb_codepoint_t operator () (hb_codepoint_t k) const { return get (k); }
2074
2075
0
  unsigned int get (hb_codepoint_t k) const { return get_class (k); }
2076
  unsigned int get_class (hb_codepoint_t glyph_id) const
2077
11.6k
  {
2078
11.6k
    switch (u.format) {
2079
0
    case 1: hb_barrier (); return u.format1.get_class (glyph_id);
2080
16
    case 2: hb_barrier (); return u.format2.get_class (glyph_id);
2081
#ifndef HB_NO_BEYOND_64K
2082
    case 3: hb_barrier (); return u.format3.get_class (glyph_id);
2083
    case 4: hb_barrier (); return u.format4.get_class (glyph_id);
2084
#endif
2085
11.5k
    default:return 0;
2086
11.6k
    }
2087
11.6k
  }
2088
  unsigned int get_class (hb_codepoint_t glyph_id,
2089
        hb_ot_layout_mapping_cache_t *cache) const
2090
0
  {
2091
0
    unsigned klass;
2092
0
    if (cache && cache->get (glyph_id, &klass)) return klass;
2093
0
    klass = get_class (glyph_id);
2094
0
    if (cache) cache->set (glyph_id, klass);
2095
0
    return klass;
2096
0
  }
2097
2098
  unsigned get_population () const
2099
0
  {
2100
0
    switch (u.format) {
2101
0
    case 1: hb_barrier (); return u.format1.get_population ();
2102
0
    case 2: hb_barrier (); return u.format2.get_population ();
2103
0
#ifndef HB_NO_BEYOND_64K
2104
0
    case 3: hb_barrier (); return u.format3.get_population ();
2105
0
    case 4: hb_barrier (); return u.format4.get_population ();
2106
0
#endif
2107
0
    default:return NOT_COVERED;
2108
0
    }
2109
0
  }
2110
2111
  template<typename Iterator,
2112
     hb_requires (hb_is_sorted_source_of (Iterator, hb_codepoint_t))>
2113
  bool serialize (hb_serialize_context_t *c, Iterator it_with_class_zero)
2114
0
  {
2115
0
    TRACE_SERIALIZE (this);
2116
0
    if (unlikely (!c->extend_min (this))) return_trace (false);
2117
0
2118
0
    auto it = + it_with_class_zero | hb_filter (hb_second);
2119
0
2120
0
    unsigned format = 2;
2121
0
    hb_codepoint_t glyph_max = 0;
2122
0
    if (likely (it))
2123
0
    {
2124
0
      hb_codepoint_t glyph_min = (*it).first;
2125
0
      glyph_max = glyph_min;
2126
0
2127
0
      unsigned num_glyphs = 0;
2128
0
      unsigned num_ranges = 1;
2129
0
      hb_codepoint_t prev_gid = glyph_min;
2130
0
      unsigned prev_klass = (*it).second;
2131
0
2132
0
      for (const auto gid_klass_pair : it)
2133
0
      {
2134
0
  hb_codepoint_t cur_gid = gid_klass_pair.first;
2135
0
  unsigned cur_klass = gid_klass_pair.second;
2136
0
        num_glyphs++;
2137
0
  if (cur_gid == glyph_min) continue;
2138
0
        if (cur_gid > glyph_max) glyph_max = cur_gid;
2139
0
  if (cur_gid != prev_gid + 1 ||
2140
0
      cur_klass != prev_klass)
2141
0
    num_ranges++;
2142
0
2143
0
  prev_gid = cur_gid;
2144
0
  prev_klass = cur_klass;
2145
0
      }
2146
0
2147
0
      if (num_glyphs && 1 + (glyph_max - glyph_min + 1) <= num_ranges * 3)
2148
0
  format = 1;
2149
0
    }
2150
0
2151
0
#ifndef HB_NO_BEYOND_64K
2152
0
    if (glyph_max > 0xFFFFu)
2153
0
      u.format += 2;
2154
0
    if (unlikely (glyph_max > 0xFFFFFFu))
2155
0
#else
2156
0
    if (unlikely (glyph_max > 0xFFFFu))
2157
0
#endif
2158
0
    {
2159
0
      c->check_success (false, HB_SERIALIZE_ERROR_INT_OVERFLOW);
2160
0
      return_trace (false);
2161
0
    }
2162
0
2163
0
    u.format = format;
2164
0
2165
0
    switch (u.format)
2166
0
    {
2167
0
    case 1: hb_barrier (); return_trace (u.format1.serialize (c, it));
2168
0
    case 2: hb_barrier (); return_trace (u.format2.serialize (c, it));
2169
0
#ifndef HB_NO_BEYOND_64K
2170
0
    case 3: hb_barrier (); return_trace (u.format3.serialize (c, it));
2171
0
    case 4: hb_barrier (); return_trace (u.format4.serialize (c, it));
2172
0
#endif
2173
0
    default:return_trace (false);
2174
0
    }
2175
0
  }
2176
2177
  bool subset (hb_subset_context_t *c,
2178
         hb_map_t *klass_map = nullptr /*OUT*/,
2179
               bool keep_empty_table = true,
2180
               bool use_class_zero = true,
2181
               const Coverage* glyph_filter = nullptr) const
2182
0
  {
2183
0
    TRACE_SUBSET (this);
2184
0
    switch (u.format) {
2185
0
    case 1: hb_barrier (); return_trace (u.format1.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter));
2186
0
    case 2: hb_barrier (); return_trace (u.format2.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter));
2187
0
#ifndef HB_NO_BEYOND_64K
2188
0
    case 3: hb_barrier (); return_trace (u.format3.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter));
2189
0
    case 4: hb_barrier (); return_trace (u.format4.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter));
2190
0
#endif
2191
0
    default:return_trace (false);
2192
0
    }
2193
0
  }
2194
2195
  bool sanitize (hb_sanitize_context_t *c) const
2196
213
  {
2197
213
    TRACE_SANITIZE (this);
2198
213
    if (!u.format.sanitize (c)) return_trace (false);
2199
213
    hb_barrier ();
2200
213
    switch (u.format) {
2201
59
    case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
2202
154
    case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
2203
#ifndef HB_NO_BEYOND_64K
2204
    case 3: hb_barrier (); return_trace (u.format3.sanitize (c));
2205
    case 4: hb_barrier (); return_trace (u.format4.sanitize (c));
2206
#endif
2207
0
    default:return_trace (true);
2208
213
    }
2209
213
  }
2210
2211
  unsigned cost () const
2212
82
  {
2213
82
    switch (u.format) {
2214
33
    case 1: hb_barrier (); return u.format1.cost ();
2215
49
    case 2: hb_barrier (); return u.format2.cost ();
2216
#ifndef HB_NO_BEYOND_64K
2217
    case 3: hb_barrier (); return u.format3.cost ();
2218
    case 4: hb_barrier (); return u.format4.cost ();
2219
#endif
2220
0
    default:return 0u;
2221
82
    }
2222
82
  }
2223
2224
  /* Might return false if array looks unsorted.
2225
   * Used for faster rejection of corrupt data. */
2226
  template <typename set_t>
2227
  bool collect_coverage (set_t *glyphs) const
2228
0
  {
2229
0
    switch (u.format) {
2230
0
    case 1: hb_barrier (); return u.format1.collect_coverage (glyphs);
2231
0
    case 2: hb_barrier (); return u.format2.collect_coverage (glyphs);
2232
#ifndef HB_NO_BEYOND_64K
2233
    case 3: hb_barrier (); return u.format3.collect_coverage (glyphs);
2234
    case 4: hb_barrier (); return u.format4.collect_coverage (glyphs);
2235
#endif
2236
0
    default:return false;
2237
0
    }
2238
0
  }
2239
2240
  /* Might return false if array looks unsorted.
2241
   * Used for faster rejection of corrupt data. */
2242
  template <typename set_t>
2243
  bool collect_class (set_t *glyphs, unsigned int klass) const
2244
0
  {
2245
0
    switch (u.format) {
2246
0
    case 1: hb_barrier (); return u.format1.collect_class (glyphs, klass);
2247
0
    case 2: hb_barrier (); return u.format2.collect_class (glyphs, klass);
2248
#ifndef HB_NO_BEYOND_64K
2249
    case 3: hb_barrier (); return u.format3.collect_class (glyphs, klass);
2250
    case 4: hb_barrier (); return u.format4.collect_class (glyphs, klass);
2251
#endif
2252
0
    default:return false;
2253
0
    }
2254
0
  }
2255
2256
  bool intersects (const hb_set_t *glyphs) const
2257
0
  {
2258
0
    switch (u.format) {
2259
0
    case 1: hb_barrier (); return u.format1.intersects (glyphs);
2260
0
    case 2: hb_barrier (); return u.format2.intersects (glyphs);
2261
0
#ifndef HB_NO_BEYOND_64K
2262
0
    case 3: hb_barrier (); return u.format3.intersects (glyphs);
2263
0
    case 4: hb_barrier (); return u.format4.intersects (glyphs);
2264
0
#endif
2265
0
    default:return false;
2266
0
    }
2267
0
  }
2268
  bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const
2269
0
  {
2270
0
    switch (u.format) {
2271
0
    case 1: hb_barrier (); return u.format1.intersects_class (glyphs, klass);
2272
0
    case 2: hb_barrier (); return u.format2.intersects_class (glyphs, klass);
2273
#ifndef HB_NO_BEYOND_64K
2274
    case 3: hb_barrier (); return u.format3.intersects_class (glyphs, klass);
2275
    case 4: hb_barrier (); return u.format4.intersects_class (glyphs, klass);
2276
#endif
2277
0
    default:return false;
2278
0
    }
2279
0
  }
2280
2281
  void intersected_class_glyphs (const hb_set_t *glyphs, unsigned klass, hb_set_t *intersect_glyphs) const
2282
0
  {
2283
0
    switch (u.format) {
2284
0
    case 1: hb_barrier (); return u.format1.intersected_class_glyphs (glyphs, klass, intersect_glyphs);
2285
0
    case 2: hb_barrier (); return u.format2.intersected_class_glyphs (glyphs, klass, intersect_glyphs);
2286
#ifndef HB_NO_BEYOND_64K
2287
    case 3: hb_barrier (); return u.format3.intersected_class_glyphs (glyphs, klass, intersect_glyphs);
2288
    case 4: hb_barrier (); return u.format4.intersected_class_glyphs (glyphs, klass, intersect_glyphs);
2289
#endif
2290
0
    default:return;
2291
0
    }
2292
0
  }
2293
2294
  void intersected_classes (const hb_set_t *glyphs, hb_set_t *intersect_classes) const
2295
0
  {
2296
0
    switch (u.format) {
2297
0
    case 1: hb_barrier (); return u.format1.intersected_classes (glyphs, intersect_classes);
2298
0
    case 2: hb_barrier (); return u.format2.intersected_classes (glyphs, intersect_classes);
2299
0
#ifndef HB_NO_BEYOND_64K
2300
0
    case 3: hb_barrier (); return u.format3.intersected_classes (glyphs, intersect_classes);
2301
0
    case 4: hb_barrier (); return u.format4.intersected_classes (glyphs, intersect_classes);
2302
0
#endif
2303
0
    default:return;
2304
0
    }
2305
0
  }
2306
2307
2308
  protected:
2309
  union {
2310
  HBUINT16      format;   /* Format identifier */
2311
  ClassDefFormat1_3<SmallTypes> format1;
2312
  ClassDefFormat2_4<SmallTypes> format2;
2313
#ifndef HB_NO_BEYOND_64K
2314
  ClassDefFormat1_3<MediumTypes>format3;
2315
  ClassDefFormat2_4<MediumTypes>format4;
2316
#endif
2317
  } u;
2318
  public:
2319
  DEFINE_SIZE_UNION (2, format);
2320
};
2321
2322
template<typename Iterator>
2323
static inline bool ClassDef_serialize (hb_serialize_context_t *c,
2324
               Iterator it)
2325
0
{ return (c->start_embed<ClassDef> ()->serialize (c, it)); }
Unexecuted instantiation: hb-face.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-font.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-ot-face.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-ot-font.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: VARC.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-ot-metrics.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-ot-shape.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-ot-var.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-static.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-ft.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-aat-layout.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-aat-map.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-ot-cff1-table.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-ot-cff2-table.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::ClassDef_serialize<hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const> >(hb_serialize_context_t*, hb_sorted_array_t<hb_pair_t<unsigned int, unsigned int> const>)
2326
2327
2328
/*
2329
 * Item Variation Store
2330
 */
2331
2332
/* ported from fonttools (class _Encoding) */
2333
struct delta_row_encoding_t
2334
{
2335
  /* each byte represents a region, value is one of 0/1/2/4, which means bytes
2336
   * needed for this region */
2337
  struct chars_t : hb_vector_t<uint8_t>
2338
  {
2339
    int cmp (const chars_t& other) const
2340
0
    {
2341
0
      return as_array ().cmp (other.as_array ());
2342
0
    }
2343
2344
    hb_pair_t<unsigned, unsigned> get_width ()
2345
0
    {
2346
0
      unsigned width = 0;
2347
0
      unsigned columns = 0;
2348
0
      for (unsigned i = 0; i < length; i++)
2349
0
      {
2350
0
  unsigned v = arrayZ[i];
2351
0
  width += v;
2352
0
  columns += (v != 0);
2353
0
      }
2354
0
      return hb_pair (width, columns);
2355
0
    }
2356
2357
    HB_HOT
2358
    hb_pair_t<unsigned, unsigned> combine_width (const chars_t& other) const
2359
0
    {
2360
0
      unsigned combined_width = 0;
2361
0
      unsigned combined_columns = 0;
2362
0
      for (unsigned i = 0; i < length; i++)
2363
0
      {
2364
0
        unsigned v = hb_max (arrayZ[i], other.arrayZ[i]);
2365
0
  combined_width += v;
2366
0
  combined_columns += (v != 0);
2367
0
      }
2368
0
      return hb_pair (combined_width, combined_columns);
2369
0
    }
2370
  };
2371
2372
0
  hb_pair_t<unsigned, unsigned> combine_width (const delta_row_encoding_t& other_encoding) const { return chars.combine_width (other_encoding.chars); }
2373
2374
  // Actual data
2375
2376
  chars_t chars;
2377
  unsigned width = 0;
2378
  unsigned overhead = 0;
2379
  hb_vector_t<const hb_vector_t<int>*> items;
2380
2381
  delta_row_encoding_t () = default;
2382
  delta_row_encoding_t (hb_vector_t<const hb_vector_t<int>*> &&rows, unsigned num_cols)
2383
0
  {
2384
0
    assert (rows);
2385
0
2386
0
    items = std::move (rows);
2387
0
2388
0
    if (unlikely (!chars.resize (num_cols)))
2389
0
      return;
2390
0
2391
0
    calculate_chars ();
2392
0
  }
2393
2394
  void merge (const delta_row_encoding_t& other)
2395
0
  {
2396
0
    items.alloc (items.length + other.items.length);
2397
0
    for (auto &row : other.items)
2398
0
      add_row (row);
2399
0
2400
0
    // Merge chars
2401
0
    assert (chars.length == other.chars.length);
2402
0
    for (unsigned i = 0; i < chars.length; i++)
2403
0
      chars.arrayZ[i] = hb_max (chars.arrayZ[i], other.chars.arrayZ[i]);
2404
0
    chars_changed ();
2405
0
  }
2406
2407
  void chars_changed ()
2408
0
  {
2409
0
    auto _ = chars.get_width ();
2410
0
    width = _.first;
2411
0
    overhead = get_chars_overhead (_.second);
2412
0
  }
2413
2414
  void calculate_chars ()
2415
0
  {
2416
0
    assert (items);
2417
0
2418
0
    bool long_words = false;
2419
0
2420
0
    for (auto &row : items)
2421
0
    {
2422
0
      assert (row->length == chars.length);
2423
0
2424
0
      /* 0/1/2 byte encoding */
2425
0
      for (unsigned i = 0; i < row->length; i++)
2426
0
      {
2427
0
  int v =  row->arrayZ[i];
2428
0
  if (v == 0)
2429
0
    continue;
2430
0
  else if (v > 32767 || v < -32768)
2431
0
  {
2432
0
    long_words = true;
2433
0
    chars.arrayZ[i] = hb_max (chars.arrayZ[i], 4);
2434
0
  }
2435
0
  else if (v > 127 || v < -128)
2436
0
    chars.arrayZ[i] = hb_max (chars.arrayZ[i], 2);
2437
0
  else
2438
0
    chars.arrayZ[i] = hb_max (chars.arrayZ[i], 1);
2439
0
      }
2440
0
    }
2441
0
2442
0
    if (long_words)
2443
0
    {
2444
0
      // Convert 1s to 2s
2445
0
      for (auto &v : chars)
2446
0
  if (v == 1)
2447
0
    v = 2;
2448
0
    }
2449
0
2450
0
    chars_changed ();
2451
0
  }
2452
2453
  bool is_empty () const
2454
0
  { return !items; }
2455
2456
  static inline unsigned get_chars_overhead (unsigned num_columns)
2457
0
  {
2458
0
    unsigned c = 4 + 6; // 4 bytes for LOffset, 6 bytes for VarData header
2459
0
    return c + num_columns * 2;
2460
0
  }
2461
2462
  unsigned get_gain (unsigned additional_bytes_per_rows = 1) const
2463
0
  {
2464
0
    int count = items.length;
2465
0
    return hb_max (0, (int) overhead - count * (int) additional_bytes_per_rows);
2466
0
  }
2467
2468
  int gain_from_merging (const delta_row_encoding_t& other_encoding) const
2469
0
  {
2470
0
    // Back of the envelope calculations to reject early.
2471
0
    signed additional_bytes_per_rows = other_encoding.width - width;
2472
0
    if (additional_bytes_per_rows > 0)
2473
0
    {
2474
0
      if (get_gain (additional_bytes_per_rows) == 0)
2475
0
        return 0;
2476
0
    }
2477
0
    else
2478
0
    {
2479
0
      if (other_encoding.get_gain (-additional_bytes_per_rows) == 0)
2480
0
  return 0;
2481
0
    }
2482
0
2483
0
    auto pair = combine_width (other_encoding);
2484
0
    unsigned combined_width = pair.first;
2485
0
    unsigned combined_columns = pair.second;
2486
0
2487
0
    int combined_gain = (int) overhead + (int) other_encoding.overhead;
2488
0
    combined_gain -= (combined_width - (int) width) * items.length;
2489
0
    combined_gain -= (combined_width - (int) other_encoding.width) * other_encoding.items.length;
2490
0
    combined_gain -= get_chars_overhead (combined_columns);
2491
0
2492
0
    return combined_gain;
2493
0
  }
2494
2495
  bool add_row (const hb_vector_t<int>* row)
2496
0
  { return items.push (row); }
2497
2498
  static int cmp (const void *pa, const void *pb)
2499
0
  {
2500
0
    const delta_row_encoding_t *a = (const delta_row_encoding_t *)pa;
2501
0
    const delta_row_encoding_t *b = (const delta_row_encoding_t *)pb;
2502
0
2503
0
    if (a->width != b->width)
2504
0
      return (int) a->width - (int) b->width;
2505
0
2506
0
    return b->chars.cmp (a->chars);
2507
0
  }
2508
};
2509
2510
struct VarRegionAxis
2511
{
2512
  float evaluate (int coord) const
2513
0
  {
2514
0
    int peak = peakCoord.to_int ();
2515
0
    if (peak == 0 || coord == peak)
2516
0
      return 1.f;
2517
0
    else if (coord == 0) // Faster
2518
0
      return 0.f;
2519
2520
0
    int start = startCoord.to_int (), end = endCoord.to_int ();
2521
2522
    /* TODO Move these to sanitize(). */
2523
0
    if (unlikely (start > peak || peak > end))
2524
0
      return 1.f;
2525
0
    if (unlikely (start < 0 && end > 0 && peak != 0))
2526
0
      return 1.f;
2527
2528
0
    if (coord <= start || end <= coord)
2529
0
      return 0.f;
2530
2531
    /* Interpolate */
2532
0
    if (coord < peak)
2533
0
      return float (coord - start) / (peak - start);
2534
0
    else
2535
0
      return float (end - coord) / (end - peak);
2536
0
  }
2537
2538
  bool sanitize (hb_sanitize_context_t *c) const
2539
0
  {
2540
0
    TRACE_SANITIZE (this);
2541
0
    return_trace (c->check_struct (this));
2542
0
  }
2543
2544
  bool serialize (hb_serialize_context_t *c) const
2545
0
  {
2546
0
    TRACE_SERIALIZE (this);
2547
0
    return_trace (c->embed (this));
2548
0
  }
2549
2550
  public:
2551
  F2DOT14 startCoord;
2552
  F2DOT14 peakCoord;
2553
  F2DOT14 endCoord;
2554
  public:
2555
  DEFINE_SIZE_STATIC (6);
2556
};
2557
struct SparseVarRegionAxis
2558
{
2559
  float evaluate (const int *coords, unsigned int coord_len) const
2560
0
  {
2561
0
    unsigned i = axisIndex;
2562
0
    int coord = i < coord_len ? coords[i] : 0;
2563
0
    return axis.evaluate (coord);
2564
0
  }
2565
2566
  bool sanitize (hb_sanitize_context_t *c) const
2567
0
  {
2568
0
    TRACE_SANITIZE (this);
2569
0
    return_trace (c->check_struct (this));
2570
0
  }
2571
2572
  bool serialize (hb_serialize_context_t *c) const
2573
0
  {
2574
0
    TRACE_SERIALIZE (this);
2575
0
    return_trace (c->embed (this));
2576
0
  }
2577
2578
  public:
2579
  HBUINT16 axisIndex;
2580
  VarRegionAxis axis;
2581
  public:
2582
  DEFINE_SIZE_STATIC (8);
2583
};
2584
2585
struct hb_scalar_cache_t
2586
{
2587
  private:
2588
  static constexpr unsigned STATIC_LENGTH = 16;
2589
  static constexpr int INVALID = INT_MIN;
2590
  static constexpr float MULTIPLIER = 1 << ((sizeof (int) * 8) - 2);
2591
  static constexpr float DIVISOR = 1.f / MULTIPLIER;
2592
2593
  public:
2594
0
  hb_scalar_cache_t () : length (STATIC_LENGTH) { clear (); }
2595
2596
  hb_scalar_cache_t (const hb_scalar_cache_t&) = delete;
2597
  hb_scalar_cache_t (hb_scalar_cache_t&&) = delete;
2598
  hb_scalar_cache_t& operator= (const hb_scalar_cache_t&) = delete;
2599
  hb_scalar_cache_t& operator= (hb_scalar_cache_t&&) = delete;
2600
2601
  static hb_scalar_cache_t *create (unsigned int count,
2602
            hb_scalar_cache_t *scratch_cache = nullptr)
2603
170k
  {
2604
170k
    if (!count) return (hb_scalar_cache_t *) &Null(hb_scalar_cache_t);
2605
2606
0
    if (scratch_cache && count <= scratch_cache->length)
2607
0
    {
2608
0
      scratch_cache->clear ();
2609
0
      return scratch_cache;
2610
0
    }
2611
2612
0
    auto *cache = (hb_scalar_cache_t *) hb_malloc (sizeof (hb_scalar_cache_t) - sizeof (static_values) + sizeof (static_values[0]) * count);
2613
0
    if (unlikely (!cache)) return (hb_scalar_cache_t *) &Null(hb_scalar_cache_t);
2614
2615
0
    cache->length = count;
2616
0
    cache->clear ();
2617
2618
0
    return cache;
2619
0
  }
2620
2621
  static void destroy (hb_scalar_cache_t *cache,
2622
           hb_scalar_cache_t *scratch_cache = nullptr)
2623
170k
  {
2624
170k
    if (cache != &Null(hb_scalar_cache_t) && cache != scratch_cache)
2625
0
      hb_free (cache);
2626
170k
  }
2627
2628
  void clear ()
2629
0
  {
2630
0
    auto *values = &static_values[0];
2631
0
    for (unsigned i = 0; i < length; i++)
2632
0
      values[i] = INVALID;
2633
0
  }
2634
2635
  HB_ALWAYS_INLINE
2636
  bool get (unsigned i, float *value) const
2637
0
  {
2638
0
    if (unlikely (i >= length))
2639
0
    {
2640
0
      *value = 0.f;
2641
0
      return true;
2642
0
    }
2643
0
    auto *values = &static_values[0];
2644
0
    auto *cached_value = &values[i];
2645
0
    if (*cached_value != INVALID)
2646
0
    {
2647
0
      *value = *cached_value ? *cached_value * DIVISOR : 0.f;
2648
0
      return true;
2649
0
    }
2650
0
    return false;
2651
0
  }
2652
2653
  HB_ALWAYS_INLINE
2654
  void set (unsigned i, float value)
2655
0
  {
2656
0
    if (unlikely (i >= length)) return;
2657
0
    auto *values = &static_values[0];
2658
0
    auto *cached_value = &values[i];
2659
0
    *cached_value = roundf(value * MULTIPLIER);
2660
0
  }
2661
2662
  private:
2663
  unsigned length;
2664
  mutable hb_atomic_t<int> static_values[STATIC_LENGTH];
2665
};
2666
2667
struct VarRegionList
2668
{
2669
  private:
2670
  float evaluate_impl (unsigned int region_index,
2671
           const int *coords, unsigned int coord_len) const
2672
0
  {
2673
0
    const VarRegionAxis *axes = axesZ.arrayZ + (region_index * axisCount);
2674
0
    float v = 1.f;
2675
2676
0
    unsigned int count = axisCount;
2677
0
    for (unsigned int i = 0; i < count; i++)
2678
0
    {
2679
0
      int coord = i < coord_len ? coords[i] : 0;
2680
0
      float factor = axes[i].evaluate (coord);
2681
0
      if (factor == 0.f)
2682
0
      {
2683
0
  v = 0.f;
2684
0
  break;
2685
0
      }
2686
0
      v *= factor;
2687
0
    }
2688
2689
0
    return v;
2690
0
  }
2691
2692
  public:
2693
  HB_ALWAYS_INLINE
2694
  float evaluate (unsigned int region_index,
2695
      const int *coords, unsigned int coord_len,
2696
      hb_scalar_cache_t *cache = nullptr) const
2697
0
  {
2698
0
    if (unlikely (region_index >= regionCount))
2699
0
      return 0.;
2700
2701
0
    float v;
2702
0
    if (cache && cache->get (region_index, &v))
2703
0
      return v;
2704
2705
0
    v = evaluate_impl (region_index, coords, coord_len);
2706
2707
0
    if (cache)
2708
0
      cache->set (region_index, v);
2709
0
    return v;
2710
0
  }
2711
2712
  bool sanitize (hb_sanitize_context_t *c) const
2713
0
  {
2714
0
    TRACE_SANITIZE (this);
2715
0
    return_trace (c->check_struct (this) &&
2716
0
      hb_barrier () &&
2717
0
      axesZ.sanitize (c, axisCount * regionCount));
2718
0
  }
2719
2720
  bool serialize (hb_serialize_context_t *c,
2721
                  const hb_vector_t<hb_tag_t>& axis_tags,
2722
                  const hb_vector_t<const hb_hashmap_t<hb_tag_t, Triple>*>& regions)
2723
0
  {
2724
0
    TRACE_SERIALIZE (this);
2725
0
    unsigned axis_count = axis_tags.length;
2726
0
    unsigned region_count = regions.length;
2727
0
    if (!axis_count || !region_count) return_trace (false);
2728
0
    if (unlikely (hb_unsigned_mul_overflows (axis_count * region_count,
2729
0
                                             VarRegionAxis::static_size))) return_trace (false);
2730
0
    if (unlikely (!c->extend_min (this))) return_trace (false);
2731
0
    axisCount = axis_count;
2732
0
    regionCount = region_count;
2733
0
2734
0
    for (unsigned r = 0; r < region_count; r++)
2735
0
    {
2736
0
      const auto& region = regions[r];
2737
0
      for (unsigned i = 0; i < axis_count; i++)
2738
0
      {
2739
0
        hb_tag_t tag = axis_tags.arrayZ[i];
2740
0
        VarRegionAxis var_region_rec;
2741
0
        Triple *coords;
2742
0
        if (region->has (tag, &coords))
2743
0
        {
2744
0
          var_region_rec.startCoord.set_float (coords->minimum);
2745
0
          var_region_rec.peakCoord.set_float (coords->middle);
2746
0
          var_region_rec.endCoord.set_float (coords->maximum);
2747
0
        }
2748
0
        else
2749
0
        {
2750
0
          var_region_rec.startCoord.set_int (0);
2751
0
          var_region_rec.peakCoord.set_int (0);
2752
0
          var_region_rec.endCoord.set_int (0);
2753
0
        }
2754
0
        if (!var_region_rec.serialize (c))
2755
0
          return_trace (false);
2756
0
      }
2757
0
    }
2758
0
    return_trace (true);
2759
0
  }
2760
2761
  bool serialize (hb_serialize_context_t *c, const VarRegionList *src, const hb_inc_bimap_t &region_map)
2762
0
  {
2763
0
    TRACE_SERIALIZE (this);
2764
0
    if (unlikely (!c->extend_min (this))) return_trace (false);
2765
0
    axisCount = src->axisCount;
2766
0
    regionCount = region_map.get_population ();
2767
0
    if (unlikely (hb_unsigned_mul_overflows (axisCount * regionCount,
2768
0
               VarRegionAxis::static_size))) return_trace (false);
2769
0
    if (unlikely (!c->extend (this))) return_trace (false);
2770
0
    unsigned int region_count = src->regionCount;
2771
0
    for (unsigned int r = 0; r < regionCount; r++)
2772
0
    {
2773
0
      unsigned int backward = region_map.backward (r);
2774
0
      if (backward >= region_count) return_trace (false);
2775
0
      hb_memcpy (&axesZ[axisCount * r], &src->axesZ[axisCount * backward], VarRegionAxis::static_size * axisCount);
2776
0
    }
2777
0
2778
0
    return_trace (true);
2779
0
  }
2780
2781
  bool get_var_region (unsigned region_index,
2782
                       const hb_map_t& axes_old_index_tag_map,
2783
                       hb_hashmap_t<hb_tag_t, Triple>& axis_tuples /* OUT */) const
2784
0
  {
2785
0
    if (region_index >= regionCount) return false;
2786
0
    const VarRegionAxis* axis_region = axesZ.arrayZ + (region_index * axisCount);
2787
0
    for (unsigned i = 0; i < axisCount; i++)
2788
0
    {
2789
0
      hb_tag_t *axis_tag;
2790
0
      if (!axes_old_index_tag_map.has (i, &axis_tag))
2791
0
        return false;
2792
0
2793
0
      float min_val = axis_region->startCoord.to_float ();
2794
0
      float def_val = axis_region->peakCoord.to_float ();
2795
0
      float max_val = axis_region->endCoord.to_float ();
2796
0
2797
0
      if (def_val != 0.f)
2798
0
        axis_tuples.set (*axis_tag, Triple ((double) min_val, (double) def_val, (double) max_val));
2799
0
      axis_region++;
2800
0
    }
2801
0
    return !axis_tuples.in_error ();
2802
0
  }
2803
2804
  bool get_var_regions (const hb_map_t& axes_old_index_tag_map,
2805
                        hb_vector_t<hb_hashmap_t<hb_tag_t, Triple>>& regions /* OUT */) const
2806
0
  {
2807
0
    if (!regions.alloc (regionCount))
2808
0
      return false;
2809
0
2810
0
    for (unsigned i = 0; i < regionCount; i++)
2811
0
    {
2812
0
      hb_hashmap_t<hb_tag_t, Triple> axis_tuples;
2813
0
      if (!get_var_region (i, axes_old_index_tag_map, axis_tuples))
2814
0
        return false;
2815
0
      regions.push (std::move (axis_tuples));
2816
0
    }
2817
0
    return !regions.in_error ();
2818
0
  }
2819
2820
0
  unsigned int get_size () const { return min_size + VarRegionAxis::static_size * axisCount * regionCount; }
2821
2822
  public:
2823
  HBUINT16  axisCount;
2824
  HBUINT15  regionCount;
2825
  protected:
2826
  UnsizedArrayOf<VarRegionAxis>
2827
    axesZ;
2828
  public:
2829
  DEFINE_SIZE_ARRAY (4, axesZ);
2830
};
2831
2832
struct SparseVariationRegion : Array16Of<SparseVarRegionAxis>
2833
{
2834
  float evaluate (const int *coords, unsigned int coord_len) const
2835
0
  {
2836
0
    float v = 1.f;
2837
0
    unsigned int count = len;
2838
0
    for (unsigned int i = 0; i < count; i++)
2839
0
    {
2840
0
      float factor = arrayZ[i].evaluate (coords, coord_len);
2841
0
      if (factor == 0.f)
2842
0
  return 0.;
2843
0
      v *= factor;
2844
0
    }
2845
0
    return v;
2846
0
  }
2847
};
2848
2849
struct SparseVarRegionList
2850
{
2851
  HB_ALWAYS_INLINE
2852
  float evaluate (unsigned int region_index,
2853
      const int *coords, unsigned int coord_len,
2854
      hb_scalar_cache_t *cache = nullptr) const
2855
0
  {
2856
0
    if (unlikely (region_index >= regions.len))
2857
0
      return 0.;
2858
2859
0
    float v;
2860
0
    if (cache && cache->get (region_index, &v))
2861
0
      return v;
2862
2863
0
    const SparseVariationRegion &region = this+regions[region_index];
2864
2865
0
    v = region.evaluate (coords, coord_len);
2866
0
    if (cache)
2867
0
      cache->set (region_index, v);
2868
2869
0
    return v;
2870
0
  }
2871
2872
  bool sanitize (hb_sanitize_context_t *c) const
2873
0
  {
2874
0
    TRACE_SANITIZE (this);
2875
0
    return_trace (regions.sanitize (c, this));
2876
0
  }
2877
2878
  public:
2879
  Array16Of<Offset32To<SparseVariationRegion>>
2880
    regions;
2881
  public:
2882
  DEFINE_SIZE_ARRAY (2, regions);
2883
};
2884
2885
2886
struct VarData
2887
{
2888
  unsigned int get_item_count () const
2889
0
  { return itemCount; }
2890
2891
  unsigned int get_region_index_count () const
2892
0
  { return regionIndices.len; }
2893
2894
  unsigned get_region_index (unsigned i) const
2895
0
  { return i >= regionIndices.len ? -1 : regionIndices[i]; }
2896
2897
  unsigned int get_row_size () const
2898
0
  { return (wordCount () + regionIndices.len) * (longWords () ? 2 : 1); }
2899
2900
  unsigned int get_size () const
2901
0
  { return min_size
2902
0
   - regionIndices.min_size + regionIndices.get_size ()
2903
0
   + itemCount * get_row_size ();
2904
0
  }
2905
2906
  float _get_delta (unsigned int inner,
2907
        const int *coords, unsigned int coord_count,
2908
        const VarRegionList &regions,
2909
        hb_scalar_cache_t *cache = nullptr) const
2910
0
  {
2911
0
    if (unlikely (inner >= itemCount))
2912
0
      return 0.;
2913
0
    bool is_long = longWords ();
2914
0
    unsigned int count = regionIndices.len;
2915
0
    unsigned word_count = wordCount ();
2916
0
    unsigned int scount = is_long ? count : word_count;
2917
0
    unsigned int lcount = is_long ? word_count : 0;
2918
2919
0
    const HBUINT8 *bytes = get_delta_bytes ();
2920
0
    const HBUINT8 *row = bytes + inner * get_row_size ();
2921
2922
0
    float delta = 0.;
2923
0
    unsigned int i = 0;
2924
2925
0
    const HBINT32 *lcursor = reinterpret_cast<const HBINT32 *> (row);
2926
0
    for (; i < lcount; i++)
2927
0
    {
2928
0
      float scalar = regions.evaluate (regionIndices.arrayZ[i], coords, coord_count, cache);
2929
0
      if (scalar)
2930
0
        delta += scalar * *lcursor;
2931
0
      lcursor++;
2932
0
    }
2933
0
    const HBINT16 *scursor = reinterpret_cast<const HBINT16 *> (lcursor);
2934
0
    for (; i < scount; i++)
2935
0
    {
2936
0
      float scalar = regions.evaluate (regionIndices.arrayZ[i], coords, coord_count, cache);
2937
0
      if (scalar)
2938
0
       delta += scalar * *scursor;
2939
0
      scursor++;
2940
0
    }
2941
0
    const HBINT8 *bcursor = reinterpret_cast<const HBINT8 *> (scursor);
2942
0
    for (; i < count; i++)
2943
0
    {
2944
0
      float scalar = regions.evaluate (regionIndices.arrayZ[i], coords, coord_count, cache);
2945
0
      if (scalar)
2946
0
        delta += scalar * *bcursor;
2947
0
      bcursor++;
2948
0
    }
2949
2950
0
    return delta;
2951
0
  }
2952
2953
  HB_ALWAYS_INLINE
2954
  float get_delta (unsigned int inner,
2955
       const int *coords, unsigned int coord_count,
2956
       const VarRegionList &regions,
2957
       hb_scalar_cache_t *cache = nullptr) const
2958
0
  {
2959
0
    unsigned int count = regionIndices.len;
2960
0
    if (!count) return 0.f; // This is quite common, so optimize it.
2961
0
    return _get_delta (inner, coords, coord_count, regions, cache);
2962
0
  }
2963
2964
  void get_region_scalars (const int *coords, unsigned int coord_count,
2965
         const VarRegionList &regions,
2966
         float *scalars /*OUT */,
2967
         unsigned int num_scalars) const
2968
0
  {
2969
0
    unsigned count = hb_min (num_scalars, regionIndices.len);
2970
0
    for (unsigned int i = 0; i < count; i++)
2971
0
      scalars[i] = regions.evaluate (regionIndices.arrayZ[i], coords, coord_count);
2972
0
    for (unsigned int i = count; i < num_scalars; i++)
2973
0
      scalars[i] = 0.f;
2974
0
  }
2975
2976
  bool sanitize (hb_sanitize_context_t *c) const
2977
0
  {
2978
0
    TRACE_SANITIZE (this);
2979
0
    return_trace (c->check_struct (this) &&
2980
0
      regionIndices.sanitize (c) &&
2981
0
      hb_barrier () &&
2982
0
      wordCount () <= regionIndices.len &&
2983
0
      c->check_range (get_delta_bytes (),
2984
0
          itemCount,
2985
0
          get_row_size ()));
2986
0
  }
2987
2988
  bool serialize (hb_serialize_context_t *c,
2989
                  bool has_long,
2990
                  const hb_vector_t<const hb_vector_t<int>*>& rows)
2991
0
  {
2992
0
    TRACE_SERIALIZE (this);
2993
0
    unsigned row_count = rows.length;
2994
0
    if (!row_count) {
2995
0
      // Nothing to serialize, will be empty.
2996
0
      return false;
2997
0
    }
2998
0
2999
0
    if (unlikely (!c->extend_min (this))) return_trace (false);
3000
0
    itemCount = row_count;
3001
0
3002
0
    int min_threshold = has_long ? -65536 : -128;
3003
0
    int max_threshold = has_long ? +65535 : +127;
3004
0
    enum delta_size_t { kZero=0, kNonWord, kWord };
3005
0
    hb_vector_t<delta_size_t> delta_sz;
3006
0
    unsigned num_regions = rows[0]->length;
3007
0
    if (!delta_sz.resize (num_regions))
3008
0
      return_trace (false);
3009
0
3010
0
    unsigned word_count = 0;
3011
0
    for (unsigned r = 0; r < num_regions; r++)
3012
0
    {
3013
0
      for (unsigned i = 0; i < row_count; i++)
3014
0
      {
3015
0
        int delta = rows[i]->arrayZ[r];
3016
0
        if (delta < min_threshold || delta > max_threshold)
3017
0
        {
3018
0
          delta_sz[r] = kWord;
3019
0
          word_count++;
3020
0
          break;
3021
0
        }
3022
0
        else if (delta != 0)
3023
0
        {
3024
0
          delta_sz[r] = kNonWord;
3025
0
        }
3026
0
      }
3027
0
    }
3028
0
3029
0
    /* reorder regions: words and then non-words*/
3030
0
    unsigned word_index = 0;
3031
0
    unsigned non_word_index = word_count;
3032
0
    hb_map_t ri_map;
3033
0
    for (unsigned r = 0; r < num_regions; r++)
3034
0
    {
3035
0
      if (!delta_sz[r]) continue;
3036
0
      unsigned new_r = (delta_sz[r] == kWord)? word_index++ : non_word_index++;
3037
0
      if (!ri_map.set (new_r, r))
3038
0
        return_trace (false);
3039
0
    }
3040
0
3041
0
    wordSizeCount = word_count | (has_long ? 0x8000u /* LONG_WORDS */ : 0);
3042
0
3043
0
    unsigned ri_count = ri_map.get_population ();
3044
0
    regionIndices.len = ri_count;
3045
0
    if (unlikely (!c->extend (this))) return_trace (false);
3046
0
3047
0
    for (unsigned r = 0; r < ri_count; r++)
3048
0
    {
3049
0
      hb_codepoint_t *idx;
3050
0
      if (!ri_map.has (r, &idx))
3051
0
        return_trace (false);
3052
0
      regionIndices[r] = *idx;
3053
0
    }
3054
0
3055
0
    HBUINT8 *delta_bytes = get_delta_bytes ();
3056
0
    unsigned row_size = get_row_size ();
3057
0
    for (unsigned int i = 0; i < row_count; i++)
3058
0
    {
3059
0
      for (unsigned int r = 0; r < ri_count; r++)
3060
0
      {
3061
0
        int delta = rows[i]->arrayZ[ri_map[r]];
3062
0
        set_item_delta_fast (i, r, delta, delta_bytes, row_size);
3063
0
      }
3064
0
    }
3065
0
    return_trace (true);
3066
0
  }
3067
3068
  bool serialize (hb_serialize_context_t *c,
3069
      const VarData *src,
3070
      const hb_inc_bimap_t &inner_map,
3071
      const hb_inc_bimap_t &region_map)
3072
0
  {
3073
0
    TRACE_SERIALIZE (this);
3074
0
    if (unlikely (!c->extend_min (this))) return_trace (false);
3075
0
    itemCount = inner_map.get_next_value ();
3076
0
3077
0
    /* Optimize word count */
3078
0
    unsigned ri_count = src->regionIndices.len;
3079
0
    enum delta_size_t { kZero=0, kNonWord, kWord };
3080
0
    hb_vector_t<delta_size_t> delta_sz;
3081
0
    hb_vector_t<unsigned int> ri_map; /* maps new index to old index */
3082
0
    delta_sz.resize (ri_count);
3083
0
    ri_map.resize (ri_count);
3084
0
    unsigned int new_word_count = 0;
3085
0
    unsigned int r;
3086
0
3087
0
    const HBUINT8 *src_delta_bytes = src->get_delta_bytes ();
3088
0
    unsigned src_row_size = src->get_row_size ();
3089
0
    unsigned src_word_count = src->wordCount ();
3090
0
    bool     src_long_words = src->longWords ();
3091
0
3092
0
    bool has_long = false;
3093
0
    if (src_long_words)
3094
0
    {
3095
0
      for (r = 0; r < src_word_count; r++)
3096
0
      {
3097
0
        for (unsigned old_gid : inner_map.keys())
3098
0
  {
3099
0
    int32_t delta = src->get_item_delta_fast (old_gid, r, src_delta_bytes, src_row_size);
3100
0
    if (delta < -65536 || 65535 < delta)
3101
0
    {
3102
0
      has_long = true;
3103
0
      break;
3104
0
    }
3105
0
        }
3106
0
      }
3107
0
    }
3108
0
3109
0
    signed min_threshold = has_long ? -65536 : -128;
3110
0
    signed max_threshold = has_long ? +65535 : +127;
3111
0
    for (r = 0; r < ri_count; r++)
3112
0
    {
3113
0
      bool short_circuit = src_long_words == has_long && src_word_count <= r;
3114
0
3115
0
      delta_sz[r] = kZero;
3116
0
      for (unsigned old_gid : inner_map.keys())
3117
0
      {
3118
0
  int32_t delta = src->get_item_delta_fast (old_gid, r, src_delta_bytes, src_row_size);
3119
0
  if (delta < min_threshold || max_threshold < delta)
3120
0
  {
3121
0
    delta_sz[r] = kWord;
3122
0
    new_word_count++;
3123
0
    break;
3124
0
  }
3125
0
  else if (delta != 0)
3126
0
  {
3127
0
    delta_sz[r] = kNonWord;
3128
0
    if (short_circuit)
3129
0
      break;
3130
0
  }
3131
0
      }
3132
0
    }
3133
0
3134
0
    unsigned int word_index = 0;
3135
0
    unsigned int non_word_index = new_word_count;
3136
0
    unsigned int new_ri_count = 0;
3137
0
    for (r = 0; r < ri_count; r++)
3138
0
      if (delta_sz[r])
3139
0
      {
3140
0
  unsigned new_r = (delta_sz[r] == kWord)? word_index++ : non_word_index++;
3141
0
  ri_map[new_r] = r;
3142
0
  new_ri_count++;
3143
0
      }
3144
0
3145
0
    wordSizeCount = new_word_count | (has_long ? 0x8000u /* LONG_WORDS */ : 0);
3146
0
3147
0
    regionIndices.len = new_ri_count;
3148
0
3149
0
    if (unlikely (!c->extend (this))) return_trace (false);
3150
0
3151
0
    for (r = 0; r < new_ri_count; r++)
3152
0
      regionIndices[r] = region_map[src->regionIndices[ri_map[r]]];
3153
0
3154
0
    HBUINT8 *delta_bytes = get_delta_bytes ();
3155
0
    unsigned row_size = get_row_size ();
3156
0
    unsigned count = itemCount;
3157
0
    for (unsigned int i = 0; i < count; i++)
3158
0
    {
3159
0
      unsigned int old = inner_map.backward (i);
3160
0
      for (unsigned int r = 0; r < new_ri_count; r++)
3161
0
  set_item_delta_fast (i, r,
3162
0
           src->get_item_delta_fast (old, ri_map[r],
3163
0
                   src_delta_bytes, src_row_size),
3164
0
           delta_bytes, row_size);
3165
0
    }
3166
0
3167
0
    return_trace (true);
3168
0
  }
3169
3170
  void collect_region_refs (hb_set_t &region_indices, const hb_inc_bimap_t &inner_map) const
3171
0
  {
3172
0
    const HBUINT8 *delta_bytes = get_delta_bytes ();
3173
0
    unsigned row_size = get_row_size ();
3174
0
3175
0
    for (unsigned int r = 0; r < regionIndices.len; r++)
3176
0
    {
3177
0
      unsigned int region = regionIndices.arrayZ[r];
3178
0
      if (region_indices.has (region)) continue;
3179
0
      for (hb_codepoint_t old_gid : inner_map.keys())
3180
0
  if (get_item_delta_fast (old_gid, r, delta_bytes, row_size) != 0)
3181
0
  {
3182
0
    region_indices.add (region);
3183
0
    break;
3184
0
  }
3185
0
    }
3186
0
  }
3187
3188
  public:
3189
  const HBUINT8 *get_delta_bytes () const
3190
0
  { return &StructAfter<HBUINT8> (regionIndices); }
3191
3192
  protected:
3193
  HBUINT8 *get_delta_bytes ()
3194
0
  { return &StructAfter<HBUINT8> (regionIndices); }
3195
3196
  public:
3197
  int32_t get_item_delta_fast (unsigned int item, unsigned int region,
3198
             const HBUINT8 *delta_bytes, unsigned row_size) const
3199
0
  {
3200
0
    if (unlikely (item >= itemCount || region >= regionIndices.len)) return 0;
3201
0
3202
0
    const HBINT8 *p = (const HBINT8 *) delta_bytes + item * row_size;
3203
0
    unsigned word_count = wordCount ();
3204
0
    bool is_long = longWords ();
3205
0
    if (is_long)
3206
0
    {
3207
0
      if (region < word_count)
3208
0
  return ((const HBINT32 *) p)[region];
3209
0
      else
3210
0
  return ((const HBINT16 *)(p + HBINT32::static_size * word_count))[region - word_count];
3211
0
    }
3212
0
    else
3213
0
    {
3214
0
      if (region < word_count)
3215
0
  return ((const HBINT16 *) p)[region];
3216
0
      else
3217
0
  return (p + HBINT16::static_size * word_count)[region - word_count];
3218
0
    }
3219
0
  }
3220
  int32_t get_item_delta (unsigned int item, unsigned int region) const
3221
0
  {
3222
0
     return get_item_delta_fast (item, region,
3223
0
         get_delta_bytes (),
3224
0
         get_row_size ());
3225
0
  }
3226
3227
  protected:
3228
  void set_item_delta_fast (unsigned int item, unsigned int region, int32_t delta,
3229
          HBUINT8 *delta_bytes, unsigned row_size)
3230
0
  {
3231
0
    HBINT8 *p = (HBINT8 *) delta_bytes + item * row_size;
3232
0
    unsigned word_count = wordCount ();
3233
0
    bool is_long = longWords ();
3234
0
    if (is_long)
3235
0
    {
3236
0
      if (region < word_count)
3237
0
  ((HBINT32 *) p)[region] = delta;
3238
0
      else
3239
0
  ((HBINT16 *)(p + HBINT32::static_size * word_count))[region - word_count] = delta;
3240
0
    }
3241
0
    else
3242
0
    {
3243
0
      if (region < word_count)
3244
0
  ((HBINT16 *) p)[region] = delta;
3245
0
      else
3246
0
  (p + HBINT16::static_size * word_count)[region - word_count] = delta;
3247
0
    }
3248
0
  }
3249
  void set_item_delta (unsigned int item, unsigned int region, int32_t delta)
3250
0
  {
3251
0
    set_item_delta_fast (item, region, delta,
3252
0
       get_delta_bytes (),
3253
0
       get_row_size ());
3254
0
  }
3255
3256
0
  bool longWords () const { return wordSizeCount & 0x8000u /* LONG_WORDS */; }
3257
0
  unsigned wordCount () const { return wordSizeCount & 0x7FFFu /* WORD_DELTA_COUNT_MASK */; }
3258
3259
  protected:
3260
  HBUINT16    itemCount;
3261
  HBUINT16    wordSizeCount;
3262
  Array16Of<HBUINT16> regionIndices;
3263
/*UnsizedArrayOf<HBUINT8>bytesX;*/
3264
  public:
3265
  DEFINE_SIZE_ARRAY (6, regionIndices);
3266
};
3267
3268
struct MultiVarData
3269
{
3270
  unsigned int get_size () const
3271
0
  { return min_size
3272
0
   - regionIndices.min_size + regionIndices.get_size ()
3273
0
   + StructAfter<CFF2Index> (regionIndices).get_size ();
3274
0
  }
3275
3276
  void get_delta (unsigned int inner,
3277
      const int *coords, unsigned int coord_count,
3278
      const SparseVarRegionList &regions,
3279
      hb_array_t<float> out,
3280
      hb_scalar_cache_t *cache = nullptr) const
3281
0
  {
3282
0
    auto &deltaSets = StructAfter<decltype (deltaSetsX)> (regionIndices);
3283
3284
0
    auto values_iter = deltaSets.fetcher (inner);
3285
0
    unsigned regionCount = regionIndices.len;
3286
0
    for (unsigned regionIndex = 0; regionIndex < regionCount; regionIndex++)
3287
0
    {
3288
0
      float scalar = regions.evaluate (regionIndices.arrayZ[regionIndex],
3289
0
               coords, coord_count,
3290
0
               cache);
3291
0
      values_iter.add_to (out, scalar);
3292
0
    }
3293
0
  }
3294
3295
  bool sanitize (hb_sanitize_context_t *c) const
3296
0
  {
3297
0
    TRACE_SANITIZE (this);
3298
0
    return_trace (format.sanitize (c) &&
3299
0
      hb_barrier () &&
3300
0
      format == 1 &&
3301
0
      regionIndices.sanitize (c) &&
3302
0
      hb_barrier () &&
3303
0
      StructAfter<decltype (deltaSetsX)> (regionIndices).sanitize (c));
3304
0
  }
3305
3306
  protected:
3307
  HBUINT8       format; // 1
3308
  Array16Of<HBUINT16> regionIndices;
3309
  TupleList       deltaSetsX;
3310
  public:
3311
  DEFINE_SIZE_MIN (8);
3312
};
3313
3314
struct ItemVariationStore
3315
{
3316
  friend struct item_variations_t;
3317
3318
  hb_scalar_cache_t *create_cache () const
3319
170k
  {
3320
#ifdef HB_NO_VAR
3321
    return hb_scalar_cache_t::create (0);
3322
#endif
3323
170k
    return hb_scalar_cache_t::create ((this+regions).regionCount);
3324
170k
  }
3325
3326
  static void destroy_cache (hb_scalar_cache_t *cache)
3327
170k
  {
3328
170k
    hb_scalar_cache_t::destroy (cache);
3329
170k
  }
3330
3331
  private:
3332
  float get_delta (unsigned int outer, unsigned int inner,
3333
       const int *coords, unsigned int coord_count,
3334
       hb_scalar_cache_t *cache = nullptr) const
3335
0
  {
3336
#ifdef HB_NO_VAR
3337
    return 0.f;
3338
#endif
3339
3340
0
    if (unlikely (outer >= dataSets.len))
3341
0
      return 0.f;
3342
3343
0
    return (this+dataSets[outer]).get_delta (inner,
3344
0
               coords, coord_count,
3345
0
               this+regions,
3346
0
               cache);
3347
0
  }
3348
3349
  public:
3350
  float get_delta (unsigned int index,
3351
       const int *coords, unsigned int coord_count,
3352
       hb_scalar_cache_t *cache = nullptr) const
3353
0
  {
3354
0
    unsigned int outer = index >> 16;
3355
0
    unsigned int inner = index & 0xFFFF;
3356
0
    return get_delta (outer, inner, coords, coord_count, cache);
3357
0
  }
3358
  float get_delta (unsigned int index,
3359
       hb_array_t<const int> coords,
3360
       hb_scalar_cache_t *cache = nullptr) const
3361
0
  {
3362
0
    return get_delta (index,
3363
0
          coords.arrayZ, coords.length,
3364
0
          cache);
3365
0
  }
3366
3367
  bool sanitize (hb_sanitize_context_t *c) const
3368
0
  {
3369
#ifdef HB_NO_VAR
3370
    return true;
3371
#endif
3372
3373
0
    TRACE_SANITIZE (this);
3374
0
    return_trace (c->check_struct (this) &&
3375
0
      hb_barrier () &&
3376
0
      format == 1 &&
3377
0
      regions.sanitize (c, this) &&
3378
0
      dataSets.sanitize (c, this));
3379
0
  }
3380
3381
  bool serialize (hb_serialize_context_t *c,
3382
                  bool has_long,
3383
                  const hb_vector_t<hb_tag_t>& axis_tags,
3384
                  const hb_vector_t<const hb_hashmap_t<hb_tag_t, Triple>*>& region_list,
3385
                  const hb_vector_t<delta_row_encoding_t>& vardata_encodings)
3386
0
  {
3387
0
    TRACE_SERIALIZE (this);
3388
0
#ifdef HB_NO_VAR
3389
0
    return_trace (false);
3390
0
#endif
3391
0
    if (unlikely (!c->extend_min (this))) return_trace (false);
3392
0
3393
0
    format = 1;
3394
0
    if (!regions.serialize_serialize (c, axis_tags, region_list))
3395
0
      return_trace (false);
3396
0
3397
0
    unsigned num_var_data = vardata_encodings.length;
3398
0
    if (!num_var_data) return_trace (false);
3399
0
    if (unlikely (!c->check_assign (dataSets.len, num_var_data,
3400
0
                                    HB_SERIALIZE_ERROR_INT_OVERFLOW)))
3401
0
      return_trace (false);
3402
0
3403
0
    if (unlikely (!c->extend (dataSets))) return_trace (false);
3404
0
    for (unsigned i = 0; i < num_var_data; i++)
3405
0
      if (!dataSets[i].serialize_serialize (c, has_long, vardata_encodings[i].items))
3406
0
        return_trace (false);
3407
0
3408
0
    return_trace (true);
3409
0
  }
3410
3411
  bool serialize (hb_serialize_context_t *c,
3412
      const ItemVariationStore *src,
3413
      const hb_array_t <const hb_inc_bimap_t> &inner_maps)
3414
0
  {
3415
0
    TRACE_SERIALIZE (this);
3416
0
#ifdef HB_NO_VAR
3417
0
    return_trace (false);
3418
0
#endif
3419
0
3420
0
    if (unlikely (!c->extend_min (this))) return_trace (false);
3421
0
3422
0
    unsigned int set_count = 0;
3423
0
    for (unsigned int i = 0; i < inner_maps.length; i++)
3424
0
      if (inner_maps[i].get_population ())
3425
0
  set_count++;
3426
0
3427
0
    format = 1;
3428
0
3429
0
    const auto &src_regions = src+src->regions;
3430
0
3431
0
    hb_set_t region_indices;
3432
0
    for (unsigned int i = 0; i < inner_maps.length; i++)
3433
0
      (src+src->dataSets[i]).collect_region_refs (region_indices, inner_maps[i]);
3434
0
3435
0
    if (region_indices.in_error ())
3436
0
      return_trace (false);
3437
0
3438
0
    region_indices.del_range ((src_regions).regionCount, hb_set_t::INVALID);
3439
0
3440
0
    /* TODO use constructor when our data-structures support that. */
3441
0
    hb_inc_bimap_t region_map;
3442
0
    + hb_iter (region_indices)
3443
0
    | hb_apply ([&region_map] (unsigned _) { region_map.add(_); })
3444
0
    ;
3445
0
    if (region_map.in_error())
3446
0
      return_trace (false);
3447
0
3448
0
    if (unlikely (!regions.serialize_serialize (c, &src_regions, region_map)))
3449
0
      return_trace (false);
3450
0
3451
0
    dataSets.len = set_count;
3452
0
    if (unlikely (!c->extend (dataSets))) return_trace (false);
3453
0
3454
0
    /* TODO: The following code could be simplified when
3455
0
     * List16OfOffset16To::subset () can take a custom param to be passed to VarData::serialize () */
3456
0
    unsigned int set_index = 0;
3457
0
    for (unsigned int i = 0; i < inner_maps.length; i++)
3458
0
    {
3459
0
      if (!inner_maps[i].get_population ()) continue;
3460
0
      if (unlikely (!dataSets[set_index++]
3461
0
         .serialize_serialize (c, &(src+src->dataSets[i]), inner_maps[i], region_map)))
3462
0
  return_trace (false);
3463
0
    }
3464
0
3465
0
    return_trace (true);
3466
0
  }
3467
3468
  ItemVariationStore *copy (hb_serialize_context_t *c) const
3469
0
  {
3470
0
    TRACE_SERIALIZE (this);
3471
0
    auto *out = c->start_embed (this);
3472
0
    if (unlikely (!out)) return_trace (nullptr);
3473
0
3474
0
    hb_vector_t <hb_inc_bimap_t> inner_maps;
3475
0
    unsigned count = dataSets.len;
3476
0
    for (unsigned i = 0; i < count; i++)
3477
0
    {
3478
0
      hb_inc_bimap_t *map = inner_maps.push ();
3479
0
      if (unlikely (!c->propagate_error(inner_maps)))
3480
0
        return_trace(nullptr);
3481
0
      auto &data = this+dataSets[i];
3482
0
3483
0
      unsigned itemCount = data.get_item_count ();
3484
0
      for (unsigned j = 0; j < itemCount; j++)
3485
0
  map->add (j);
3486
0
    }
3487
0
3488
0
    if (unlikely (!out->serialize (c, this, inner_maps))) return_trace (nullptr);
3489
0
3490
0
    return_trace (out);
3491
0
  }
3492
3493
  bool subset (hb_subset_context_t *c, const hb_array_t<const hb_inc_bimap_t> &inner_maps) const
3494
0
  {
3495
0
    TRACE_SUBSET (this);
3496
0
#ifdef HB_NO_VAR
3497
0
    return_trace (false);
3498
0
#endif
3499
0
3500
0
    ItemVariationStore *varstore_prime = c->serializer->start_embed<ItemVariationStore> ();
3501
0
    if (unlikely (!varstore_prime)) return_trace (false);
3502
0
3503
0
    varstore_prime->serialize (c->serializer, this, inner_maps);
3504
0
3505
0
    return_trace (
3506
0
        !c->serializer->in_error()
3507
0
        && varstore_prime->dataSets);
3508
0
  }
3509
3510
  unsigned int get_region_index_count (unsigned int major) const
3511
0
  {
3512
#ifdef HB_NO_VAR
3513
    return 0;
3514
#endif
3515
0
    return (this+dataSets[major]).get_region_index_count ();
3516
0
  }
3517
3518
  void get_region_scalars (unsigned int major,
3519
         const int *coords, unsigned int coord_count,
3520
         float *scalars /*OUT*/,
3521
         unsigned int num_scalars) const
3522
0
  {
3523
#ifdef HB_NO_VAR
3524
    for (unsigned i = 0; i < num_scalars; i++)
3525
      scalars[i] = 0.f;
3526
    return;
3527
#endif
3528
3529
0
    (this+dataSets[major]).get_region_scalars (coords, coord_count,
3530
0
                 this+regions,
3531
0
                 &scalars[0], num_scalars);
3532
0
  }
3533
3534
  unsigned int get_sub_table_count () const
3535
0
   {
3536
0
#ifdef HB_NO_VAR
3537
0
     return 0;
3538
0
#endif
3539
0
     return dataSets.len;
3540
0
   }
3541
3542
  const VarData& get_sub_table (unsigned i) const
3543
0
  {
3544
0
#ifdef HB_NO_VAR
3545
0
     return Null (VarData);
3546
0
#endif
3547
0
     return this+dataSets[i];
3548
0
  }
3549
3550
  const VarRegionList& get_region_list () const
3551
0
  {
3552
0
#ifdef HB_NO_VAR
3553
0
     return Null (VarRegionList);
3554
0
#endif
3555
0
     return this+regions;
3556
0
  }
3557
3558
  protected:
3559
  HBUINT16        format;
3560
  Offset32To<VarRegionList>   regions;
3561
  Array16OfOffset32To<VarData>    dataSets;
3562
  public:
3563
  DEFINE_SIZE_ARRAY_SIZED (8, dataSets);
3564
};
3565
3566
struct MultiItemVariationStore
3567
{
3568
  hb_scalar_cache_t *create_cache (hb_scalar_cache_t *static_cache = nullptr) const
3569
0
  {
3570
#ifdef HB_NO_VAR
3571
    return hb_scalar_cache_t::create (0);
3572
#endif
3573
0
    auto &r = this+regions;
3574
0
    unsigned count = r.regions.len;
3575
3576
0
    return hb_scalar_cache_t::create (count, static_cache);
3577
0
  }
3578
3579
  static void destroy_cache (hb_scalar_cache_t *cache,
3580
           hb_scalar_cache_t *static_cache = nullptr)
3581
0
  {
3582
0
    hb_scalar_cache_t::destroy (cache, static_cache);
3583
0
  }
3584
3585
  private:
3586
  void get_delta (unsigned int outer, unsigned int inner,
3587
      const int *coords, unsigned int coord_count,
3588
      hb_array_t<float> out,
3589
      hb_scalar_cache_t *cache = nullptr) const
3590
0
  {
3591
#ifdef HB_NO_VAR
3592
    return;
3593
#endif
3594
3595
0
    if (unlikely (outer >= dataSets.len))
3596
0
      return;
3597
3598
0
    return (this+dataSets[outer]).get_delta (inner,
3599
0
               coords, coord_count,
3600
0
               this+regions,
3601
0
               out,
3602
0
               cache);
3603
0
  }
3604
3605
  public:
3606
  void get_delta (unsigned int index,
3607
      const int *coords, unsigned int coord_count,
3608
      hb_array_t<float> out,
3609
      hb_scalar_cache_t *cache = nullptr) const
3610
0
  {
3611
0
    unsigned int outer = index >> 16;
3612
0
    unsigned int inner = index & 0xFFFF;
3613
0
    get_delta (outer, inner, coords, coord_count, out, cache);
3614
0
  }
3615
  void get_delta (unsigned int index,
3616
      hb_array_t<const int> coords,
3617
      hb_array_t<float> out,
3618
      hb_scalar_cache_t *cache = nullptr) const
3619
0
  {
3620
0
    return get_delta (index,
3621
0
          coords.arrayZ, coords.length,
3622
0
          out,
3623
0
          cache);
3624
0
  }
3625
3626
  bool sanitize (hb_sanitize_context_t *c) const
3627
0
  {
3628
#ifdef HB_NO_VAR
3629
    return true;
3630
#endif
3631
3632
0
    TRACE_SANITIZE (this);
3633
0
    return_trace (c->check_struct (this) &&
3634
0
      hb_barrier () &&
3635
0
      format == 1 &&
3636
0
      regions.sanitize (c, this) &&
3637
0
      dataSets.sanitize (c, this));
3638
0
  }
3639
3640
  protected:
3641
  HBUINT16        format; // 1
3642
  Offset32To<SparseVarRegionList> regions;
3643
  Array16OfOffset32To<MultiVarData> dataSets;
3644
  public:
3645
  DEFINE_SIZE_ARRAY_SIZED (8, dataSets);
3646
};
3647
3648
template <typename MapCountT>
3649
struct DeltaSetIndexMapFormat01
3650
{
3651
  friend struct DeltaSetIndexMap;
3652
3653
  unsigned get_size () const
3654
0
  { return min_size + mapCount * get_width (); }
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned short, 2u> >::get_size() const
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned int, 4u> >::get_size() const
3655
3656
  private:
3657
  DeltaSetIndexMapFormat01* copy (hb_serialize_context_t *c) const
3658
0
  {
3659
0
    TRACE_SERIALIZE (this);
3660
0
    return_trace (c->embed (this));
3661
0
  }
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned short, 2u> >::copy(hb_serialize_context_t*) const
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned int, 4u> >::copy(hb_serialize_context_t*) const
3662
3663
  template <typename T>
3664
  bool serialize (hb_serialize_context_t *c, const T &plan)
3665
0
  {
3666
0
    unsigned int width = plan.get_width ();
3667
0
    unsigned int inner_bit_count = plan.get_inner_bit_count ();
3668
0
    const hb_array_t<const uint32_t> output_map = plan.get_output_map ();
3669
0
3670
0
    TRACE_SERIALIZE (this);
3671
0
    if (unlikely (output_map.length && ((((inner_bit_count-1)&~0xF)!=0) || (((width-1)&~0x3)!=0))))
3672
0
      return_trace (false);
3673
0
    if (unlikely (!c->extend_min (this))) return_trace (false);
3674
0
3675
0
    entryFormat = ((width-1)<<4)|(inner_bit_count-1);
3676
0
    mapCount = output_map.length;
3677
0
    HBUINT8 *p = c->allocate_size<HBUINT8> (width * output_map.length);
3678
0
    if (unlikely (!p)) return_trace (false);
3679
0
    for (unsigned int i = 0; i < output_map.length; i++)
3680
0
    {
3681
0
      unsigned int v = output_map.arrayZ[i];
3682
0
      if (v)
3683
0
      {
3684
0
  unsigned int outer = v >> 16;
3685
0
  unsigned int inner = v & 0xFFFF;
3686
0
  unsigned int u = (outer << inner_bit_count) | inner;
3687
0
  for (unsigned int w = width; w > 0;)
3688
0
  {
3689
0
    p[--w] = u;
3690
0
    u >>= 8;
3691
0
  }
3692
0
      }
3693
0
      p += width;
3694
0
    }
3695
0
    return_trace (true);
3696
0
  }
Unexecuted instantiation: bool OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned short, 2u> >::serialize<OT::index_map_subset_plan_t>(hb_serialize_context_t*, OT::index_map_subset_plan_t const&)
Unexecuted instantiation: bool OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned int, 4u> >::serialize<OT::index_map_subset_plan_t>(hb_serialize_context_t*, OT::index_map_subset_plan_t const&)
Unexecuted instantiation: bool OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned short, 2u> >::serialize<OT::delta_set_index_map_subset_plan_t>(hb_serialize_context_t*, OT::delta_set_index_map_subset_plan_t const&)
Unexecuted instantiation: bool OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned int, 4u> >::serialize<OT::delta_set_index_map_subset_plan_t>(hb_serialize_context_t*, OT::delta_set_index_map_subset_plan_t const&)
3697
3698
  HB_ALWAYS_INLINE
3699
  uint32_t map (unsigned int v) const /* Returns 16.16 outer.inner. */
3700
0
  {
3701
    /* If count is zero, pass value unchanged.  This takes
3702
     * care of direct mapping for advance map. */
3703
0
    if (!mapCount)
3704
0
      return v;
3705
0
    return _map (v);
3706
0
  }
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned short, 2u> >::map(unsigned int) const
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned int, 4u> >::map(unsigned int) const
3707
3708
  HB_HOT
3709
  uint32_t _map (unsigned int v) const /* Returns 16.16 outer.inner. */
3710
0
  {
3711
0
    if (v >= mapCount)
3712
0
      v = mapCount - 1;
3713
3714
0
    unsigned int u = 0;
3715
0
    { /* Fetch it. */
3716
0
      unsigned int w = get_width ();
3717
0
      const HBUINT8 *p = mapDataZ.arrayZ + w * v;
3718
0
      for (; w; w--)
3719
0
        u = (u << 8) + *p++;
3720
0
    }
3721
3722
0
    { /* Repack it. */
3723
0
      unsigned int n = get_inner_bit_count ();
3724
0
      unsigned int outer = u >> n;
3725
0
      unsigned int inner = u & ((1 << n) - 1);
3726
0
      u = (outer<<16) | inner;
3727
0
    }
3728
3729
0
    return u;
3730
0
  }
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned short, 2u> >::_map(unsigned int) const
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned int, 4u> >::_map(unsigned int) const
3731
3732
0
  unsigned get_map_count () const       { return mapCount; }
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned short, 2u> >::get_map_count() const
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned int, 4u> >::get_map_count() const
3733
0
  unsigned get_width () const           { return ((entryFormat >> 4) & 3) + 1; }
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned short, 2u> >::get_width() const
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned int, 4u> >::get_width() const
3734
0
  unsigned get_inner_bit_count () const { return (entryFormat & 0xF) + 1; }
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned short, 2u> >::get_inner_bit_count() const
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned int, 4u> >::get_inner_bit_count() const
3735
3736
3737
  bool sanitize (hb_sanitize_context_t *c) const
3738
0
  {
3739
0
    TRACE_SANITIZE (this);
3740
0
    return_trace (c->check_struct (this) &&
3741
0
      hb_barrier () &&
3742
0
                  c->check_range (mapDataZ.arrayZ,
3743
0
                                  mapCount,
3744
0
                                  get_width ()));
3745
0
  }
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned short, 2u> >::sanitize(hb_sanitize_context_t*) const
Unexecuted instantiation: OT::DeltaSetIndexMapFormat01<OT::NumType<true, unsigned int, 4u> >::sanitize(hb_sanitize_context_t*) const
3746
3747
  protected:
3748
  HBUINT8       format;         /* Format identifier--format = 0 */
3749
  HBUINT8       entryFormat;    /* A packed field that describes the compressed
3750
                                 * representation of delta-set indices. */
3751
  MapCountT     mapCount;       /* The number of mapping entries. */
3752
  UnsizedArrayOf<HBUINT8>
3753
                mapDataZ;       /* The delta-set index mapping data. */
3754
3755
  public:
3756
  DEFINE_SIZE_ARRAY (2+MapCountT::static_size, mapDataZ);
3757
};
3758
3759
struct DeltaSetIndexMap
3760
{
3761
  template <typename T>
3762
  bool serialize (hb_serialize_context_t *c, const T &plan)
3763
0
  {
3764
0
    TRACE_SERIALIZE (this);
3765
0
    unsigned length = plan.get_output_map ().length;
3766
0
    u.format = length <= 0xFFFF ? 0 : 1;
3767
0
    switch (u.format) {
3768
0
    case 0: hb_barrier (); return_trace (u.format0.serialize (c, plan));
3769
0
    case 1: hb_barrier (); return_trace (u.format1.serialize (c, plan));
3770
0
    default:return_trace (false);
3771
0
    }
3772
0
  }
Unexecuted instantiation: bool OT::DeltaSetIndexMap::serialize<OT::index_map_subset_plan_t>(hb_serialize_context_t*, OT::index_map_subset_plan_t const&)
Unexecuted instantiation: bool OT::DeltaSetIndexMap::serialize<OT::delta_set_index_map_subset_plan_t>(hb_serialize_context_t*, OT::delta_set_index_map_subset_plan_t const&)
3773
3774
  uint32_t map (unsigned v) const
3775
0
  {
3776
0
    switch (u.format) {
3777
0
    case 0: hb_barrier (); return (u.format0.map (v));
3778
0
    case 1: hb_barrier (); return (u.format1.map (v));
3779
0
    default:return v;
3780
0
    }
3781
0
  }
3782
3783
  unsigned get_map_count () const
3784
0
  {
3785
0
    switch (u.format) {
3786
0
    case 0: hb_barrier (); return u.format0.get_map_count ();
3787
0
    case 1: hb_barrier (); return u.format1.get_map_count ();
3788
0
    default:return 0;
3789
0
    }
3790
0
  }
3791
3792
  unsigned get_width () const
3793
0
  {
3794
0
    switch (u.format) {
3795
0
    case 0: hb_barrier (); return u.format0.get_width ();
3796
0
    case 1: hb_barrier (); return u.format1.get_width ();
3797
0
    default:return 0;
3798
0
    }
3799
0
  }
3800
3801
  unsigned get_inner_bit_count () const
3802
0
  {
3803
0
    switch (u.format) {
3804
0
    case 0: hb_barrier (); return u.format0.get_inner_bit_count ();
3805
0
    case 1: hb_barrier (); return u.format1.get_inner_bit_count ();
3806
0
    default:return 0;
3807
0
    }
3808
0
  }
3809
3810
  bool sanitize (hb_sanitize_context_t *c) const
3811
0
  {
3812
0
    TRACE_SANITIZE (this);
3813
0
    if (!u.format.sanitize (c)) return_trace (false);
3814
0
    hb_barrier ();
3815
0
    switch (u.format) {
3816
0
    case 0: hb_barrier (); return_trace (u.format0.sanitize (c));
3817
0
    case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
3818
0
    default:return_trace (true);
3819
0
    }
3820
0
  }
3821
3822
  DeltaSetIndexMap* copy (hb_serialize_context_t *c) const
3823
0
  {
3824
0
    TRACE_SERIALIZE (this);
3825
0
    switch (u.format) {
3826
0
    case 0: hb_barrier (); return_trace (reinterpret_cast<DeltaSetIndexMap *> (u.format0.copy (c)));
3827
0
    case 1: hb_barrier (); return_trace (reinterpret_cast<DeltaSetIndexMap *> (u.format1.copy (c)));
3828
0
    default:return_trace (nullptr);
3829
0
    }
3830
0
  }
3831
3832
  protected:
3833
  union {
3834
  HBUINT8                            format;         /* Format identifier */
3835
  DeltaSetIndexMapFormat01<HBUINT16> format0;
3836
  DeltaSetIndexMapFormat01<HBUINT32> format1;
3837
  } u;
3838
  public:
3839
  DEFINE_SIZE_UNION (1, format);
3840
};
3841
3842
3843
struct ItemVarStoreInstancer
3844
{
3845
  ItemVarStoreInstancer (const ItemVariationStore *varStore_,
3846
       const DeltaSetIndexMap *varIdxMap,
3847
       hb_array_t<const int> coords,
3848
       hb_scalar_cache_t *cache = nullptr) :
3849
345k
    varStore (varStore_), varIdxMap (varIdxMap), coords (coords), cache (cache)
3850
345k
  {
3851
345k
    if (!varStore)
3852
0
      varStore = &Null(ItemVariationStore);
3853
345k
  }
3854
3855
0
  operator bool () const { return varStore && bool (coords); }
3856
3857
  float operator[] (uint32_t varIdx) const
3858
0
  { return (*this) (varIdx); }
3859
3860
  float operator() (uint32_t varIdx, unsigned short offset = 0) const
3861
0
  {
3862
0
   if (!coords || varIdx == VarIdx::NO_VARIATION)
3863
0
     return 0.f;
3864
3865
0
    varIdx += offset;
3866
0
    if (varIdxMap)
3867
0
      varIdx = varIdxMap->map (varIdx);
3868
0
    return varStore->get_delta (varIdx, coords, cache);
3869
0
  }
3870
3871
  const ItemVariationStore *varStore;
3872
  const DeltaSetIndexMap *varIdxMap;
3873
  hb_array_t<const int> coords;
3874
  hb_scalar_cache_t *cache;
3875
};
3876
3877
struct MultiItemVarStoreInstancer
3878
{
3879
  MultiItemVarStoreInstancer (const MultiItemVariationStore *varStore,
3880
            const DeltaSetIndexMap *varIdxMap,
3881
            hb_array_t<const int> coords,
3882
            hb_scalar_cache_t *cache = nullptr) :
3883
0
    varStore (varStore), varIdxMap (varIdxMap), coords (coords), cache (cache)
3884
0
  {
3885
0
    if (!varStore)
3886
0
      varStore = &Null(MultiItemVariationStore);
3887
0
  }
3888
3889
0
  operator bool () const { return varStore && bool (coords); }
3890
3891
  float operator[] (uint32_t varIdx) const
3892
0
  {
3893
0
    float v = 0;
3894
0
    (*this) (hb_array (&v, 1), varIdx);
3895
0
    return v;
3896
0
  }
3897
3898
  void operator() (hb_array_t<float> out, uint32_t varIdx, unsigned short offset = 0) const
3899
0
  {
3900
0
    if (coords && varIdx != VarIdx::NO_VARIATION)
3901
0
    {
3902
0
      varIdx += offset;
3903
0
      if (varIdxMap)
3904
0
  varIdx = varIdxMap->map (varIdx);
3905
0
      varStore->get_delta (varIdx, coords, out, cache);
3906
0
    }
3907
0
    else
3908
0
      for (unsigned i = 0; i < out.length; i++)
3909
0
        out.arrayZ[i] = 0.f;
3910
0
  }
3911
3912
  const MultiItemVariationStore *varStore;
3913
  const DeltaSetIndexMap *varIdxMap;
3914
  hb_array_t<const int> coords;
3915
  hb_scalar_cache_t *cache;
3916
};
3917
3918
3919
/*
3920
 * Feature Variations
3921
 */
3922
enum Cond_with_Var_flag_t
3923
{
3924
  KEEP_COND_WITH_VAR = 0,
3925
  KEEP_RECORD_WITH_VAR = 1,
3926
  DROP_COND_WITH_VAR = 2,
3927
  DROP_RECORD_WITH_VAR = 3,
3928
};
3929
3930
struct Condition;
3931
3932
template <typename Instancer>
3933
static bool
3934
_hb_recurse_condition_evaluate (const struct Condition &condition,
3935
        const int *coords,
3936
        unsigned int coord_len,
3937
        Instancer *instancer);
3938
3939
struct ConditionAxisRange
3940
{
3941
  friend struct Condition;
3942
3943
  bool subset (hb_subset_context_t *c) const
3944
0
  {
3945
0
    TRACE_SUBSET (this);
3946
0
    auto *out = c->serializer->embed (this);
3947
0
    if (unlikely (!out)) return_trace (false);
3948
0
3949
0
    const hb_map_t *index_map = &c->plan->axes_index_map;
3950
0
    if (index_map->is_empty ()) return_trace (true);
3951
0
3952
0
    const hb_map_t& axes_old_index_tag_map = c->plan->axes_old_index_tag_map;
3953
0
    hb_codepoint_t *axis_tag;
3954
0
    if (!axes_old_index_tag_map.has (axisIndex, &axis_tag) ||
3955
0
        !index_map->has (axisIndex))
3956
0
      return_trace (false);
3957
0
3958
0
    const hb_hashmap_t<hb_tag_t, Triple>& normalized_axes_location = c->plan->axes_location;
3959
0
    Triple axis_limit{-1.0, 0.0, 1.0};
3960
0
    Triple *normalized_limit;
3961
0
    if (normalized_axes_location.has (*axis_tag, &normalized_limit))
3962
0
      axis_limit = *normalized_limit;
3963
0
3964
0
    const hb_hashmap_t<hb_tag_t, TripleDistances>& axes_triple_distances = c->plan->axes_triple_distances;
3965
0
    TripleDistances axis_triple_distances{1.0, 1.0};
3966
0
    TripleDistances *triple_dists;
3967
0
    if (axes_triple_distances.has (*axis_tag, &triple_dists))
3968
0
      axis_triple_distances = *triple_dists;
3969
0
3970
0
    float normalized_min = renormalizeValue ((double) filterRangeMinValue.to_float (), axis_limit, axis_triple_distances, false);
3971
0
    float normalized_max = renormalizeValue ((double) filterRangeMaxValue.to_float (), axis_limit, axis_triple_distances, false);
3972
0
    out->filterRangeMinValue.set_float (normalized_min);
3973
0
    out->filterRangeMaxValue.set_float (normalized_max);
3974
0
3975
0
    return_trace (c->serializer->check_assign (out->axisIndex, index_map->get (axisIndex),
3976
0
                                               HB_SERIALIZE_ERROR_INT_OVERFLOW));
3977
0
  }
3978
3979
  private:
3980
  Cond_with_Var_flag_t keep_with_variations (hb_collect_feature_substitutes_with_var_context_t *c,
3981
                                             hb_map_t *condition_map /* OUT */) const
3982
0
  {
3983
0
    //invalid axis index, drop the entire record
3984
0
    if (!c->axes_index_tag_map->has (axisIndex))
3985
0
      return DROP_RECORD_WITH_VAR;
3986
0
3987
0
    hb_tag_t axis_tag = c->axes_index_tag_map->get (axisIndex);
3988
0
3989
0
    Triple axis_range (-1.0, 0.0, 1.0);
3990
0
    Triple *axis_limit;
3991
0
    bool axis_set_by_user = false;
3992
0
    if (c->axes_location->has (axis_tag, &axis_limit))
3993
0
    {
3994
0
      axis_range = *axis_limit;
3995
0
      axis_set_by_user = true;
3996
0
    }
3997
0
3998
0
    float axis_min_val = axis_range.minimum;
3999
0
    float axis_default_val = axis_range.middle;
4000
0
    float axis_max_val = axis_range.maximum;
4001
0
4002
0
    float filter_min_val = filterRangeMinValue.to_float ();
4003
0
    float filter_max_val = filterRangeMaxValue.to_float ();
4004
0
4005
0
    if (axis_default_val < filter_min_val ||
4006
0
        axis_default_val > filter_max_val)
4007
0
      c->apply = false;
4008
0
4009
0
    //condition not met, drop the entire record
4010
0
    if (axis_min_val > filter_max_val || axis_max_val < filter_min_val ||
4011
0
        filter_min_val > filter_max_val)
4012
0
      return DROP_RECORD_WITH_VAR;
4013
0
4014
0
    //condition met and axis pinned, drop the condition
4015
0
    if (axis_set_by_user && axis_range.is_point ())
4016
0
      return DROP_COND_WITH_VAR;
4017
0
4018
0
    if (filter_max_val != axis_max_val || filter_min_val != axis_min_val)
4019
0
    {
4020
0
      // add axisIndex->value into the hashmap so we can check if the record is
4021
0
      // unique with variations
4022
0
      uint16_t int_filter_max_val = (uint16_t) filterRangeMaxValue.to_int ();
4023
0
      uint16_t int_filter_min_val = (uint16_t) filterRangeMinValue.to_int ();
4024
0
      hb_codepoint_t val = (int_filter_max_val << 16) + int_filter_min_val;
4025
0
4026
0
      condition_map->set (axisIndex, val);
4027
0
      return KEEP_COND_WITH_VAR;
4028
0
    }
4029
0
    return KEEP_RECORD_WITH_VAR;
4030
0
  }
4031
4032
  template <typename Instancer>
4033
  bool evaluate (const int *coords, unsigned int coord_len,
4034
     Instancer *instancer HB_UNUSED) const
4035
0
  {
4036
0
    int coord = axisIndex < coord_len ? coords[axisIndex] : 0;
4037
0
    return filterRangeMinValue.to_int () <= coord && coord <= filterRangeMaxValue.to_int ();
4038
0
  }
Unexecuted instantiation: bool OT::ConditionAxisRange::evaluate<OT::ItemVarStoreInstancer>(int const*, unsigned int, OT::ItemVarStoreInstancer*) const
Unexecuted instantiation: bool OT::ConditionAxisRange::evaluate<OT::MultiItemVarStoreInstancer>(int const*, unsigned int, OT::MultiItemVarStoreInstancer*) const
4039
4040
  bool sanitize (hb_sanitize_context_t *c) const
4041
0
  {
4042
0
    TRACE_SANITIZE (this);
4043
0
    return_trace (c->check_struct (this));
4044
0
  }
4045
4046
  protected:
4047
  HBUINT16  format;   /* Format identifier--format = 1 */
4048
  HBUINT16  axisIndex;
4049
  F2DOT14 filterRangeMinValue;
4050
  F2DOT14 filterRangeMaxValue;
4051
  public:
4052
  DEFINE_SIZE_STATIC (8);
4053
};
4054
4055
struct ConditionValue
4056
{
4057
  friend struct Condition;
4058
4059
  bool subset (hb_subset_context_t *c) const
4060
0
  {
4061
0
    TRACE_SUBSET (this);
4062
0
    // TODO(subset)
4063
0
    return_trace (false);
4064
0
  }
4065
4066
  private:
4067
  template <typename Instancer>
4068
  bool evaluate (const int *coords, unsigned int coord_len,
4069
     Instancer *instancer) const
4070
0
  {
4071
0
    signed value = defaultValue;
4072
0
    value += (*instancer)[varIdx];
4073
0
    return value > 0;
4074
0
  }
Unexecuted instantiation: bool OT::ConditionValue::evaluate<OT::ItemVarStoreInstancer>(int const*, unsigned int, OT::ItemVarStoreInstancer*) const
Unexecuted instantiation: bool OT::ConditionValue::evaluate<OT::MultiItemVarStoreInstancer>(int const*, unsigned int, OT::MultiItemVarStoreInstancer*) const
4075
4076
  bool subset (hb_subset_context_t *c,
4077
               hb_subset_layout_context_t *l,
4078
               bool insert_catch_all) const
4079
0
  {
4080
0
    TRACE_SUBSET (this);
4081
0
    // TODO(subset)
4082
0
    return_trace (false);
4083
0
  }
4084
4085
  bool sanitize (hb_sanitize_context_t *c) const
4086
0
  {
4087
0
    TRACE_SANITIZE (this);
4088
0
    return_trace (c->check_struct (this));
4089
0
  }
4090
4091
  protected:
4092
  HBUINT16  format;   /* Format identifier--format = 2 */
4093
  HBINT16 defaultValue;   /* Value at default instance. */
4094
  VarIdx  varIdx;   /* Variation index */
4095
  public:
4096
  DEFINE_SIZE_STATIC (8);
4097
};
4098
4099
struct ConditionAnd
4100
{
4101
  friend struct Condition;
4102
4103
  bool subset (hb_subset_context_t *c) const
4104
0
  {
4105
0
    TRACE_SUBSET (this);
4106
0
    // TODO(subset)
4107
0
    return_trace (false);
4108
0
  }
4109
4110
  private:
4111
  template <typename Instancer>
4112
  bool evaluate (const int *coords, unsigned int coord_len,
4113
     Instancer *instancer) const
4114
0
  {
4115
0
    unsigned int count = conditions.len;
4116
0
    for (unsigned int i = 0; i < count; i++)
4117
0
      if (!_hb_recurse_condition_evaluate (this+conditions.arrayZ[i],
4118
0
             coords, coord_len,
4119
0
             instancer))
4120
0
  return false;
4121
0
    return true;
4122
0
  }
Unexecuted instantiation: bool OT::ConditionAnd::evaluate<OT::ItemVarStoreInstancer>(int const*, unsigned int, OT::ItemVarStoreInstancer*) const
Unexecuted instantiation: bool OT::ConditionAnd::evaluate<OT::MultiItemVarStoreInstancer>(int const*, unsigned int, OT::MultiItemVarStoreInstancer*) const
4123
4124
  bool subset (hb_subset_context_t *c,
4125
               hb_subset_layout_context_t *l,
4126
               bool insert_catch_all) const
4127
0
  {
4128
0
    TRACE_SUBSET (this);
4129
0
    // TODO(subset)
4130
0
    return_trace (false);
4131
0
  }
4132
4133
  bool sanitize (hb_sanitize_context_t *c) const
4134
0
  {
4135
0
    TRACE_SANITIZE (this);
4136
0
    return_trace (conditions.sanitize (c, this));
4137
0
  }
4138
4139
  protected:
4140
  HBUINT16  format;   /* Format identifier--format = 3 */
4141
  Array8OfOffset24To<struct Condition>  conditions;
4142
  public:
4143
  DEFINE_SIZE_ARRAY (3, conditions);
4144
};
4145
4146
struct ConditionOr
4147
{
4148
  friend struct Condition;
4149
4150
  bool subset (hb_subset_context_t *c) const
4151
0
  {
4152
0
    TRACE_SUBSET (this);
4153
0
    // TODO(subset)
4154
0
    return_trace (false);
4155
0
  }
4156
4157
  private:
4158
  template <typename Instancer>
4159
  bool evaluate (const int *coords, unsigned int coord_len,
4160
     Instancer *instancer) const
4161
0
  {
4162
0
    unsigned int count = conditions.len;
4163
0
    for (unsigned int i = 0; i < count; i++)
4164
0
      if (_hb_recurse_condition_evaluate (this+conditions.arrayZ[i],
4165
0
            coords, coord_len,
4166
0
            instancer))
4167
0
  return true;
4168
0
    return false;
4169
0
  }
Unexecuted instantiation: bool OT::ConditionOr::evaluate<OT::ItemVarStoreInstancer>(int const*, unsigned int, OT::ItemVarStoreInstancer*) const
Unexecuted instantiation: bool OT::ConditionOr::evaluate<OT::MultiItemVarStoreInstancer>(int const*, unsigned int, OT::MultiItemVarStoreInstancer*) const
4170
4171
  bool subset (hb_subset_context_t *c,
4172
               hb_subset_layout_context_t *l,
4173
               bool insert_catch_all) const
4174
0
  {
4175
0
    TRACE_SUBSET (this);
4176
0
    // TODO(subset)
4177
0
    return_trace (false);
4178
0
  }
4179
4180
  bool sanitize (hb_sanitize_context_t *c) const
4181
0
  {
4182
0
    TRACE_SANITIZE (this);
4183
0
    return_trace (conditions.sanitize (c, this));
4184
0
  }
4185
4186
  protected:
4187
  HBUINT16  format;   /* Format identifier--format = 4 */
4188
  Array8OfOffset24To<struct Condition>  conditions;
4189
  public:
4190
  DEFINE_SIZE_ARRAY (3, conditions);
4191
};
4192
4193
struct ConditionNegate
4194
{
4195
  friend struct Condition;
4196
4197
  bool subset (hb_subset_context_t *c) const
4198
0
  {
4199
0
    TRACE_SUBSET (this);
4200
0
    // TODO(subset)
4201
0
    return_trace (false);
4202
0
  }
4203
4204
  private:
4205
  template <typename Instancer>
4206
  bool evaluate (const int *coords, unsigned int coord_len,
4207
     Instancer *instancer) const
4208
0
  {
4209
0
    return !_hb_recurse_condition_evaluate (this+condition,
4210
0
              coords, coord_len,
4211
0
              instancer);
4212
0
  }
Unexecuted instantiation: bool OT::ConditionNegate::evaluate<OT::ItemVarStoreInstancer>(int const*, unsigned int, OT::ItemVarStoreInstancer*) const
Unexecuted instantiation: bool OT::ConditionNegate::evaluate<OT::MultiItemVarStoreInstancer>(int const*, unsigned int, OT::MultiItemVarStoreInstancer*) const
4213
4214
  bool subset (hb_subset_context_t *c,
4215
               hb_subset_layout_context_t *l,
4216
               bool insert_catch_all) const
4217
0
  {
4218
0
    TRACE_SUBSET (this);
4219
0
    // TODO(subset)
4220
0
    return_trace (false);
4221
0
  }
4222
4223
  bool sanitize (hb_sanitize_context_t *c) const
4224
0
  {
4225
0
    TRACE_SANITIZE (this);
4226
0
    return_trace (condition.sanitize (c, this));
4227
0
  }
4228
4229
  protected:
4230
  HBUINT16  format;   /* Format identifier--format = 5 */
4231
  Offset24To<struct Condition>  condition;
4232
  public:
4233
  DEFINE_SIZE_STATIC (5);
4234
};
4235
4236
struct Condition
4237
{
4238
  template <typename Instancer>
4239
  bool evaluate (const int *coords, unsigned int coord_len,
4240
     Instancer *instancer) const
4241
0
  {
4242
0
    switch (u.format) {
4243
0
    case 1: hb_barrier (); return u.format1.evaluate (coords, coord_len, instancer);
4244
0
    case 2: hb_barrier (); return u.format2.evaluate (coords, coord_len, instancer);
4245
0
    case 3: hb_barrier (); return u.format3.evaluate (coords, coord_len, instancer);
4246
0
    case 4: hb_barrier (); return u.format4.evaluate (coords, coord_len, instancer);
4247
0
    case 5: hb_barrier (); return u.format5.evaluate (coords, coord_len, instancer);
4248
0
    default:return false;
4249
0
    }
4250
0
  }
Unexecuted instantiation: bool OT::Condition::evaluate<OT::ItemVarStoreInstancer>(int const*, unsigned int, OT::ItemVarStoreInstancer*) const
Unexecuted instantiation: bool OT::Condition::evaluate<OT::MultiItemVarStoreInstancer>(int const*, unsigned int, OT::MultiItemVarStoreInstancer*) const
4251
4252
  Cond_with_Var_flag_t keep_with_variations (hb_collect_feature_substitutes_with_var_context_t *c,
4253
                                             hb_map_t *condition_map /* OUT */) const
4254
0
  {
4255
0
    switch (u.format) {
4256
0
    case 1: hb_barrier (); return u.format1.keep_with_variations (c, condition_map);
4257
0
    // TODO(subset)
4258
0
    default: c->apply = false; return KEEP_COND_WITH_VAR;
4259
0
    }
4260
0
  }
4261
4262
  template <typename context_t, typename ...Ts>
4263
  typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
4264
0
  {
4265
0
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
4266
0
    TRACE_DISPATCH (this, u.format);
4267
0
    switch (u.format) {
4268
0
    case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
4269
0
    case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
4270
0
    case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
4271
0
    case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
4272
0
    case 5: hb_barrier (); return_trace (c->dispatch (u.format5, std::forward<Ts> (ds)...));
4273
0
    default:return_trace (c->default_return_value ());
4274
0
    }
4275
0
  }
4276
4277
  bool sanitize (hb_sanitize_context_t *c) const
4278
0
  {
4279
0
    TRACE_SANITIZE (this);
4280
0
    if (!u.format.sanitize (c)) return_trace (false);
4281
0
    hb_barrier ();
4282
0
    switch (u.format) {
4283
0
    case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
4284
0
    case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
4285
0
    case 3: hb_barrier (); return_trace (u.format3.sanitize (c));
4286
0
    case 4: hb_barrier (); return_trace (u.format4.sanitize (c));
4287
0
    case 5: hb_barrier (); return_trace (u.format5.sanitize (c));
4288
0
    default:return_trace (true);
4289
0
    }
4290
0
  }
4291
4292
  protected:
4293
  union {
4294
  HBUINT16    format;   /* Format identifier */
4295
  ConditionAxisRange  format1;
4296
  ConditionValue  format2;
4297
  ConditionAnd    format3;
4298
  ConditionOr   format4;
4299
  ConditionNegate format5;
4300
  } u;
4301
  public:
4302
  DEFINE_SIZE_UNION (2, format);
4303
};
4304
4305
template <typename Instancer>
4306
bool
4307
_hb_recurse_condition_evaluate (const struct Condition &condition,
4308
        const int *coords,
4309
        unsigned int coord_len,
4310
        Instancer *instancer)
4311
0
{
4312
0
  return condition.evaluate (coords, coord_len, instancer);
4313
0
}
Unexecuted instantiation: hb-face.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-font.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-ot-font.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: VARC.cc:bool OT::_hb_recurse_condition_evaluate<OT::MultiItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::MultiItemVarStoreInstancer*)
Unexecuted instantiation: VARC.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-ot-metrics.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-ot-shape.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-ot-var.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-static.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-ft.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-aat-layout.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-aat-map.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-ot-cff1-table.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-ot-cff2-table.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::_hb_recurse_condition_evaluate<OT::ItemVarStoreInstancer>(OT::Condition const&, int const*, unsigned int, OT::ItemVarStoreInstancer*)
4314
4315
struct ConditionList
4316
{
4317
  const Condition& operator[] (unsigned i) const
4318
0
  { return this+conditions[i]; }
4319
4320
  bool sanitize (hb_sanitize_context_t *c) const
4321
0
  {
4322
0
    TRACE_SANITIZE (this);
4323
0
    return_trace (conditions.sanitize (c, this));
4324
0
  }
4325
4326
  protected:
4327
  Array32OfOffset32To<Condition> conditions;
4328
  public:
4329
  DEFINE_SIZE_ARRAY (4, conditions);
4330
};
4331
4332
struct ConditionSet
4333
{
4334
  bool evaluate (const int *coords, unsigned int coord_len,
4335
     ItemVarStoreInstancer *instancer) const
4336
0
  {
4337
0
    unsigned int count = conditions.len;
4338
0
    for (unsigned int i = 0; i < count; i++)
4339
0
      if (!(this+conditions.arrayZ[i]).evaluate (coords, coord_len, instancer))
4340
0
  return false;
4341
0
    return true;
4342
0
  }
4343
4344
  void keep_with_variations (hb_collect_feature_substitutes_with_var_context_t *c) const
4345
0
  {
4346
0
    hb_map_t *condition_map = hb_map_create ();
4347
0
    if (unlikely (!condition_map)) return;
4348
0
    hb::shared_ptr<hb_map_t> p {condition_map};
4349
0
4350
0
    hb_set_t *cond_set = hb_set_create ();
4351
0
    if (unlikely (!cond_set)) return;
4352
0
    hb::shared_ptr<hb_set_t> s {cond_set};
4353
0
4354
0
    c->apply = true;
4355
0
    bool should_keep = false;
4356
0
    unsigned num_kept_cond = 0, cond_idx = 0;
4357
0
    for (const auto& offset : conditions)
4358
0
    {
4359
0
      Cond_with_Var_flag_t ret = (this+offset).keep_with_variations (c, condition_map);
4360
0
      // condition is not met or condition out of range, drop the entire record
4361
0
      if (ret == DROP_RECORD_WITH_VAR)
4362
0
        return;
4363
0
4364
0
      if (ret == KEEP_COND_WITH_VAR)
4365
0
      {
4366
0
        should_keep = true;
4367
0
        cond_set->add (cond_idx);
4368
0
        num_kept_cond++;
4369
0
      }
4370
0
4371
0
      if (ret == KEEP_RECORD_WITH_VAR)
4372
0
        should_keep = true;
4373
0
4374
0
      cond_idx++;
4375
0
    }
4376
0
4377
0
    if (!should_keep) return;
4378
0
4379
0
    //check if condition_set is unique with variations
4380
0
    if (c->conditionset_map->has (p))
4381
0
      //duplicate found, drop the entire record
4382
0
      return;
4383
0
4384
0
    c->conditionset_map->set (p, 1);
4385
0
    c->record_cond_idx_map->set (c->cur_record_idx, s);
4386
0
    if (should_keep && num_kept_cond == 0)
4387
0
      c->universal = true;
4388
0
  }
4389
4390
  bool subset (hb_subset_context_t *c,
4391
               hb_subset_layout_context_t *l,
4392
               bool insert_catch_all) const
4393
0
  {
4394
0
    TRACE_SUBSET (this);
4395
0
    auto *out = c->serializer->start_embed (this);
4396
0
    if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false);
4397
0
4398
0
    if (insert_catch_all) return_trace (true);
4399
0
4400
0
    hb_set_t *retained_cond_set = nullptr;
4401
0
    if (l->feature_record_cond_idx_map != nullptr)
4402
0
      retained_cond_set = l->feature_record_cond_idx_map->get (l->cur_feature_var_record_idx);
4403
0
4404
0
    unsigned int count = conditions.len;
4405
0
    for (unsigned int i = 0; i < count; i++)
4406
0
    {
4407
0
      if (retained_cond_set != nullptr && !retained_cond_set->has (i))
4408
0
        continue;
4409
0
      subset_offset_array (c, out->conditions, this) (conditions[i]);
4410
0
    }
4411
0
4412
0
    return_trace (bool (out->conditions));
4413
0
  }
4414
4415
  bool sanitize (hb_sanitize_context_t *c) const
4416
0
  {
4417
0
    TRACE_SANITIZE (this);
4418
0
    return_trace (conditions.sanitize (c, this));
4419
0
  }
4420
4421
  protected:
4422
  Array16OfOffset32To<Condition>  conditions;
4423
  public:
4424
  DEFINE_SIZE_ARRAY (2, conditions);
4425
};
4426
4427
struct FeatureTableSubstitutionRecord
4428
{
4429
  friend struct FeatureTableSubstitution;
4430
4431
  void collect_lookups (const void *base, hb_set_t *lookup_indexes /* OUT */) const
4432
0
  {
4433
0
    return (base+feature).add_lookup_indexes_to (lookup_indexes);
4434
0
  }
4435
4436
  void closure_features (const void *base,
4437
       const hb_map_t *lookup_indexes,
4438
       hb_set_t       *feature_indexes /* OUT */) const
4439
0
  {
4440
0
    if ((base+feature).intersects_lookup_indexes (lookup_indexes))
4441
0
      feature_indexes->add (featureIndex);
4442
0
  }
4443
4444
  void collect_feature_substitutes_with_variations (hb_hashmap_t<unsigned, const Feature*> *feature_substitutes_map,
4445
                                                    hb_set_t& catch_all_record_feature_idxes,
4446
                                                    const hb_set_t *feature_indices,
4447
                                                    const void *base) const
4448
0
  {
4449
0
    if (feature_indices->has (featureIndex))
4450
0
    {
4451
0
      feature_substitutes_map->set (featureIndex, &(base+feature));
4452
0
      catch_all_record_feature_idxes.add (featureIndex);
4453
0
    }
4454
0
  }
4455
4456
  bool serialize (hb_subset_layout_context_t *c,
4457
                  unsigned feature_index,
4458
                  const Feature *f, const Tag *tag)
4459
0
  {
4460
0
    TRACE_SERIALIZE (this);
4461
0
    hb_serialize_context_t *s = c->subset_context->serializer;
4462
0
    if (unlikely (!s->extend_min (this))) return_trace (false);
4463
0
4464
0
    uint32_t *new_feature_idx;
4465
0
    if (!c->feature_map_w_duplicates->has (feature_index, &new_feature_idx))
4466
0
      return_trace (false);
4467
0
4468
0
    if (!s->check_assign (featureIndex, *new_feature_idx, HB_SERIALIZE_ERROR_INT_OVERFLOW))
4469
0
      return_trace (false);
4470
0
4471
0
    s->push ();
4472
0
    bool ret = f->subset (c->subset_context, c, tag);
4473
0
    if (ret) s->add_link (feature, s->pop_pack ());
4474
0
    else s->pop_discard ();
4475
0
4476
0
    return_trace (ret);
4477
0
  }
4478
4479
  bool subset (hb_subset_layout_context_t *c, const void *base) const
4480
0
  {
4481
0
    TRACE_SUBSET (this);
4482
0
    uint32_t *new_feature_index;
4483
0
    if (!c->feature_map_w_duplicates->has (featureIndex, &new_feature_index))
4484
0
      return_trace (false);
4485
0
4486
0
    auto *out = c->subset_context->serializer->embed (this);
4487
0
    if (unlikely (!out)) return_trace (false);
4488
0
4489
0
    out->featureIndex = *new_feature_index;
4490
0
    return_trace (out->feature.serialize_subset (c->subset_context, feature, base, c));
4491
0
  }
4492
4493
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
4494
0
  {
4495
0
    TRACE_SANITIZE (this);
4496
0
    return_trace (c->check_struct (this) && feature.sanitize (c, base));
4497
0
  }
4498
4499
  protected:
4500
  HBUINT16    featureIndex;
4501
  Offset32To<Feature> feature;
4502
  public:
4503
  DEFINE_SIZE_STATIC (6);
4504
};
4505
4506
struct FeatureTableSubstitution
4507
{
4508
  const Feature *find_substitute (unsigned int feature_index) const
4509
0
  {
4510
0
    unsigned int count = substitutions.len;
4511
0
    for (unsigned int i = 0; i < count; i++)
4512
0
    {
4513
0
      const FeatureTableSubstitutionRecord &record = substitutions.arrayZ[i];
4514
0
      if (record.featureIndex == feature_index)
4515
0
  return &(this+record.feature);
4516
0
    }
4517
0
    return nullptr;
4518
0
  }
4519
4520
  void collect_lookups (const hb_set_t *feature_indexes,
4521
      hb_set_t       *lookup_indexes /* OUT */) const
4522
0
  {
4523
0
    + hb_iter (substitutions)
4524
0
    | hb_filter (feature_indexes, &FeatureTableSubstitutionRecord::featureIndex)
4525
0
    | hb_apply ([this, lookup_indexes] (const FeatureTableSubstitutionRecord& r)
4526
0
    { r.collect_lookups (this, lookup_indexes); })
4527
0
    ;
4528
0
  }
4529
4530
  void closure_features (const hb_map_t *lookup_indexes,
4531
       hb_set_t       *feature_indexes /* OUT */) const
4532
0
  {
4533
0
    for (const FeatureTableSubstitutionRecord& record : substitutions)
4534
0
      record.closure_features (this, lookup_indexes, feature_indexes);
4535
0
  }
4536
4537
  bool intersects_features (const hb_map_t *feature_index_map) const
4538
0
  {
4539
0
    for (const FeatureTableSubstitutionRecord& record : substitutions)
4540
0
    {
4541
0
      if (feature_index_map->has (record.featureIndex)) return true;
4542
0
    }
4543
0
    return false;
4544
0
  }
4545
4546
  void collect_feature_substitutes_with_variations (hb_collect_feature_substitutes_with_var_context_t *c) const
4547
0
  {
4548
0
    for (const FeatureTableSubstitutionRecord& record : substitutions)
4549
0
      record.collect_feature_substitutes_with_variations (c->feature_substitutes_map,
4550
0
                                                          c->catch_all_record_feature_idxes,
4551
0
                                                          c->feature_indices, this);
4552
0
  }
4553
4554
  bool subset (hb_subset_context_t        *c,
4555
         hb_subset_layout_context_t *l,
4556
               bool insert_catch_all) const
4557
0
  {
4558
0
    TRACE_SUBSET (this);
4559
0
    auto *out = c->serializer->start_embed (*this);
4560
0
    if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false);
4561
0
4562
0
    out->version.major = version.major;
4563
0
    out->version.minor = version.minor;
4564
0
4565
0
    if (insert_catch_all)
4566
0
    {
4567
0
      for (unsigned feature_index : *(l->catch_all_record_feature_idxes))
4568
0
      {
4569
0
        hb_pair_t<const void*, const void*> *p;
4570
0
        if (!l->feature_idx_tag_map->has (feature_index, &p))
4571
0
          return_trace (false);
4572
0
        auto *o = out->substitutions.serialize_append (c->serializer);
4573
0
        if (!o->serialize (l, feature_index,
4574
0
                           reinterpret_cast<const Feature*> (p->first),
4575
0
                           reinterpret_cast<const Tag*> (p->second)))
4576
0
          return_trace (false);
4577
0
      }
4578
0
      return_trace (true);
4579
0
    }
4580
0
4581
0
    + substitutions.iter ()
4582
0
    | hb_apply (subset_record_array (l, &(out->substitutions), this))
4583
0
    ;
4584
0
4585
0
    return_trace (bool (out->substitutions));
4586
0
  }
4587
4588
  bool sanitize (hb_sanitize_context_t *c) const
4589
0
  {
4590
0
    TRACE_SANITIZE (this);
4591
0
    return_trace (version.sanitize (c) &&
4592
0
      hb_barrier () &&
4593
0
      likely (version.major == 1) &&
4594
0
      substitutions.sanitize (c, this));
4595
0
  }
4596
4597
  protected:
4598
  FixedVersion<>  version;  /* Version--0x00010000u */
4599
  Array16Of<FeatureTableSubstitutionRecord>
4600
      substitutions;
4601
  public:
4602
  DEFINE_SIZE_ARRAY (6, substitutions);
4603
};
4604
4605
struct FeatureVariationRecord
4606
{
4607
  friend struct FeatureVariations;
4608
4609
  void collect_lookups (const void     *base,
4610
      const hb_set_t *feature_indexes,
4611
      hb_set_t       *lookup_indexes /* OUT */) const
4612
0
  {
4613
0
    return (base+substitutions).collect_lookups (feature_indexes, lookup_indexes);
4614
0
  }
4615
4616
  void closure_features (const void     *base,
4617
       const hb_map_t *lookup_indexes,
4618
       hb_set_t       *feature_indexes /* OUT */) const
4619
0
  {
4620
0
    (base+substitutions).closure_features (lookup_indexes, feature_indexes);
4621
0
  }
4622
4623
  bool intersects_features (const void *base, const hb_map_t *feature_index_map) const
4624
0
  {
4625
0
    return (base+substitutions).intersects_features (feature_index_map);
4626
0
  }
4627
4628
  void collect_feature_substitutes_with_variations (hb_collect_feature_substitutes_with_var_context_t *c,
4629
                                                    const void *base) const
4630
0
  {
4631
0
    (base+conditions).keep_with_variations (c);
4632
0
    if (c->apply && !c->variation_applied)
4633
0
    {
4634
0
      (base+substitutions).collect_feature_substitutes_with_variations (c);
4635
0
      c->variation_applied = true; // set variations only once
4636
0
    }
4637
0
  }
4638
4639
  bool subset (hb_subset_layout_context_t *c, const void *base,
4640
               bool insert_catch_all = false) const
4641
0
  {
4642
0
    TRACE_SUBSET (this);
4643
0
    auto *out = c->subset_context->serializer->embed (this);
4644
0
    if (unlikely (!out)) return_trace (false);
4645
0
4646
0
    out->conditions.serialize_subset (c->subset_context, conditions, base, c, insert_catch_all);
4647
0
    out->substitutions.serialize_subset (c->subset_context, substitutions, base, c, insert_catch_all);
4648
0
4649
0
    return_trace (true);
4650
0
  }
4651
4652
  bool sanitize (hb_sanitize_context_t *c, const void *base) const
4653
0
  {
4654
0
    TRACE_SANITIZE (this);
4655
0
    return_trace (conditions.sanitize (c, base) &&
4656
0
      substitutions.sanitize (c, base));
4657
0
  }
4658
4659
  protected:
4660
  Offset32To<ConditionSet>
4661
      conditions;
4662
  Offset32To<FeatureTableSubstitution>
4663
      substitutions;
4664
  public:
4665
  DEFINE_SIZE_STATIC (8);
4666
};
4667
4668
struct FeatureVariations
4669
{
4670
  static constexpr unsigned NOT_FOUND_INDEX = 0xFFFFFFFFu;
4671
4672
  bool find_index (const int *coords, unsigned int coord_len,
4673
       unsigned int *index,
4674
       ItemVarStoreInstancer *instancer) const
4675
345k
  {
4676
345k
    unsigned int count = varRecords.len;
4677
345k
    for (unsigned int i = 0; i < count; i++)
4678
0
    {
4679
0
      const FeatureVariationRecord &record = varRecords.arrayZ[i];
4680
0
      if ((this+record.conditions).evaluate (coords, coord_len, instancer))
4681
0
      {
4682
0
  *index = i;
4683
0
  return true;
4684
0
      }
4685
0
    }
4686
345k
    *index = NOT_FOUND_INDEX;
4687
345k
    return false;
4688
345k
  }
4689
4690
  const Feature *find_substitute (unsigned int variations_index,
4691
          unsigned int feature_index) const
4692
0
  {
4693
0
    const FeatureVariationRecord &record = varRecords[variations_index];
4694
0
    return (this+record.substitutions).find_substitute (feature_index);
4695
0
  }
4696
4697
  void collect_feature_substitutes_with_variations (hb_collect_feature_substitutes_with_var_context_t *c) const
4698
0
  {
4699
0
    unsigned int count = varRecords.len;
4700
0
    for (unsigned int i = 0; i < count; i++)
4701
0
    {
4702
0
      c->cur_record_idx = i;
4703
0
      varRecords[i].collect_feature_substitutes_with_variations (c, this);
4704
0
      if (c->universal)
4705
0
        break;
4706
0
    }
4707
0
    if (c->universal || c->record_cond_idx_map->is_empty ())
4708
0
      c->catch_all_record_feature_idxes.reset ();
4709
0
  }
4710
4711
  FeatureVariations* copy (hb_serialize_context_t *c) const
4712
0
  {
4713
0
    TRACE_SERIALIZE (this);
4714
0
    return_trace (c->embed (*this));
4715
0
  }
4716
4717
  void collect_lookups (const hb_set_t *feature_indexes,
4718
      const hb_hashmap_t<unsigned, hb::shared_ptr<hb_set_t>> *feature_record_cond_idx_map,
4719
      hb_set_t       *lookup_indexes /* OUT */) const
4720
0
  {
4721
0
    unsigned count = varRecords.len;
4722
0
    for (unsigned int i = 0; i < count; i++)
4723
0
    {
4724
0
      if (feature_record_cond_idx_map &&
4725
0
          !feature_record_cond_idx_map->has (i))
4726
0
        continue;
4727
0
      varRecords[i].collect_lookups (this, feature_indexes, lookup_indexes);
4728
0
    }
4729
0
  }
4730
4731
  void closure_features (const hb_map_t *lookup_indexes,
4732
       const hb_hashmap_t<unsigned, hb::shared_ptr<hb_set_t>> *feature_record_cond_idx_map,
4733
       hb_set_t       *feature_indexes /* OUT */) const
4734
0
  {
4735
0
    unsigned int count = varRecords.len;
4736
0
    for (unsigned int i = 0; i < count; i++)
4737
0
    {
4738
0
      if (feature_record_cond_idx_map != nullptr &&
4739
0
          !feature_record_cond_idx_map->has (i))
4740
0
        continue;
4741
0
      varRecords[i].closure_features (this, lookup_indexes, feature_indexes);
4742
0
    }
4743
0
  }
4744
4745
  bool subset (hb_subset_context_t *c,
4746
         hb_subset_layout_context_t *l) const
4747
0
  {
4748
0
    TRACE_SUBSET (this);
4749
0
    auto *out = c->serializer->start_embed (*this);
4750
0
    if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false);
4751
0
4752
0
    out->version.major = version.major;
4753
0
    out->version.minor = version.minor;
4754
0
4755
0
    int keep_up_to = -1;
4756
0
    for (int i = varRecords.len - 1; i >= 0; i--) {
4757
0
      if (varRecords[i].intersects_features (this, l->feature_map_w_duplicates)) {
4758
0
        keep_up_to = i;
4759
0
        break;
4760
0
      }
4761
0
    }
4762
0
4763
0
    unsigned count = (unsigned) (keep_up_to + 1);
4764
0
    for (unsigned i = 0; i < count; i++)
4765
0
    {
4766
0
      if (l->feature_record_cond_idx_map != nullptr &&
4767
0
          !l->feature_record_cond_idx_map->has (i))
4768
0
        continue;
4769
0
4770
0
      l->cur_feature_var_record_idx = i;
4771
0
      subset_record_array (l, &(out->varRecords), this) (varRecords[i]);
4772
0
    }
4773
0
4774
0
    if (out->varRecords.len && !l->catch_all_record_feature_idxes->is_empty ())
4775
0
    {
4776
0
      bool insert_catch_all_record = true;
4777
0
      subset_record_array (l, &(out->varRecords), this, insert_catch_all_record) (varRecords[0]);
4778
0
    }
4779
0
4780
0
    return_trace (bool (out->varRecords));
4781
0
  }
4782
4783
  bool sanitize (hb_sanitize_context_t *c) const
4784
0
  {
4785
0
    TRACE_SANITIZE (this);
4786
0
    return_trace (version.sanitize (c) &&
4787
0
      hb_barrier () &&
4788
0
      likely (version.major == 1) &&
4789
0
      varRecords.sanitize (c, this));
4790
0
  }
4791
4792
  protected:
4793
  FixedVersion<>  version;  /* Version--0x00010000u */
4794
  Array32Of<FeatureVariationRecord>
4795
      varRecords;
4796
  public:
4797
  DEFINE_SIZE_ARRAY_SIZED (8, varRecords);
4798
};
4799
4800
4801
/*
4802
 * Device Tables
4803
 */
4804
4805
struct HintingDevice
4806
{
4807
  friend struct Device;
4808
4809
  private:
4810
4811
  hb_position_t get_x_delta (hb_font_t *font) const
4812
0
  { return get_delta (font->x_ppem, font->x_scale); }
4813
4814
  hb_position_t get_y_delta (hb_font_t *font) const
4815
0
  { return get_delta (font->y_ppem, font->y_scale); }
4816
4817
  public:
4818
4819
  unsigned int get_size () const
4820
0
  {
4821
0
    unsigned int f = deltaFormat;
4822
0
    if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * HBUINT16::static_size;
4823
0
    return HBUINT16::static_size * (4 + ((endSize - startSize) >> (4 - f)));
4824
0
  }
4825
4826
  bool sanitize (hb_sanitize_context_t *c) const
4827
0
  {
4828
0
    TRACE_SANITIZE (this);
4829
0
    return_trace (c->check_struct (this) && c->check_range (this, this->get_size ()));
4830
0
  }
4831
4832
  HintingDevice* copy (hb_serialize_context_t *c) const
4833
0
  {
4834
0
    TRACE_SERIALIZE (this);
4835
0
    return_trace (c->embed<HintingDevice> (this));
4836
0
  }
4837
4838
  private:
4839
4840
  int get_delta (unsigned int ppem, int scale) const
4841
0
  {
4842
0
    if (!ppem) return 0;
4843
4844
0
    int pixels = get_delta_pixels (ppem);
4845
4846
0
    if (!pixels) return 0;
4847
4848
0
    return (int) (pixels * (int64_t) scale / ppem);
4849
0
  }
4850
  int get_delta_pixels (unsigned int ppem_size) const
4851
0
  {
4852
0
    unsigned int f = deltaFormat;
4853
0
    if (unlikely (f < 1 || f > 3))
4854
0
      return 0;
4855
4856
0
    if (ppem_size < startSize || ppem_size > endSize)
4857
0
      return 0;
4858
4859
0
    unsigned int s = ppem_size - startSize;
4860
4861
0
    unsigned int byte = deltaValueZ[s >> (4 - f)];
4862
0
    unsigned int bits = (byte >> (16 - (((s & ((1 << (4 - f)) - 1)) + 1) << f)));
4863
0
    unsigned int mask = (0xFFFFu >> (16 - (1 << f)));
4864
4865
0
    int delta = bits & mask;
4866
4867
0
    if ((unsigned int) delta >= ((mask + 1) >> 1))
4868
0
      delta -= mask + 1;
4869
4870
0
    return delta;
4871
0
  }
4872
4873
  protected:
4874
  HBUINT16  startSize;    /* Smallest size to correct--in ppem */
4875
  HBUINT16  endSize;    /* Largest size to correct--in ppem */
4876
  HBUINT16  deltaFormat;    /* Format of DeltaValue array data: 1, 2, or 3
4877
           * 1  Signed 2-bit value, 8 values per uint16
4878
           * 2  Signed 4-bit value, 4 values per uint16
4879
           * 3  Signed 8-bit value, 2 values per uint16
4880
           */
4881
  UnsizedArrayOf<HBUINT16>
4882
    deltaValueZ;    /* Array of compressed data */
4883
  public:
4884
  DEFINE_SIZE_ARRAY (6, deltaValueZ);
4885
};
4886
4887
struct VariationDevice
4888
{
4889
  friend struct Device;
4890
4891
  private:
4892
4893
  hb_position_t get_x_delta (hb_font_t *font,
4894
           const ItemVariationStore &store,
4895
           hb_scalar_cache_t *store_cache = nullptr) const
4896
0
  { return !font->has_nonzero_coords ? 0 : font->em_scalef_x (get_delta (font, store, store_cache)); }
4897
4898
  hb_position_t get_y_delta (hb_font_t *font,
4899
           const ItemVariationStore &store,
4900
           hb_scalar_cache_t *store_cache = nullptr) const
4901
0
  { return !font->has_nonzero_coords ? 0 : font->em_scalef_y (get_delta (font, store, store_cache)); }
4902
4903
  VariationDevice* copy (hb_serialize_context_t *c,
4904
                         const hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> *layout_variation_idx_delta_map) const
4905
0
  {
4906
0
    TRACE_SERIALIZE (this);
4907
0
    if (!layout_variation_idx_delta_map) return_trace (nullptr);
4908
0
4909
0
    hb_pair_t<unsigned, int> *v;
4910
0
    if (!layout_variation_idx_delta_map->has (varIdx, &v))
4911
0
      return_trace (nullptr);
4912
0
4913
0
    c->start_zerocopy (this->static_size);
4914
0
    auto *out = c->embed (this);
4915
0
    if (unlikely (!out)) return_trace (nullptr);
4916
0
4917
0
    if (!c->check_assign (out->varIdx, hb_first (*v), HB_SERIALIZE_ERROR_INT_OVERFLOW))
4918
0
      return_trace (nullptr);
4919
0
    return_trace (out);
4920
0
  }
4921
4922
  void collect_variation_index (hb_collect_variation_indices_context_t *c) const
4923
0
  { c->layout_variation_indices->add (varIdx); }
4924
4925
  bool sanitize (hb_sanitize_context_t *c) const
4926
0
  {
4927
0
    TRACE_SANITIZE (this);
4928
0
    return_trace (c->check_struct (this));
4929
0
  }
4930
4931
  private:
4932
4933
  float get_delta (hb_font_t *font,
4934
       const ItemVariationStore &store,
4935
       hb_scalar_cache_t *store_cache = nullptr) const
4936
0
  {
4937
0
    return store.get_delta (varIdx, font->coords, font->num_coords, store_cache);
4938
0
  }
4939
4940
  protected:
4941
  VarIdx  varIdx;   /* Variation index */
4942
  HBUINT16  deltaFormat;  /* Format identifier for this table: 0x0x8000 */
4943
  public:
4944
  DEFINE_SIZE_STATIC (6);
4945
};
4946
4947
struct DeviceHeader
4948
{
4949
  protected:
4950
  HBUINT16    reserved1;
4951
  HBUINT16    reserved2;
4952
  public:
4953
  HBUINT16    format;   /* Format identifier */
4954
  public:
4955
  DEFINE_SIZE_STATIC (6);
4956
};
4957
4958
struct Device
4959
{
4960
  hb_position_t get_x_delta (hb_font_t *font,
4961
           const ItemVariationStore &store=Null (ItemVariationStore),
4962
           hb_scalar_cache_t *store_cache = nullptr) const
4963
0
  {
4964
0
    switch (u.b.format)
4965
0
    {
4966
0
#ifndef HB_NO_HINTING
4967
0
    case 1: case 2: case 3:
4968
0
      return u.hinting.get_x_delta (font);
4969
0
#endif
4970
0
#ifndef HB_NO_VAR
4971
0
    case 0x8000:
4972
0
      return u.variation.get_x_delta (font, store, store_cache);
4973
0
#endif
4974
0
    default:
4975
0
      return 0;
4976
0
    }
4977
0
  }
4978
  hb_position_t get_y_delta (hb_font_t *font,
4979
           const ItemVariationStore &store=Null (ItemVariationStore),
4980
           hb_scalar_cache_t *store_cache = nullptr) const
4981
0
  {
4982
0
    switch (u.b.format)
4983
0
    {
4984
0
    case 1: case 2: case 3:
4985
0
#ifndef HB_NO_HINTING
4986
0
      return u.hinting.get_y_delta (font);
4987
0
#endif
4988
0
#ifndef HB_NO_VAR
4989
0
    case 0x8000:
4990
0
      return u.variation.get_y_delta (font, store, store_cache);
4991
0
#endif
4992
0
    default:
4993
0
      return 0;
4994
0
    }
4995
0
  }
4996
4997
  bool sanitize (hb_sanitize_context_t *c) const
4998
0
  {
4999
0
    TRACE_SANITIZE (this);
5000
0
    if (!u.b.format.sanitize (c)) return_trace (false);
5001
0
    switch (u.b.format) {
5002
0
#ifndef HB_NO_HINTING
5003
0
    case 1: case 2: case 3:
5004
0
      return_trace (u.hinting.sanitize (c));
5005
0
#endif
5006
0
#ifndef HB_NO_VAR
5007
0
    case 0x8000:
5008
0
      return_trace (u.variation.sanitize (c));
5009
0
#endif
5010
0
    default:
5011
0
      return_trace (true);
5012
0
    }
5013
0
  }
5014
5015
  Device* copy (hb_serialize_context_t *c,
5016
                const hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> *layout_variation_idx_delta_map=nullptr) const
5017
0
  {
5018
0
    TRACE_SERIALIZE (this);
5019
0
    switch (u.b.format) {
5020
0
#ifndef HB_NO_HINTING
5021
0
    case 1:
5022
0
    case 2:
5023
0
    case 3:
5024
0
      return_trace (reinterpret_cast<Device *> (u.hinting.copy (c)));
5025
0
#endif
5026
0
#ifndef HB_NO_VAR
5027
0
    case 0x8000:
5028
0
      return_trace (reinterpret_cast<Device *> (u.variation.copy (c, layout_variation_idx_delta_map)));
5029
0
#endif
5030
0
    default:
5031
0
      return_trace (nullptr);
5032
0
    }
5033
0
  }
5034
5035
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const
5036
0
  {
5037
0
    switch (u.b.format) {
5038
0
#ifndef HB_NO_HINTING
5039
0
    case 1:
5040
0
    case 2:
5041
0
    case 3:
5042
0
      return;
5043
0
#endif
5044
0
#ifndef HB_NO_VAR
5045
0
    case 0x8000:
5046
0
      u.variation.collect_variation_index (c);
5047
0
      return;
5048
0
#endif
5049
0
    default:
5050
0
      return;
5051
0
    }
5052
0
  }
5053
5054
  unsigned get_variation_index () const
5055
0
  {
5056
0
    switch (u.b.format) {
5057
0
#ifndef HB_NO_VAR
5058
0
    case 0x8000:
5059
0
      return u.variation.varIdx;
5060
0
#endif
5061
0
    default:
5062
0
      return HB_OT_LAYOUT_NO_VARIATIONS_INDEX;
5063
0
    }
5064
0
  }
5065
5066
  bool is_variation_device () const
5067
0
  {
5068
0
    switch (u.b.format) {
5069
0
#ifndef HB_NO_VAR
5070
0
    case 0x8000:
5071
0
      return true;
5072
0
#endif
5073
0
    default:
5074
0
      return false;
5075
0
    }
5076
0
  }
5077
5078
  protected:
5079
  union {
5080
  DeviceHeader    b;
5081
  HintingDevice   hinting;
5082
#ifndef HB_NO_VAR
5083
  VariationDevice variation;
5084
#endif
5085
  } u;
5086
  public:
5087
  DEFINE_SIZE_UNION (6, b);
5088
};
5089
5090
5091
} /* namespace OT */
5092
5093
5094
#endif /* HB_OT_LAYOUT_COMMON_HH */