Coverage Report

Created: 2024-05-16 11:00

/src/harfbuzz/src/hb-ot-layout-gsubgpos.hh
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright © 2007,2008,2009,2010  Red Hat, Inc.
3
 * Copyright © 2010,2012  Google, Inc.
4
 *
5
 *  This is part of HarfBuzz, a text shaping library.
6
 *
7
 * Permission is hereby granted, without written agreement and without
8
 * license or royalty fees, to use, copy, modify, and distribute this
9
 * software and its documentation for any purpose, provided that the
10
 * above copyright notice and the following two paragraphs appear in
11
 * all copies of this software.
12
 *
13
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
17
 * DAMAGE.
18
 *
19
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
22
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24
 *
25
 * Red Hat Author(s): Behdad Esfahbod
26
 * Google Author(s): Behdad Esfahbod
27
 */
28
29
#ifndef HB_OT_LAYOUT_GSUBGPOS_HH
30
#define HB_OT_LAYOUT_GSUBGPOS_HH
31
32
#include "hb.hh"
33
#include "hb-buffer.hh"
34
#include "hb-map.hh"
35
#include "hb-set.hh"
36
#include "hb-ot-map.hh"
37
#include "hb-ot-layout-common.hh"
38
#include "hb-ot-layout-gdef-table.hh"
39
40
41
namespace OT {
42
43
44
struct hb_intersects_context_t :
45
       hb_dispatch_context_t<hb_intersects_context_t, bool>
46
{
47
  template <typename T>
48
0
  return_t dispatch (const T &obj) { return obj.intersects (this->glyphs); }
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::Layout::GPOS_impl::SinglePosFormat1 const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::Layout::GPOS_impl::SinglePosFormat2 const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::Layout::GPOS_impl::CursivePosFormat1 const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::MediumTypes> >(OT::ContextFormat1_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::MediumTypes> >(OT::ContextFormat2_5<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::MediumTypes> >(OT::ChainContextFormat1_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::MediumTypes> >(OT::ChainContextFormat2_5<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_intersects_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
49
0
  static return_t default_return_value () { return false; }
50
0
  bool stop_sublookup_iteration (return_t r) const { return r; }
51
52
  const hb_set_t *glyphs;
53
54
  hb_intersects_context_t (const hb_set_t *glyphs_) :
55
0
                            glyphs (glyphs_) {}
56
};
57
58
struct hb_have_non_1to1_context_t :
59
       hb_dispatch_context_t<hb_have_non_1to1_context_t, bool>
60
{
61
  template <typename T>
62
0
  return_t dispatch (const T &obj) { return obj.may_have_non_1to1 (); }
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::MediumTypes> >(OT::ContextFormat1_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::MediumTypes> >(OT::ContextFormat2_5<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::MediumTypes> >(OT::ChainContextFormat1_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::MediumTypes> >(OT::ChainContextFormat2_5<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_have_non_1to1_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
63
0
  static return_t default_return_value () { return false; }
64
0
  bool stop_sublookup_iteration (return_t r) const { return r; }
65
};
66
67
struct hb_closure_context_t :
68
       hb_dispatch_context_t<hb_closure_context_t>
69
{
70
  typedef return_t (*recurse_func_t) (hb_closure_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indicies, unsigned seq_index, unsigned end_index);
71
  template <typename T>
72
0
  return_t dispatch (const T &obj) { obj.closure (this); return hb_empty_t (); }
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::MediumTypes> >(OT::ContextFormat1_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::MediumTypes> >(OT::ContextFormat2_5<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::MediumTypes> >(OT::ChainContextFormat1_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::MediumTypes> >(OT::ChainContextFormat2_5<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
73
0
  static return_t default_return_value () { return hb_empty_t (); }
74
  void recurse (unsigned lookup_index, hb_set_t *covered_seq_indicies, unsigned seq_index, unsigned end_index)
75
0
  {
76
0
    if (unlikely (nesting_level_left == 0 || !recurse_func))
77
0
      return;
78
79
0
    nesting_level_left--;
80
0
    recurse_func (this, lookup_index, covered_seq_indicies, seq_index, end_index);
81
0
    nesting_level_left++;
82
0
  }
83
84
  void reset_lookup_visit_count ()
85
0
  { lookup_count = 0; }
86
87
  bool lookup_limit_exceeded ()
88
0
  { return lookup_count > HB_MAX_LOOKUP_VISIT_COUNT; }
89
90
  bool should_visit_lookup (unsigned int lookup_index)
91
0
  {
92
0
    if (lookup_count++ > HB_MAX_LOOKUP_VISIT_COUNT)
93
0
      return false;
94
95
0
    if (is_lookup_done (lookup_index))
96
0
      return false;
97
98
0
    return true;
99
0
  }
100
101
  bool is_lookup_done (unsigned int lookup_index)
102
0
  {
103
0
    if (unlikely (done_lookups_glyph_count->in_error () ||
104
0
      done_lookups_glyph_set->in_error ()))
105
0
      return true;
106
107
    /* Have we visited this lookup with the current set of glyphs? */
108
0
    if (done_lookups_glyph_count->get (lookup_index) != glyphs->get_population ())
109
0
    {
110
0
      done_lookups_glyph_count->set (lookup_index, glyphs->get_population ());
111
112
0
      if (!done_lookups_glyph_set->has (lookup_index))
113
0
      {
114
0
  if (unlikely (!done_lookups_glyph_set->set (lookup_index, hb::unique_ptr<hb_set_t> {hb_set_create ()})))
115
0
    return true;
116
0
      }
117
118
0
      done_lookups_glyph_set->get (lookup_index)->clear ();
119
0
    }
120
121
0
    hb_set_t *covered_glyph_set = done_lookups_glyph_set->get (lookup_index);
122
0
    if (unlikely (covered_glyph_set->in_error ()))
123
0
      return true;
124
0
    if (parent_active_glyphs ().is_subset (*covered_glyph_set))
125
0
      return true;
126
127
0
    covered_glyph_set->union_ (parent_active_glyphs ());
128
0
    return false;
129
0
  }
130
131
0
  const hb_set_t& previous_parent_active_glyphs () {
132
0
    if (active_glyphs_stack.length <= 1)
133
0
      return *glyphs;
134
135
0
    return active_glyphs_stack[active_glyphs_stack.length - 2];
136
0
  }
137
138
  const hb_set_t& parent_active_glyphs ()
139
0
  {
140
0
    if (!active_glyphs_stack)
141
0
      return *glyphs;
142
143
0
    return active_glyphs_stack.tail ();
144
0
  }
145
146
  hb_set_t& push_cur_active_glyphs ()
147
0
  {
148
0
    return *active_glyphs_stack.push ();
149
0
  }
150
151
  bool pop_cur_done_glyphs ()
152
0
  {
153
0
    if (!active_glyphs_stack)
154
0
      return false;
155
156
0
    active_glyphs_stack.pop ();
157
0
    return true;
158
0
  }
159
160
  hb_face_t *face;
161
  hb_set_t *glyphs;
162
  hb_set_t output[1];
163
  hb_vector_t<hb_set_t> active_glyphs_stack;
164
  recurse_func_t recurse_func = nullptr;
165
  unsigned int nesting_level_left;
166
167
  hb_closure_context_t (hb_face_t *face_,
168
      hb_set_t *glyphs_,
169
      hb_map_t *done_lookups_glyph_count_,
170
      hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *done_lookups_glyph_set_,
171
      unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
172
        face (face_),
173
        glyphs (glyphs_),
174
        nesting_level_left (nesting_level_left_),
175
        done_lookups_glyph_count (done_lookups_glyph_count_),
176
        done_lookups_glyph_set (done_lookups_glyph_set_)
177
0
  {}
178
179
0
  ~hb_closure_context_t () { flush (); }
180
181
0
  void set_recurse_func (recurse_func_t func) { recurse_func = func; }
182
183
  void flush ()
184
0
  {
185
0
    output->del_range (face->get_num_glyphs (), HB_SET_VALUE_INVALID);  /* Remove invalid glyphs. */
186
0
    glyphs->union_ (*output);
187
0
    output->clear ();
188
0
    active_glyphs_stack.pop ();
189
0
    active_glyphs_stack.reset ();
190
0
  }
191
192
  private:
193
  hb_map_t *done_lookups_glyph_count;
194
  hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *done_lookups_glyph_set;
195
  unsigned int lookup_count = 0;
196
};
197
198
199
200
struct hb_closure_lookups_context_t :
201
       hb_dispatch_context_t<hb_closure_lookups_context_t>
202
{
203
  typedef return_t (*recurse_func_t) (hb_closure_lookups_context_t *c, unsigned lookup_index);
204
  template <typename T>
205
0
  return_t dispatch (const T &obj) { obj.closure_lookups (this); return hb_empty_t (); }
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::Layout::GPOS_impl::SinglePosFormat1 const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::Layout::GPOS_impl::SinglePosFormat2 const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::Layout::GPOS_impl::CursivePosFormat1 const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::MediumTypes> >(OT::ContextFormat1_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::MediumTypes> >(OT::ContextFormat2_5<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::MediumTypes> >(OT::ChainContextFormat1_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::MediumTypes> >(OT::ChainContextFormat2_5<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_closure_lookups_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
206
0
  static return_t default_return_value () { return hb_empty_t (); }
207
  void recurse (unsigned lookup_index)
208
0
  {
209
0
    if (unlikely (nesting_level_left == 0 || !recurse_func))
210
0
      return;
211
0
212
0
    /* Return if new lookup was recursed to before. */
213
0
    if (lookup_limit_exceeded ()
214
0
        || visited_lookups->in_error ()
215
0
        || visited_lookups->has (lookup_index))
216
0
      // Don't increment lookup count here, that will be done in the call to closure_lookups()
217
0
      // made by recurse_func.
218
0
      return;
219
0
220
0
    nesting_level_left--;
221
0
    recurse_func (this, lookup_index);
222
0
    nesting_level_left++;
223
0
  }
224
225
  void set_lookup_visited (unsigned lookup_index)
226
0
  { visited_lookups->add (lookup_index); }
227
228
  void set_lookup_inactive (unsigned lookup_index)
229
0
  { inactive_lookups->add (lookup_index); }
230
231
  bool lookup_limit_exceeded ()
232
0
  {
233
0
    bool ret = lookup_count > HB_MAX_LOOKUP_VISIT_COUNT;
234
0
    if (ret)
235
0
      DEBUG_MSG (SUBSET, nullptr, "lookup visit count limit exceeded in lookup closure!");
236
0
    return ret; }
237
238
  bool is_lookup_visited (unsigned lookup_index)
239
0
  {
240
0
    if (unlikely (lookup_count++ > HB_MAX_LOOKUP_VISIT_COUNT))
241
0
    {
242
0
      DEBUG_MSG (SUBSET, nullptr, "total visited lookup count %u exceeds max limit, lookup %u is dropped.",
243
0
                 lookup_count, lookup_index);
244
0
      return true;
245
0
    }
246
0
247
0
    if (unlikely (visited_lookups->in_error ()))
248
0
      return true;
249
0
250
0
    return visited_lookups->has (lookup_index);
251
0
  }
252
253
  hb_face_t *face;
254
  const hb_set_t *glyphs;
255
  recurse_func_t recurse_func;
256
  unsigned int nesting_level_left;
257
258
  hb_closure_lookups_context_t (hb_face_t *face_,
259
        const hb_set_t *glyphs_,
260
        hb_set_t *visited_lookups_,
261
        hb_set_t *inactive_lookups_,
262
        unsigned nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
263
        face (face_),
264
        glyphs (glyphs_),
265
        recurse_func (nullptr),
266
        nesting_level_left (nesting_level_left_),
267
        visited_lookups (visited_lookups_),
268
        inactive_lookups (inactive_lookups_),
269
0
        lookup_count (0) {}
270
271
0
  void set_recurse_func (recurse_func_t func) { recurse_func = func; }
272
273
  private:
274
  hb_set_t *visited_lookups;
275
  hb_set_t *inactive_lookups;
276
  unsigned int lookup_count;
277
};
278
279
struct hb_would_apply_context_t :
280
       hb_dispatch_context_t<hb_would_apply_context_t, bool>
281
{
282
  template <typename T>
283
2.71k
  return_t dispatch (const T &obj) { return obj.would_apply (this); }
bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Line
Count
Source
283
174
  return_t dispatch (const T &obj) { return obj.would_apply (this); }
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> const&)
bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Line
Count
Source
283
573
  return_t dispatch (const T &obj) { return obj.would_apply (this); }
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> const&)
bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Line
Count
Source
283
10
  return_t dispatch (const T &obj) { return obj.would_apply (this); }
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> const&)
bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Line
Count
Source
283
1.37k
  return_t dispatch (const T &obj) { return obj.would_apply (this); }
bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> const&)
Line
Count
Source
283
14
  return_t dispatch (const T &obj) { return obj.would_apply (this); }
bool OT::hb_would_apply_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Line
Count
Source
283
136
  return_t dispatch (const T &obj) { return obj.would_apply (this); }
bool OT::hb_would_apply_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Line
Count
Source
283
4
  return_t dispatch (const T &obj) { return obj.would_apply (this); }
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::MediumTypes> >(OT::ContextFormat1_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::MediumTypes> >(OT::ContextFormat2_5<OT::Layout::MediumTypes> const&)
bool OT::hb_would_apply_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Line
Count
Source
283
129
  return_t dispatch (const T &obj) { return obj.would_apply (this); }
bool OT::hb_would_apply_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Line
Count
Source
283
4
  return_t dispatch (const T &obj) { return obj.would_apply (this); }
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::MediumTypes> >(OT::ChainContextFormat1_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_would_apply_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::MediumTypes> >(OT::ChainContextFormat2_5<OT::Layout::MediumTypes> const&)
bool OT::hb_would_apply_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
Line
Count
Source
283
299
  return_t dispatch (const T &obj) { return obj.would_apply (this); }
284
12.4k
  static return_t default_return_value () { return false; }
285
13.4k
  bool stop_sublookup_iteration (return_t r) const { return r; }
286
287
  hb_face_t *face;
288
  const hb_codepoint_t *glyphs;
289
  unsigned int len;
290
  bool zero_context;
291
292
  hb_would_apply_context_t (hb_face_t *face_,
293
          const hb_codepoint_t *glyphs_,
294
          unsigned int len_,
295
          bool zero_context_) :
296
            face (face_),
297
            glyphs (glyphs_),
298
            len (len_),
299
8.99k
            zero_context (zero_context_) {}
300
};
301
302
struct hb_collect_glyphs_context_t :
303
       hb_dispatch_context_t<hb_collect_glyphs_context_t>
304
{
305
  typedef return_t (*recurse_func_t) (hb_collect_glyphs_context_t *c, unsigned int lookup_index);
306
  template <typename T>
307
0
  return_t dispatch (const T &obj) { obj.collect_glyphs (this); return hb_empty_t (); }
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::Layout::GPOS_impl::SinglePosFormat1 const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::Layout::GPOS_impl::SinglePosFormat2 const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::Layout::GPOS_impl::CursivePosFormat1 const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::MediumTypes> >(OT::ContextFormat1_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::MediumTypes> >(OT::ContextFormat2_5<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::MediumTypes> >(OT::ChainContextFormat1_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::MediumTypes> >(OT::ChainContextFormat2_5<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: hb_empty_t OT::hb_collect_glyphs_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
308
0
  static return_t default_return_value () { return hb_empty_t (); }
309
  void recurse (unsigned int lookup_index)
310
0
  {
311
0
    if (unlikely (nesting_level_left == 0 || !recurse_func))
312
0
      return;
313
314
    /* Note that GPOS sets recurse_func to nullptr already, so it doesn't get
315
     * past the previous check.  For GSUB, we only want to collect the output
316
     * glyphs in the recursion.  If output is not requested, we can go home now.
317
     *
318
     * Note further, that the above is not exactly correct.  A recursed lookup
319
     * is allowed to match input that is not matched in the context, but that's
320
     * not how most fonts are built.  It's possible to relax that and recurse
321
     * with all sets here if it proves to be an issue.
322
     */
323
324
0
    if (output == hb_set_get_empty ())
325
0
      return;
326
327
    /* Return if new lookup was recursed to before. */
328
0
    if (recursed_lookups->has (lookup_index))
329
0
      return;
330
331
0
    hb_set_t *old_before = before;
332
0
    hb_set_t *old_input  = input;
333
0
    hb_set_t *old_after  = after;
334
0
    before = input = after = hb_set_get_empty ();
335
336
0
    nesting_level_left--;
337
0
    recurse_func (this, lookup_index);
338
0
    nesting_level_left++;
339
340
0
    before = old_before;
341
0
    input  = old_input;
342
0
    after  = old_after;
343
344
0
    recursed_lookups->add (lookup_index);
345
0
  }
346
347
  hb_face_t *face;
348
  hb_set_t *before;
349
  hb_set_t *input;
350
  hb_set_t *after;
351
  hb_set_t *output;
352
  recurse_func_t recurse_func;
353
  hb_set_t *recursed_lookups;
354
  unsigned int nesting_level_left;
355
356
  hb_collect_glyphs_context_t (hb_face_t *face_,
357
             hb_set_t  *glyphs_before, /* OUT.  May be NULL */
358
             hb_set_t  *glyphs_input,  /* OUT.  May be NULL */
359
             hb_set_t  *glyphs_after,  /* OUT.  May be NULL */
360
             hb_set_t  *glyphs_output, /* OUT.  May be NULL */
361
             unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
362
            face (face_),
363
            before (glyphs_before ? glyphs_before : hb_set_get_empty ()),
364
            input  (glyphs_input  ? glyphs_input  : hb_set_get_empty ()),
365
            after  (glyphs_after  ? glyphs_after  : hb_set_get_empty ()),
366
            output (glyphs_output ? glyphs_output : hb_set_get_empty ()),
367
            recurse_func (nullptr),
368
            recursed_lookups (hb_set_create ()),
369
0
            nesting_level_left (nesting_level_left_) {}
370
0
  ~hb_collect_glyphs_context_t () { hb_set_destroy (recursed_lookups); }
371
372
0
  void set_recurse_func (recurse_func_t func) { recurse_func = func; }
373
};
374
375
376
377
template <typename set_t>
378
struct hb_collect_coverage_context_t :
379
       hb_dispatch_context_t<hb_collect_coverage_context_t<set_t>, const Coverage &>
380
{
381
  typedef const Coverage &return_t; // Stoopid that we have to dupe this here.
382
  template <typename T>
383
  return_t dispatch (const T &obj) { return obj.get_coverage (); }
384
  static return_t default_return_value () { return Null (Coverage); }
385
  bool stop_sublookup_iteration (return_t r) const
386
  {
387
    r.collect_coverage (set);
388
    return false;
389
  }
390
391
  hb_collect_coverage_context_t (set_t *set_) :
392
           set (set_) {}
393
394
  set_t *set;
395
};
396
397
struct hb_ot_apply_context_t :
398
       hb_dispatch_context_t<hb_ot_apply_context_t, bool, HB_DEBUG_APPLY>
399
{
400
  struct matcher_t
401
  {
402
    matcher_t () :
403
       lookup_props (0),
404
       mask (-1),
405
       ignore_zwnj (false),
406
       ignore_zwj (false),
407
       per_syllable (false),
408
       syllable {0},
409
       match_func (nullptr),
410
2.26M
       match_data (nullptr) {}
411
412
    typedef bool (*match_func_t) (hb_glyph_info_t &info, unsigned value, const void *data);
413
414
29.7M
    void set_ignore_zwnj (bool ignore_zwnj_) { ignore_zwnj = ignore_zwnj_; }
415
29.7M
    void set_ignore_zwj (bool ignore_zwj_) { ignore_zwj = ignore_zwj_; }
416
29.7M
    void set_lookup_props (unsigned int lookup_props_) { lookup_props = lookup_props_; }
417
29.7M
    void set_mask (hb_mask_t mask_) { mask = mask_; }
418
29.7M
    void set_per_syllable (bool per_syllable_) { per_syllable = per_syllable_; }
419
6.89M
    void set_syllable (uint8_t syllable_)  { syllable = per_syllable ? syllable_ : 0; }
420
    void set_match_func (match_func_t match_func_,
421
       const void *match_data_)
422
36.2M
    { match_func = match_func_; match_data = match_data_; }
423
424
    enum may_match_t {
425
      MATCH_NO,
426
      MATCH_YES,
427
      MATCH_MAYBE
428
    };
429
430
    may_match_t may_match (hb_glyph_info_t &info,
431
         hb_codepoint_t glyph_data) const
432
8.36M
    {
433
8.36M
      if (!(info.mask & mask) ||
434
8.36M
    (syllable && syllable != info.syllable ()))
435
2.39k
  return MATCH_NO;
436
437
8.36M
      if (match_func)
438
7.97M
  return match_func (info, glyph_data, match_data) ? MATCH_YES : MATCH_NO;
439
440
386k
      return MATCH_MAYBE;
441
8.36M
    }
442
443
    enum may_skip_t {
444
      SKIP_NO,
445
      SKIP_YES,
446
      SKIP_MAYBE
447
    };
448
449
    may_skip_t may_skip (const hb_ot_apply_context_t *c,
450
       const hb_glyph_info_t       &info) const
451
8.52M
    {
452
8.52M
      if (!c->check_glyph_property (&info, lookup_props))
453
164k
  return SKIP_YES;
454
455
8.36M
      if (unlikely (_hb_glyph_info_is_default_ignorable_and_not_hidden (&info) &&
456
8.36M
        (ignore_zwnj || !_hb_glyph_info_is_zwnj (&info)) &&
457
8.36M
        (ignore_zwj || !_hb_glyph_info_is_zwj (&info))))
458
35.1k
  return SKIP_MAYBE;
459
460
8.32M
      return SKIP_NO;
461
8.36M
    }
462
463
    protected:
464
    unsigned int lookup_props;
465
    hb_mask_t mask;
466
    bool ignore_zwnj;
467
    bool ignore_zwj;
468
    bool per_syllable;
469
    uint8_t syllable;
470
    match_func_t match_func;
471
    const void *match_data;
472
  };
473
474
  struct skipping_iterator_t
475
  {
476
    void init (hb_ot_apply_context_t *c_, bool context_match = false)
477
29.7M
    {
478
29.7M
      c = c_;
479
29.7M
      match_glyph_data16 = nullptr;
480
29.7M
#ifndef HB_NO_BEYOND_64K
481
29.7M
      match_glyph_data24 = nullptr;
482
29.7M
#endif
483
29.7M
      matcher.set_match_func (nullptr, nullptr);
484
29.7M
      matcher.set_lookup_props (c->lookup_props);
485
      /* Ignore ZWNJ if we are matching GPOS, or matching GSUB context and asked to. */
486
29.7M
      matcher.set_ignore_zwnj (c->table_index == 1 || (context_match && c->auto_zwnj));
487
      /* Ignore ZWJ if we are matching context, or asked to. */
488
29.7M
      matcher.set_ignore_zwj  (context_match || c->auto_zwj);
489
29.7M
      matcher.set_mask (context_match ? -1 : c->lookup_mask);
490
29.7M
      matcher.set_per_syllable (c->per_syllable);
491
29.7M
    }
492
    void set_lookup_props (unsigned int lookup_props)
493
43.2k
    {
494
43.2k
      matcher.set_lookup_props (lookup_props);
495
43.2k
    }
496
    void set_match_func (matcher_t::match_func_t match_func_,
497
       const void *match_data_)
498
6.55M
    {
499
6.55M
      matcher.set_match_func (match_func_, match_data_);
500
6.55M
    }
501
    void set_glyph_data (const HBUINT16 glyph_data[])
502
6.55M
    {
503
6.55M
      match_glyph_data16 = glyph_data;
504
6.55M
#ifndef HB_NO_BEYOND_64K
505
6.55M
      match_glyph_data24 = nullptr;
506
6.55M
#endif
507
6.55M
    }
508
#ifndef HB_NO_BEYOND_64K
509
    void set_glyph_data (const HBUINT24 glyph_data[])
510
0
    {
511
0
      match_glyph_data16 = nullptr;
512
0
      match_glyph_data24 = glyph_data;
513
0
    }
514
#endif
515
516
    void reset (unsigned int start_index_,
517
    unsigned int num_items_)
518
6.89M
    {
519
6.89M
      idx = start_index_;
520
6.89M
      num_items = num_items_;
521
6.89M
      end = c->buffer->len;
522
6.89M
      matcher.set_syllable (start_index_ == c->buffer->idx ? c->buffer->cur().syllable () : 0);
523
6.89M
    }
524
525
    void reject ()
526
65.8k
    {
527
65.8k
      num_items++;
528
65.8k
      backup_glyph_data ();
529
65.8k
    }
530
531
    matcher_t::may_skip_t
532
    may_skip (const hb_glyph_info_t &info) const
533
5
    { return matcher.may_skip (c, info); }
534
535
    bool next (unsigned *unsafe_to = nullptr)
536
6.28M
    {
537
6.28M
      assert (num_items > 0);
538
      /* The alternate condition below is faster at string boundaries,
539
       * but produces subpar "unsafe-to-concat" values. */
540
0
      signed stop = (signed) end - (signed) num_items;
541
6.28M
      if (c->buffer->flags & HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT)
542
0
        stop = (signed) end - 1;
543
6.31M
      while ((signed) idx < stop)
544
6.25M
      {
545
6.25M
  idx++;
546
6.25M
  hb_glyph_info_t &info = c->buffer->info[idx];
547
548
6.25M
  matcher_t::may_skip_t skip = matcher.may_skip (c, info);
549
6.25M
  if (unlikely (skip == matcher_t::SKIP_YES))
550
30.2k
    continue;
551
552
6.21M
  matcher_t::may_match_t match = matcher.may_match (info, get_glyph_data ());
553
6.21M
  if (match == matcher_t::MATCH_YES ||
554
6.21M
      (match == matcher_t::MATCH_MAYBE &&
555
443k
       skip == matcher_t::SKIP_NO))
556
6.05M
  {
557
6.05M
    num_items--;
558
6.05M
    advance_glyph_data ();
559
6.05M
    return true;
560
6.05M
  }
561
562
159k
  if (skip == matcher_t::SKIP_NO)
563
159k
  {
564
159k
    if (unsafe_to)
565
159k
      *unsafe_to = idx + 1;
566
159k
    return false;
567
159k
  }
568
159k
      }
569
65.3k
      if (unsafe_to)
570
65.3k
        *unsafe_to = end;
571
65.3k
      return false;
572
6.28M
    }
573
    bool prev (unsigned *unsafe_from = nullptr)
574
2.16M
    {
575
2.16M
      assert (num_items > 0);
576
      /* The alternate condition below is faster at string boundaries,
577
       * but produces subpar "unsafe-to-concat" values. */
578
0
      unsigned stop = num_items - 1;
579
2.16M
      if (c->buffer->flags & HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT)
580
0
        stop = 1 - 1;
581
2.30M
      while (idx > stop)
582
2.27M
      {
583
2.27M
  idx--;
584
2.27M
  hb_glyph_info_t &info = c->buffer->out_info[idx];
585
586
2.27M
  matcher_t::may_skip_t skip = matcher.may_skip (c, info);
587
2.27M
  if (unlikely (skip == matcher_t::SKIP_YES))
588
134k
    continue;
589
590
2.14M
  matcher_t::may_match_t match = matcher.may_match (info, get_glyph_data ());
591
2.14M
  if (match == matcher_t::MATCH_YES ||
592
2.14M
      (match == matcher_t::MATCH_MAYBE &&
593
119k
       skip == matcher_t::SKIP_NO))
594
2.12M
  {
595
2.12M
    num_items--;
596
2.12M
    advance_glyph_data ();
597
2.12M
    return true;
598
2.12M
  }
599
600
15.7k
  if (skip == matcher_t::SKIP_NO)
601
15.0k
  {
602
15.0k
    if (unsafe_from)
603
15.0k
      *unsafe_from = hb_max (1u, idx) - 1u;
604
15.0k
    return false;
605
15.0k
  }
606
15.7k
      }
607
23.5k
      if (unsafe_from)
608
23.5k
        *unsafe_from = 0;
609
23.5k
      return false;
610
2.16M
    }
611
612
    hb_codepoint_t
613
    get_glyph_data ()
614
8.36M
    {
615
8.36M
      if (match_glyph_data16) return *match_glyph_data16;
616
386k
#ifndef HB_NO_BEYOND_64K
617
386k
      else
618
386k
      if (match_glyph_data24) return *match_glyph_data24;
619
386k
#endif
620
386k
      return 0;
621
8.36M
    }
622
    void
623
    advance_glyph_data ()
624
8.18M
    {
625
8.18M
      if (match_glyph_data16) match_glyph_data16++;
626
386k
#ifndef HB_NO_BEYOND_64K
627
386k
      else
628
386k
      if (match_glyph_data24) match_glyph_data24++;
629
8.18M
#endif
630
8.18M
    }
631
    void
632
    backup_glyph_data ()
633
65.8k
    {
634
65.8k
      if (match_glyph_data16) match_glyph_data16--;
635
65.8k
#ifndef HB_NO_BEYOND_64K
636
65.8k
      else
637
65.8k
      if (match_glyph_data24) match_glyph_data24--;
638
65.8k
#endif
639
65.8k
    }
640
641
    unsigned int idx;
642
    protected:
643
    hb_ot_apply_context_t *c;
644
    matcher_t matcher;
645
    const HBUINT16 *match_glyph_data16;
646
#ifndef HB_NO_BEYOND_64K
647
    const HBUINT24 *match_glyph_data24;
648
#endif
649
650
    unsigned int num_items;
651
    unsigned int end;
652
  };
653
654
655
0
  const char *get_name () { return "APPLY"; }
656
  typedef return_t (*recurse_func_t) (hb_ot_apply_context_t *c, unsigned int lookup_index);
657
  template <typename T>
658
0
  return_t dispatch (const T &obj) { return obj.apply (this); }
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::Layout::GPOS_impl::SinglePosFormat1 const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::Layout::GPOS_impl::SinglePosFormat2 const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::Layout::GPOS_impl::CursivePosFormat1 const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::MediumTypes> >(OT::ContextFormat1_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::MediumTypes> >(OT::ContextFormat2_5<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::MediumTypes> >(OT::ChainContextFormat1_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::MediumTypes> >(OT::ChainContextFormat2_5<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> const&)
Unexecuted instantiation: bool OT::hb_ot_apply_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
659
569M
  static return_t default_return_value () { return false; }
660
0
  bool stop_sublookup_iteration (return_t r) const { return r; }
661
  return_t recurse (unsigned int sub_lookup_index)
662
576M
  {
663
576M
    if (unlikely (nesting_level_left == 0 || !recurse_func || buffer->max_ops-- <= 0))
664
569M
    {
665
569M
      buffer->shaping_failed = true;
666
569M
      return default_return_value ();
667
569M
    }
668
669
6.72M
    nesting_level_left--;
670
6.72M
    bool ret = recurse_func (this, sub_lookup_index);
671
6.72M
    nesting_level_left++;
672
6.72M
    return ret;
673
576M
  }
674
675
  skipping_iterator_t iter_input, iter_context;
676
677
  unsigned int table_index; /* GSUB/GPOS */
678
  hb_font_t *font;
679
  hb_face_t *face;
680
  hb_buffer_t *buffer;
681
  recurse_func_t recurse_func = nullptr;
682
  const GDEF &gdef;
683
  const VariationStore &var_store;
684
  VariationStore::cache_t *var_store_cache;
685
  hb_set_digest_t digest;
686
687
  hb_direction_t direction;
688
  hb_mask_t lookup_mask = 1;
689
  unsigned int lookup_index = (unsigned) -1;
690
  unsigned int lookup_props = 0;
691
  unsigned int nesting_level_left = HB_MAX_NESTING_LEVEL;
692
693
  bool has_glyph_classes;
694
  bool auto_zwnj = true;
695
  bool auto_zwj = true;
696
  bool per_syllable = false;
697
  bool random = false;
698
  uint32_t random_state = 1;
699
  unsigned new_syllables = (unsigned) -1;
700
701
  hb_ot_apply_context_t (unsigned int table_index_,
702
       hb_font_t *font_,
703
       hb_buffer_t *buffer_) :
704
      table_index (table_index_),
705
      font (font_), face (font->face), buffer (buffer_),
706
      gdef (
707
#ifndef HB_NO_OT_LAYOUT
708
            *face->table.GDEF->table
709
#else
710
            Null (GDEF)
711
#endif
712
           ),
713
      var_store (gdef.get_var_store ()),
714
      var_store_cache (
715
#ifndef HB_NO_VAR
716
           table_index == 1 && font->num_coords ? var_store.create_cache () : nullptr
717
#else
718
           nullptr
719
#endif
720
          ),
721
      digest (buffer_->digest ()),
722
      direction (buffer_->props.direction),
723
      has_glyph_classes (gdef.has_glyph_classes ())
724
1.13M
  { init_iters (); }
725
726
  ~hb_ot_apply_context_t ()
727
1.13M
  {
728
1.13M
#ifndef HB_NO_VAR
729
1.13M
    VariationStore::destroy_cache (var_store_cache);
730
1.13M
#endif
731
1.13M
  }
732
733
  void init_iters ()
734
14.8M
  {
735
14.8M
    iter_input.init (this, false);
736
14.8M
    iter_context.init (this, true);
737
14.8M
  }
738
739
63.2k
  void set_lookup_mask (hb_mask_t mask) { lookup_mask = mask; init_iters (); }
740
54.5k
  void set_auto_zwj (bool auto_zwj_) { auto_zwj = auto_zwj_; init_iters (); }
741
54.5k
  void set_auto_zwnj (bool auto_zwnj_) { auto_zwnj = auto_zwnj_; init_iters (); }
742
54.5k
  void set_per_syllable (bool per_syllable_) { per_syllable = per_syllable_; init_iters (); }
743
54.5k
  void set_random (bool random_) { random = random_; }
744
1.12M
  void set_recurse_func (recurse_func_t func) { recurse_func = func; }
745
13.5M
  void set_lookup_index (unsigned int lookup_index_) { lookup_index = lookup_index_; }
746
13.5M
  void set_lookup_props (unsigned int lookup_props_) { lookup_props = lookup_props_; init_iters (); }
747
748
  uint32_t random_number ()
749
18
  {
750
    /* http://www.cplusplus.com/reference/random/minstd_rand/ */
751
18
    random_state = random_state * 48271 % 2147483647;
752
18
    return random_state;
753
18
  }
754
755
  bool match_properties_mark (hb_codepoint_t  glyph,
756
            unsigned int    glyph_props,
757
            unsigned int    match_props) const
758
73.5k
  {
759
    /* If using mark filtering sets, the high short of
760
     * match_props has the set index.
761
     */
762
73.5k
    if (match_props & LookupFlag::UseMarkFilteringSet)
763
882
      return gdef.mark_set_covers (match_props >> 16, glyph);
764
765
    /* The second byte of match_props has the meaning
766
     * "ignore marks of attachment type different than
767
     * the attachment type specified."
768
     */
769
72.6k
    if (match_props & LookupFlag::MarkAttachmentType)
770
22.9k
      return (match_props & LookupFlag::MarkAttachmentType) == (glyph_props & LookupFlag::MarkAttachmentType);
771
772
49.6k
    return true;
773
72.6k
  }
774
775
  bool check_glyph_property (const hb_glyph_info_t *info,
776
           unsigned int  match_props) const
777
10.0M
  {
778
10.0M
    hb_codepoint_t glyph = info->codepoint;
779
10.0M
    unsigned int glyph_props = _hb_glyph_info_get_glyph_props (info);
780
781
    /* Not covered, if, for example, glyph class is ligature and
782
     * match_props includes LookupFlags::IgnoreLigatures
783
     */
784
10.0M
    if (glyph_props & match_props & LookupFlag::IgnoreFlags)
785
305k
      return false;
786
787
9.70M
    if (unlikely (glyph_props & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
788
73.5k
      return match_properties_mark (glyph, glyph_props, match_props);
789
790
9.63M
    return true;
791
9.70M
  }
792
793
  void _set_glyph_class (hb_codepoint_t glyph_index,
794
        unsigned int class_guess = 0,
795
        bool ligature = false,
796
        bool component = false)
797
5.90M
  {
798
5.90M
    digest.add (glyph_index);
799
800
5.90M
    if (new_syllables != (unsigned) -1)
801
0
      buffer->cur().syllable() = new_syllables;
802
803
5.90M
    unsigned int props = _hb_glyph_info_get_glyph_props (&buffer->cur());
804
5.90M
    props |= HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED;
805
5.90M
    if (ligature)
806
88.1k
    {
807
88.1k
      props |= HB_OT_LAYOUT_GLYPH_PROPS_LIGATED;
808
      /* In the only place that the MULTIPLIED bit is used, Uniscribe
809
       * seems to only care about the "last" transformation between
810
       * Ligature and Multiple substitutions.  Ie. if you ligate, expand,
811
       * and ligate again, it forgives the multiplication and acts as
812
       * if only ligation happened.  As such, clear MULTIPLIED bit.
813
       */
814
88.1k
      props &= ~HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED;
815
88.1k
    }
816
5.90M
    if (component)
817
5.80M
      props |= HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED;
818
5.90M
    if (likely (has_glyph_classes))
819
52.2k
    {
820
52.2k
      props &= HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE;
821
52.2k
      _hb_glyph_info_set_glyph_props (&buffer->cur(), props | gdef.get_glyph_props (glyph_index));
822
52.2k
    }
823
5.84M
    else if (class_guess)
824
87.3k
    {
825
87.3k
      props &= HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE;
826
87.3k
      _hb_glyph_info_set_glyph_props (&buffer->cur(), props | class_guess);
827
87.3k
    }
828
5.76M
    else
829
5.76M
      _hb_glyph_info_set_glyph_props (&buffer->cur(), props);
830
5.90M
  }
831
832
  void replace_glyph (hb_codepoint_t glyph_index)
833
6.51k
  {
834
6.51k
    _set_glyph_class (glyph_index);
835
6.51k
    (void) buffer->replace_glyph (glyph_index);
836
6.51k
  }
837
  void replace_glyph_inplace (hb_codepoint_t glyph_index)
838
228
  {
839
228
    _set_glyph_class (glyph_index);
840
228
    buffer->cur().codepoint = glyph_index;
841
228
  }
842
  void replace_glyph_with_ligature (hb_codepoint_t glyph_index,
843
            unsigned int class_guess)
844
88.1k
  {
845
88.1k
    _set_glyph_class (glyph_index, class_guess, true);
846
88.1k
    (void) buffer->replace_glyph (glyph_index);
847
88.1k
  }
848
  void output_glyph_for_component (hb_codepoint_t glyph_index,
849
           unsigned int class_guess)
850
5.80M
  {
851
5.80M
    _set_glyph_class (glyph_index, class_guess, false, true);
852
5.80M
    (void) buffer->output_glyph (glyph_index);
853
5.80M
  }
854
};
855
856
857
struct hb_accelerate_subtables_context_t :
858
       hb_dispatch_context_t<hb_accelerate_subtables_context_t>
859
{
860
  template <typename Type>
861
  static inline bool apply_to (const void *obj, hb_ot_apply_context_t *c)
862
5.52M
  {
863
5.52M
    const Type *typed_obj = (const Type *) obj;
864
5.52M
    return typed_obj->apply (c);
865
5.52M
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::SinglePosFormat1>(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
11.4k
  {
863
11.4k
    const Type *typed_obj = (const Type *) obj;
864
11.4k
    return typed_obj->apply (c);
865
11.4k
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::SinglePosFormat2>(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
2.55k
  {
863
2.55k
    const Type *typed_obj = (const Type *) obj;
864
2.55k
    return typed_obj->apply (c);
865
2.55k
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
522k
  {
863
522k
    const Type *typed_obj = (const Type *) obj;
864
522k
    return typed_obj->apply (c);
865
522k
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
16.8k
  {
863
16.8k
    const Type *typed_obj = (const Type *) obj;
864
16.8k
    return typed_obj->apply (c);
865
16.8k
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
186k
  {
863
186k
    const Type *typed_obj = (const Type *) obj;
864
186k
    return typed_obj->apply (c);
865
186k
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
108
  {
863
108
    const Type *typed_obj = (const Type *) obj;
864
108
    return typed_obj->apply (c);
865
108
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::CursivePosFormat1>(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
1.85k
  {
863
1.85k
    const Type *typed_obj = (const Type *) obj;
864
1.85k
    return typed_obj->apply (c);
865
1.85k
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
73.3k
  {
863
73.3k
    const Type *typed_obj = (const Type *) obj;
864
73.3k
    return typed_obj->apply (c);
865
73.3k
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
760
  {
863
760
    const Type *typed_obj = (const Type *) obj;
864
760
    return typed_obj->apply (c);
865
760
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
8.52k
  {
863
8.52k
    const Type *typed_obj = (const Type *) obj;
864
8.52k
    return typed_obj->apply (c);
865
8.52k
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
880
  {
863
880
    const Type *typed_obj = (const Type *) obj;
864
880
    return typed_obj->apply (c);
865
880
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
678k
  {
863
678k
    const Type *typed_obj = (const Type *) obj;
864
678k
    return typed_obj->apply (c);
865
678k
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
622
  {
863
622
    const Type *typed_obj = (const Type *) obj;
864
622
    return typed_obj->apply (c);
865
622
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ContextFormat3>(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
798k
  {
863
798k
    const Type *typed_obj = (const Type *) obj;
864
798k
    return typed_obj->apply (c);
865
798k
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ContextFormat1_4<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ContextFormat2_5<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
1.45M
  {
863
1.45M
    const Type *typed_obj = (const Type *) obj;
864
1.45M
    return typed_obj->apply (c);
865
1.45M
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
440k
  {
863
440k
    const Type *typed_obj = (const Type *) obj;
864
440k
    return typed_obj->apply (c);
865
440k
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ChainContextFormat3>(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
157k
  {
863
157k
    const Type *typed_obj = (const Type *) obj;
864
157k
    return typed_obj->apply (c);
865
157k
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ChainContextFormat1_4<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::ChainContextFormat2_5<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
100
  {
863
100
    const Type *typed_obj = (const Type *) obj;
864
100
    return typed_obj->apply (c);
865
100
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
86.9k
  {
863
86.9k
    const Type *typed_obj = (const Type *) obj;
864
86.9k
    return typed_obj->apply (c);
865
86.9k
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
4.78k
  {
863
4.78k
    const Type *typed_obj = (const Type *) obj;
864
4.78k
    return typed_obj->apply (c);
865
4.78k
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
54
  {
863
54
    const Type *typed_obj = (const Type *) obj;
864
54
    return typed_obj->apply (c);
865
54
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
784k
  {
863
784k
    const Type *typed_obj = (const Type *) obj;
864
784k
    return typed_obj->apply (c);
865
784k
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
26.3k
  {
863
26.3k
    const Type *typed_obj = (const Type *) obj;
864
26.3k
    return typed_obj->apply (c);
865
26.3k
  }
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
2.65k
  {
863
2.65k
    const Type *typed_obj = (const Type *) obj;
864
2.65k
    return typed_obj->apply (c);
865
2.65k
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
252k
  {
863
252k
    const Type *typed_obj = (const Type *) obj;
864
252k
    return typed_obj->apply (c);
865
252k
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
bool OT::hb_accelerate_subtables_context_t::apply_to<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
862
11.6k
  {
863
11.6k
    const Type *typed_obj = (const Type *) obj;
864
11.6k
    return typed_obj->apply (c);
865
11.6k
  }
866
867
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
868
  template <typename T>
869
  static inline auto apply_cached_ (const T *obj, hb_ot_apply_context_t *c, hb_priority<1>) HB_RETURN (bool, obj->apply (c, true) )
870
  template <typename T>
871
  static inline auto apply_cached_ (const T *obj, hb_ot_apply_context_t *c, hb_priority<0>) HB_RETURN (bool, obj->apply (c) )
872
  template <typename Type>
873
  static inline bool apply_cached_to (const void *obj, hb_ot_apply_context_t *c)
874
206
  {
875
206
    const Type *typed_obj = (const Type *) obj;
876
206
    return apply_cached_ (typed_obj, c, hb_prioritize);
877
206
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::SinglePosFormat1>(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::SinglePosFormat2>(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::CursivePosFormat1>(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
874
100
  {
875
100
    const Type *typed_obj = (const Type *) obj;
876
100
    return apply_cached_ (typed_obj, c, hb_prioritize);
877
100
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ContextFormat3>(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ContextFormat1_4<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ContextFormat2_5<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Line
Count
Source
874
106
  {
875
106
    const Type *typed_obj = (const Type *) obj;
876
106
    return apply_cached_ (typed_obj, c, hb_prioritize);
877
106
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ChainContextFormat3>(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ChainContextFormat1_4<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::ChainContextFormat2_5<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::apply_cached_to<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(void const*, OT::hb_ot_apply_context_t*)
878
879
  template <typename T>
880
  static inline auto cache_func_ (const T *obj, hb_ot_apply_context_t *c, bool enter, hb_priority<1>) HB_RETURN (bool, obj->cache_func (c, enter) )
881
  template <typename T>
882
0
  static inline bool cache_func_ (const T *obj, hb_ot_apply_context_t *c, bool enter, hb_priority<0>) { return false; }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::Layout::GPOS_impl::SinglePosFormat1 const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::Layout::GPOS_impl::SinglePosFormat2 const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::Layout::GPOS_impl::CursivePosFormat1 const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::ContextFormat3>(OT::ContextFormat3 const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::ContextFormat1_4<OT::Layout::MediumTypes> >(OT::ContextFormat1_4<OT::Layout::MediumTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::ChainContextFormat3>(OT::ChainContextFormat3 const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::ChainContextFormat1_4<OT::Layout::MediumTypes> >(OT::ChainContextFormat1_4<OT::Layout::MediumTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const*, OT::hb_ot_apply_context_t*, bool, hb_priority<0u>)
883
  template <typename Type>
884
  static inline bool cache_func_to (const void *obj, hb_ot_apply_context_t *c, bool enter)
885
178
  {
886
178
    const Type *typed_obj = (const Type *) obj;
887
178
    return cache_func_ (typed_obj, c, enter, hb_prioritize);
888
178
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::SinglePosFormat1>(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::SinglePosFormat2>(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::CursivePosFormat1>(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Line
Count
Source
885
84
  {
886
84
    const Type *typed_obj = (const Type *) obj;
887
84
    return cache_func_ (typed_obj, c, enter, hb_prioritize);
888
84
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ContextFormat3>(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ContextFormat1_4<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ContextFormat2_5<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Line
Count
Source
885
94
  {
886
94
    const Type *typed_obj = (const Type *) obj;
887
94
    return cache_func_ (typed_obj, c, enter, hb_prioritize);
888
94
  }
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ChainContextFormat3>(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ChainContextFormat1_4<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::ChainContextFormat2_5<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> >(void const*, OT::hb_ot_apply_context_t*, bool)
Unexecuted instantiation: bool OT::hb_accelerate_subtables_context_t::cache_func_to<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(void const*, OT::hb_ot_apply_context_t*, bool)
889
#endif
890
891
  typedef bool (*hb_apply_func_t) (const void *obj, hb_ot_apply_context_t *c);
892
  typedef bool (*hb_cache_func_t) (const void *obj, hb_ot_apply_context_t *c, bool enter);
893
894
  struct hb_applicable_t
895
  {
896
    friend struct hb_accelerate_subtables_context_t;
897
    friend struct hb_ot_layout_lookup_accelerator_t;
898
899
    template <typename T>
900
    void init (const T &obj_,
901
         hb_apply_func_t apply_func_
902
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
903
         , hb_apply_func_t apply_cached_func_
904
         , hb_cache_func_t cache_func_
905
#endif
906
    )
907
161k
    {
908
161k
      obj = &obj_;
909
161k
      apply_func = apply_func_;
910
161k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
161k
      apply_cached_func = apply_cached_func_;
912
161k
      cache_func = cache_func_;
913
161k
#endif
914
161k
      digest.init ();
915
161k
      obj_.get_coverage ().collect_coverage (&digest);
916
161k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::Layout::GPOS_impl::SinglePosFormat1 const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
17.0k
    {
908
17.0k
      obj = &obj_;
909
17.0k
      apply_func = apply_func_;
910
17.0k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
17.0k
      apply_cached_func = apply_cached_func_;
912
17.0k
      cache_func = cache_func_;
913
17.0k
#endif
914
17.0k
      digest.init ();
915
17.0k
      obj_.get_coverage ().collect_coverage (&digest);
916
17.0k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::Layout::GPOS_impl::SinglePosFormat2 const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
2.69k
    {
908
2.69k
      obj = &obj_;
909
2.69k
      apply_func = apply_func_;
910
2.69k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
2.69k
      apply_cached_func = apply_cached_func_;
912
2.69k
      cache_func = cache_func_;
913
2.69k
#endif
914
2.69k
      digest.init ();
915
2.69k
      obj_.get_coverage ().collect_coverage (&digest);
916
2.69k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
5.37k
    {
908
5.37k
      obj = &obj_;
909
5.37k
      apply_func = apply_func_;
910
5.37k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
5.37k
      apply_cached_func = apply_cached_func_;
912
5.37k
      cache_func = cache_func_;
913
5.37k
#endif
914
5.37k
      digest.init ();
915
5.37k
      obj_.get_coverage ().collect_coverage (&digest);
916
5.37k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
3.17k
    {
908
3.17k
      obj = &obj_;
909
3.17k
      apply_func = apply_func_;
910
3.17k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
3.17k
      apply_cached_func = apply_cached_func_;
912
3.17k
      cache_func = cache_func_;
913
3.17k
#endif
914
3.17k
      digest.init ();
915
3.17k
      obj_.get_coverage ().collect_coverage (&digest);
916
3.17k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
21
    {
908
21
      obj = &obj_;
909
21
      apply_func = apply_func_;
910
21
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
21
      apply_cached_func = apply_cached_func_;
912
21
      cache_func = cache_func_;
913
21
#endif
914
21
      digest.init ();
915
21
      obj_.get_coverage ().collect_coverage (&digest);
916
21
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
63
    {
908
63
      obj = &obj_;
909
63
      apply_func = apply_func_;
910
63
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
63
      apply_cached_func = apply_cached_func_;
912
63
      cache_func = cache_func_;
913
63
#endif
914
63
      digest.init ();
915
63
      obj_.get_coverage ().collect_coverage (&digest);
916
63
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::Layout::GPOS_impl::CursivePosFormat1 const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
2.02k
    {
908
2.02k
      obj = &obj_;
909
2.02k
      apply_func = apply_func_;
910
2.02k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
2.02k
      apply_cached_func = apply_cached_func_;
912
2.02k
      cache_func = cache_func_;
913
2.02k
#endif
914
2.02k
      digest.init ();
915
2.02k
      obj_.get_coverage ().collect_coverage (&digest);
916
2.02k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
7.25k
    {
908
7.25k
      obj = &obj_;
909
7.25k
      apply_func = apply_func_;
910
7.25k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
7.25k
      apply_cached_func = apply_cached_func_;
912
7.25k
      cache_func = cache_func_;
913
7.25k
#endif
914
7.25k
      digest.init ();
915
7.25k
      obj_.get_coverage ().collect_coverage (&digest);
916
7.25k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
87
    {
908
87
      obj = &obj_;
909
87
      apply_func = apply_func_;
910
87
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
87
      apply_cached_func = apply_cached_func_;
912
87
      cache_func = cache_func_;
913
87
#endif
914
87
      digest.init ();
915
87
      obj_.get_coverage ().collect_coverage (&digest);
916
87
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
1.10k
    {
908
1.10k
      obj = &obj_;
909
1.10k
      apply_func = apply_func_;
910
1.10k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
1.10k
      apply_cached_func = apply_cached_func_;
912
1.10k
      cache_func = cache_func_;
913
1.10k
#endif
914
1.10k
      digest.init ();
915
1.10k
      obj_.get_coverage ().collect_coverage (&digest);
916
1.10k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
138
    {
908
138
      obj = &obj_;
909
138
      apply_func = apply_func_;
910
138
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
138
      apply_cached_func = apply_cached_func_;
912
138
      cache_func = cache_func_;
913
138
#endif
914
138
      digest.init ();
915
138
      obj_.get_coverage ().collect_coverage (&digest);
916
138
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
3.22k
    {
908
3.22k
      obj = &obj_;
909
3.22k
      apply_func = apply_func_;
910
3.22k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
3.22k
      apply_cached_func = apply_cached_func_;
912
3.22k
      cache_func = cache_func_;
913
3.22k
#endif
914
3.22k
      digest.init ();
915
3.22k
      obj_.get_coverage ().collect_coverage (&digest);
916
3.22k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
220
    {
908
220
      obj = &obj_;
909
220
      apply_func = apply_func_;
910
220
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
220
      apply_cached_func = apply_cached_func_;
912
220
      cache_func = cache_func_;
913
220
#endif
914
220
      digest.init ();
915
220
      obj_.get_coverage ().collect_coverage (&digest);
916
220
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
2.57k
    {
908
2.57k
      obj = &obj_;
909
2.57k
      apply_func = apply_func_;
910
2.57k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
2.57k
      apply_cached_func = apply_cached_func_;
912
2.57k
      cache_func = cache_func_;
913
2.57k
#endif
914
2.57k
      digest.init ();
915
2.57k
      obj_.get_coverage ().collect_coverage (&digest);
916
2.57k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
3.05k
    {
908
3.05k
      obj = &obj_;
909
3.05k
      apply_func = apply_func_;
910
3.05k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
3.05k
      apply_cached_func = apply_cached_func_;
912
3.05k
      cache_func = cache_func_;
913
3.05k
#endif
914
3.05k
      digest.init ();
915
3.05k
      obj_.get_coverage ().collect_coverage (&digest);
916
3.05k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ContextFormat3>(OT::ContextFormat3 const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
1.14k
    {
908
1.14k
      obj = &obj_;
909
1.14k
      apply_func = apply_func_;
910
1.14k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
1.14k
      apply_cached_func = apply_cached_func_;
912
1.14k
      cache_func = cache_func_;
913
1.14k
#endif
914
1.14k
      digest.init ();
915
1.14k
      obj_.get_coverage ().collect_coverage (&digest);
916
1.14k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ContextFormat1_4<OT::Layout::MediumTypes> >(OT::ContextFormat1_4<OT::Layout::MediumTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
21
    {
908
21
      obj = &obj_;
909
21
      apply_func = apply_func_;
910
21
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
21
      apply_cached_func = apply_cached_func_;
912
21
      cache_func = cache_func_;
913
21
#endif
914
21
      digest.init ();
915
21
      obj_.get_coverage ().collect_coverage (&digest);
916
21
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ContextFormat2_5<OT::Layout::MediumTypes> >(OT::ContextFormat2_5<OT::Layout::MediumTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
61
    {
908
61
      obj = &obj_;
909
61
      apply_func = apply_func_;
910
61
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
61
      apply_cached_func = apply_cached_func_;
912
61
      cache_func = cache_func_;
913
61
#endif
914
61
      digest.init ();
915
61
      obj_.get_coverage ().collect_coverage (&digest);
916
61
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
2.17k
    {
908
2.17k
      obj = &obj_;
909
2.17k
      apply_func = apply_func_;
910
2.17k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
2.17k
      apply_cached_func = apply_cached_func_;
912
2.17k
      cache_func = cache_func_;
913
2.17k
#endif
914
2.17k
      digest.init ();
915
2.17k
      obj_.get_coverage ().collect_coverage (&digest);
916
2.17k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
5.26k
    {
908
5.26k
      obj = &obj_;
909
5.26k
      apply_func = apply_func_;
910
5.26k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
5.26k
      apply_cached_func = apply_cached_func_;
912
5.26k
      cache_func = cache_func_;
913
5.26k
#endif
914
5.26k
      digest.init ();
915
5.26k
      obj_.get_coverage ().collect_coverage (&digest);
916
5.26k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
30.1k
    {
908
30.1k
      obj = &obj_;
909
30.1k
      apply_func = apply_func_;
910
30.1k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
30.1k
      apply_cached_func = apply_cached_func_;
912
30.1k
      cache_func = cache_func_;
913
30.1k
#endif
914
30.1k
      digest.init ();
915
30.1k
      obj_.get_coverage ().collect_coverage (&digest);
916
30.1k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ChainContextFormat1_4<OT::Layout::MediumTypes> >(OT::ChainContextFormat1_4<OT::Layout::MediumTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
23
    {
908
23
      obj = &obj_;
909
23
      apply_func = apply_func_;
910
23
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
23
      apply_cached_func = apply_cached_func_;
912
23
      cache_func = cache_func_;
913
23
#endif
914
23
      digest.init ();
915
23
      obj_.get_coverage ().collect_coverage (&digest);
916
23
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::ChainContextFormat2_5<OT::Layout::MediumTypes> >(OT::ChainContextFormat2_5<OT::Layout::MediumTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
50
    {
908
50
      obj = &obj_;
909
50
      apply_func = apply_func_;
910
50
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
50
      apply_cached_func = apply_cached_func_;
912
50
      cache_func = cache_func_;
913
50
#endif
914
50
      digest.init ();
915
50
      obj_.get_coverage ().collect_coverage (&digest);
916
50
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
26.0k
    {
908
26.0k
      obj = &obj_;
909
26.0k
      apply_func = apply_func_;
910
26.0k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
26.0k
      apply_cached_func = apply_cached_func_;
912
26.0k
      cache_func = cache_func_;
913
26.0k
#endif
914
26.0k
      digest.init ();
915
26.0k
      obj_.get_coverage ().collect_coverage (&digest);
916
26.0k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
16.4k
    {
908
16.4k
      obj = &obj_;
909
16.4k
      apply_func = apply_func_;
910
16.4k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
16.4k
      apply_cached_func = apply_cached_func_;
912
16.4k
      cache_func = cache_func_;
913
16.4k
#endif
914
16.4k
      digest.init ();
915
16.4k
      obj_.get_coverage ().collect_coverage (&digest);
916
16.4k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
1.35k
    {
908
1.35k
      obj = &obj_;
909
1.35k
      apply_func = apply_func_;
910
1.35k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
1.35k
      apply_cached_func = apply_cached_func_;
912
1.35k
      cache_func = cache_func_;
913
1.35k
#endif
914
1.35k
      digest.init ();
915
1.35k
      obj_.get_coverage ().collect_coverage (&digest);
916
1.35k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
540
    {
908
540
      obj = &obj_;
909
540
      apply_func = apply_func_;
910
540
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
540
      apply_cached_func = apply_cached_func_;
912
540
      cache_func = cache_func_;
913
540
#endif
914
540
      digest.init ();
915
540
      obj_.get_coverage ().collect_coverage (&digest);
916
540
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
10.0k
    {
908
10.0k
      obj = &obj_;
909
10.0k
      apply_func = apply_func_;
910
10.0k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
10.0k
      apply_cached_func = apply_cached_func_;
912
10.0k
      cache_func = cache_func_;
913
10.0k
#endif
914
10.0k
      digest.init ();
915
10.0k
      obj_.get_coverage ().collect_coverage (&digest);
916
10.0k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
290
    {
908
290
      obj = &obj_;
909
290
      apply_func = apply_func_;
910
290
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
290
      apply_cached_func = apply_cached_func_;
912
290
      cache_func = cache_func_;
913
290
#endif
914
290
      digest.init ();
915
290
      obj_.get_coverage ().collect_coverage (&digest);
916
290
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
1.48k
    {
908
1.48k
      obj = &obj_;
909
1.48k
      apply_func = apply_func_;
910
1.48k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
1.48k
      apply_cached_func = apply_cached_func_;
912
1.48k
      cache_func = cache_func_;
913
1.48k
#endif
914
1.48k
      digest.init ();
915
1.48k
      obj_.get_coverage ().collect_coverage (&digest);
916
1.48k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
71
    {
908
71
      obj = &obj_;
909
71
      apply_func = apply_func_;
910
71
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
71
      apply_cached_func = apply_cached_func_;
912
71
      cache_func = cache_func_;
913
71
#endif
914
71
      digest.init ();
915
71
      obj_.get_coverage ().collect_coverage (&digest);
916
71
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
15.5k
    {
908
15.5k
      obj = &obj_;
909
15.5k
      apply_func = apply_func_;
910
15.5k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
15.5k
      apply_cached_func = apply_cached_func_;
912
15.5k
      cache_func = cache_func_;
913
15.5k
#endif
914
15.5k
      digest.init ();
915
15.5k
      obj_.get_coverage ().collect_coverage (&digest);
916
15.5k
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
41
    {
908
41
      obj = &obj_;
909
41
      apply_func = apply_func_;
910
41
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
41
      apply_cached_func = apply_cached_func_;
912
41
      cache_func = cache_func_;
913
41
#endif
914
41
      digest.init ();
915
41
      obj_.get_coverage ().collect_coverage (&digest);
916
41
    }
void OT::hb_accelerate_subtables_context_t::hb_applicable_t::init<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&, bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*), bool (*)(void const*, OT::hb_ot_apply_context_t*, bool))
Line
Count
Source
907
2.84k
    {
908
2.84k
      obj = &obj_;
909
2.84k
      apply_func = apply_func_;
910
2.84k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
911
2.84k
      apply_cached_func = apply_cached_func_;
912
2.84k
      cache_func = cache_func_;
913
2.84k
#endif
914
2.84k
      digest.init ();
915
2.84k
      obj_.get_coverage ().collect_coverage (&digest);
916
2.84k
    }
917
918
    bool apply (hb_ot_apply_context_t *c) const
919
6.17M
    {
920
6.17M
      return digest.may_have (c->buffer->cur().codepoint) && apply_func (obj, c);
921
6.17M
    }
922
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
923
    bool apply_cached (hb_ot_apply_context_t *c) const
924
206
    {
925
206
      return digest.may_have (c->buffer->cur().codepoint) &&  apply_cached_func (obj, c);
926
206
    }
927
    bool cache_enter (hb_ot_apply_context_t *c) const
928
89
    {
929
89
      return cache_func (obj, c, true);
930
89
    }
931
    void cache_leave (hb_ot_apply_context_t *c) const
932
89
    {
933
89
      cache_func (obj, c, false);
934
89
    }
935
#endif
936
937
    private:
938
    const void *obj;
939
    hb_apply_func_t apply_func;
940
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
941
    hb_apply_func_t apply_cached_func;
942
    hb_cache_func_t cache_func;
943
#endif
944
    hb_set_digest_t digest;
945
  };
946
947
  typedef hb_vector_t<hb_applicable_t> array_t;
948
949
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
950
  template <typename T>
951
  auto cache_cost (const T &obj, hb_priority<1>) HB_AUTO_RETURN ( obj.cache_cost () )
952
  template <typename T>
953
  auto cache_cost (const T &obj, hb_priority<0>) HB_AUTO_RETURN ( 0u )
954
#endif
955
956
  /* Dispatch interface. */
957
  template <typename T>
958
  return_t dispatch (const T &obj)
959
161k
  {
960
161k
    hb_applicable_t *entry = array.push ();
961
962
161k
    entry->init (obj,
963
161k
     apply_to<T>
964
161k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
161k
     , apply_cached_to<T>
966
161k
     , cache_func_to<T>
967
161k
#endif
968
161k
     );
969
970
161k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
161k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
161k
    if (cost > cache_user_cost && !array.in_error ())
981
4.03k
    {
982
4.03k
      cache_user_idx = array.length - 1;
983
4.03k
      cache_user_cost = cost;
984
4.03k
    }
985
161k
#endif
986
987
161k
    return hb_empty_t ();
988
161k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat1>(OT::Layout::GPOS_impl::SinglePosFormat1 const&)
Line
Count
Source
959
17.0k
  {
960
17.0k
    hb_applicable_t *entry = array.push ();
961
962
17.0k
    entry->init (obj,
963
17.0k
     apply_to<T>
964
17.0k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
17.0k
     , apply_cached_to<T>
966
17.0k
     , cache_func_to<T>
967
17.0k
#endif
968
17.0k
     );
969
970
17.0k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
17.0k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
17.0k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
17.0k
#endif
986
987
17.0k
    return hb_empty_t ();
988
17.0k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::SinglePosFormat2>(OT::Layout::GPOS_impl::SinglePosFormat2 const&)
Line
Count
Source
959
2.69k
  {
960
2.69k
    hb_applicable_t *entry = array.push ();
961
962
2.69k
    entry->init (obj,
963
2.69k
     apply_to<T>
964
2.69k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
2.69k
     , apply_cached_to<T>
966
2.69k
     , cache_func_to<T>
967
2.69k
#endif
968
2.69k
     );
969
970
2.69k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
2.69k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
2.69k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
2.69k
#endif
986
987
2.69k
    return hb_empty_t ();
988
2.69k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::SmallTypes> const&)
Line
Count
Source
959
5.37k
  {
960
5.37k
    hb_applicable_t *entry = array.push ();
961
962
5.37k
    entry->init (obj,
963
5.37k
     apply_to<T>
964
5.37k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
5.37k
     , apply_cached_to<T>
966
5.37k
     , cache_func_to<T>
967
5.37k
#endif
968
5.37k
     );
969
970
5.37k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
5.37k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
5.37k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
5.37k
#endif
986
987
5.37k
    return hb_empty_t ();
988
5.37k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::SmallTypes> const&)
Line
Count
Source
959
3.17k
  {
960
3.17k
    hb_applicable_t *entry = array.push ();
961
962
3.17k
    entry->init (obj,
963
3.17k
     apply_to<T>
964
3.17k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
3.17k
     , apply_cached_to<T>
966
3.17k
     , cache_func_to<T>
967
3.17k
#endif
968
3.17k
     );
969
970
3.17k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
3.17k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
3.17k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
3.17k
#endif
986
987
3.17k
    return hb_empty_t ();
988
3.17k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::PairPosFormat1_3<OT::Layout::MediumTypes> const&)
Line
Count
Source
959
21
  {
960
21
    hb_applicable_t *entry = array.push ();
961
962
21
    entry->init (obj,
963
21
     apply_to<T>
964
21
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
21
     , apply_cached_to<T>
966
21
     , cache_func_to<T>
967
21
#endif
968
21
     );
969
970
21
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
21
    unsigned cost = cache_cost (obj, hb_prioritize);
980
21
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
21
#endif
986
987
21
    return hb_empty_t ();
988
21
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::PairPosFormat2_4<OT::Layout::MediumTypes> const&)
Line
Count
Source
959
63
  {
960
63
    hb_applicable_t *entry = array.push ();
961
962
63
    entry->init (obj,
963
63
     apply_to<T>
964
63
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
63
     , apply_cached_to<T>
966
63
     , cache_func_to<T>
967
63
#endif
968
63
     );
969
970
63
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
63
    unsigned cost = cache_cost (obj, hb_prioritize);
980
63
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
63
#endif
986
987
63
    return hb_empty_t ();
988
63
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::CursivePosFormat1>(OT::Layout::GPOS_impl::CursivePosFormat1 const&)
Line
Count
Source
959
2.02k
  {
960
2.02k
    hb_applicable_t *entry = array.push ();
961
962
2.02k
    entry->init (obj,
963
2.02k
     apply_to<T>
964
2.02k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
2.02k
     , apply_cached_to<T>
966
2.02k
     , cache_func_to<T>
967
2.02k
#endif
968
2.02k
     );
969
970
2.02k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
2.02k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
2.02k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
2.02k
#endif
986
987
2.02k
    return hb_empty_t ();
988
2.02k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::SmallTypes> const&)
Line
Count
Source
959
7.25k
  {
960
7.25k
    hb_applicable_t *entry = array.push ();
961
962
7.25k
    entry->init (obj,
963
7.25k
     apply_to<T>
964
7.25k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
7.25k
     , apply_cached_to<T>
966
7.25k
     , cache_func_to<T>
967
7.25k
#endif
968
7.25k
     );
969
970
7.25k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
7.25k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
7.25k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
7.25k
#endif
986
987
7.25k
    return hb_empty_t ();
988
7.25k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkBasePosFormat1_2<OT::Layout::MediumTypes> const&)
Line
Count
Source
959
87
  {
960
87
    hb_applicable_t *entry = array.push ();
961
962
87
    entry->init (obj,
963
87
     apply_to<T>
964
87
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
87
     , apply_cached_to<T>
966
87
     , cache_func_to<T>
967
87
#endif
968
87
     );
969
970
87
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
87
    unsigned cost = cache_cost (obj, hb_prioritize);
980
87
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
87
#endif
986
987
87
    return hb_empty_t ();
988
87
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::SmallTypes> const&)
Line
Count
Source
959
1.10k
  {
960
1.10k
    hb_applicable_t *entry = array.push ();
961
962
1.10k
    entry->init (obj,
963
1.10k
     apply_to<T>
964
1.10k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
1.10k
     , apply_cached_to<T>
966
1.10k
     , cache_func_to<T>
967
1.10k
#endif
968
1.10k
     );
969
970
1.10k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
1.10k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
1.10k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
1.10k
#endif
986
987
1.10k
    return hb_empty_t ();
988
1.10k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkLigPosFormat1_2<OT::Layout::MediumTypes> const&)
Line
Count
Source
959
138
  {
960
138
    hb_applicable_t *entry = array.push ();
961
962
138
    entry->init (obj,
963
138
     apply_to<T>
964
138
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
138
     , apply_cached_to<T>
966
138
     , cache_func_to<T>
967
138
#endif
968
138
     );
969
970
138
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
138
    unsigned cost = cache_cost (obj, hb_prioritize);
980
138
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
138
#endif
986
987
138
    return hb_empty_t ();
988
138
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::SmallTypes> const&)
Line
Count
Source
959
3.22k
  {
960
3.22k
    hb_applicable_t *entry = array.push ();
961
962
3.22k
    entry->init (obj,
963
3.22k
     apply_to<T>
964
3.22k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
3.22k
     , apply_cached_to<T>
966
3.22k
     , cache_func_to<T>
967
3.22k
#endif
968
3.22k
     );
969
970
3.22k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
3.22k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
3.22k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
3.22k
#endif
986
987
3.22k
    return hb_empty_t ();
988
3.22k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GPOS_impl::MarkMarkPosFormat1_2<OT::Layout::MediumTypes> const&)
Line
Count
Source
959
220
  {
960
220
    hb_applicable_t *entry = array.push ();
961
962
220
    entry->init (obj,
963
220
     apply_to<T>
964
220
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
220
     , apply_cached_to<T>
966
220
     , cache_func_to<T>
967
220
#endif
968
220
     );
969
970
220
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
220
    unsigned cost = cache_cost (obj, hb_prioritize);
980
220
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
220
#endif
986
987
220
    return hb_empty_t ();
988
220
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::SmallTypes> >(OT::ContextFormat1_4<OT::Layout::SmallTypes> const&)
Line
Count
Source
959
2.57k
  {
960
2.57k
    hb_applicable_t *entry = array.push ();
961
962
2.57k
    entry->init (obj,
963
2.57k
     apply_to<T>
964
2.57k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
2.57k
     , apply_cached_to<T>
966
2.57k
     , cache_func_to<T>
967
2.57k
#endif
968
2.57k
     );
969
970
2.57k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
2.57k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
2.57k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
2.57k
#endif
986
987
2.57k
    return hb_empty_t ();
988
2.57k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::SmallTypes> >(OT::ContextFormat2_5<OT::Layout::SmallTypes> const&)
Line
Count
Source
959
3.05k
  {
960
3.05k
    hb_applicable_t *entry = array.push ();
961
962
3.05k
    entry->init (obj,
963
3.05k
     apply_to<T>
964
3.05k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
3.05k
     , apply_cached_to<T>
966
3.05k
     , cache_func_to<T>
967
3.05k
#endif
968
3.05k
     );
969
970
3.05k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
3.05k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
3.05k
    if (cost > cache_user_cost && !array.in_error ())
981
2.02k
    {
982
2.02k
      cache_user_idx = array.length - 1;
983
2.02k
      cache_user_cost = cost;
984
2.02k
    }
985
3.05k
#endif
986
987
3.05k
    return hb_empty_t ();
988
3.05k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ContextFormat3>(OT::ContextFormat3 const&)
Line
Count
Source
959
1.14k
  {
960
1.14k
    hb_applicable_t *entry = array.push ();
961
962
1.14k
    entry->init (obj,
963
1.14k
     apply_to<T>
964
1.14k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
1.14k
     , apply_cached_to<T>
966
1.14k
     , cache_func_to<T>
967
1.14k
#endif
968
1.14k
     );
969
970
1.14k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
1.14k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
1.14k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
1.14k
#endif
986
987
1.14k
    return hb_empty_t ();
988
1.14k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ContextFormat1_4<OT::Layout::MediumTypes> >(OT::ContextFormat1_4<OT::Layout::MediumTypes> const&)
Line
Count
Source
959
21
  {
960
21
    hb_applicable_t *entry = array.push ();
961
962
21
    entry->init (obj,
963
21
     apply_to<T>
964
21
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
21
     , apply_cached_to<T>
966
21
     , cache_func_to<T>
967
21
#endif
968
21
     );
969
970
21
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
21
    unsigned cost = cache_cost (obj, hb_prioritize);
980
21
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
21
#endif
986
987
21
    return hb_empty_t ();
988
21
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ContextFormat2_5<OT::Layout::MediumTypes> >(OT::ContextFormat2_5<OT::Layout::MediumTypes> const&)
Line
Count
Source
959
61
  {
960
61
    hb_applicable_t *entry = array.push ();
961
962
61
    entry->init (obj,
963
61
     apply_to<T>
964
61
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
61
     , apply_cached_to<T>
966
61
     , cache_func_to<T>
967
61
#endif
968
61
     );
969
970
61
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
61
    unsigned cost = cache_cost (obj, hb_prioritize);
980
61
    if (cost > cache_user_cost && !array.in_error ())
981
2
    {
982
2
      cache_user_idx = array.length - 1;
983
2
      cache_user_cost = cost;
984
2
    }
985
61
#endif
986
987
61
    return hb_empty_t ();
988
61
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::SmallTypes> >(OT::ChainContextFormat1_4<OT::Layout::SmallTypes> const&)
Line
Count
Source
959
2.17k
  {
960
2.17k
    hb_applicable_t *entry = array.push ();
961
962
2.17k
    entry->init (obj,
963
2.17k
     apply_to<T>
964
2.17k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
2.17k
     , apply_cached_to<T>
966
2.17k
     , cache_func_to<T>
967
2.17k
#endif
968
2.17k
     );
969
970
2.17k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
2.17k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
2.17k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
2.17k
#endif
986
987
2.17k
    return hb_empty_t ();
988
2.17k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::SmallTypes> >(OT::ChainContextFormat2_5<OT::Layout::SmallTypes> const&)
Line
Count
Source
959
5.26k
  {
960
5.26k
    hb_applicable_t *entry = array.push ();
961
962
5.26k
    entry->init (obj,
963
5.26k
     apply_to<T>
964
5.26k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
5.26k
     , apply_cached_to<T>
966
5.26k
     , cache_func_to<T>
967
5.26k
#endif
968
5.26k
     );
969
970
5.26k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
5.26k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
5.26k
    if (cost > cache_user_cost && !array.in_error ())
981
2.01k
    {
982
2.01k
      cache_user_idx = array.length - 1;
983
2.01k
      cache_user_cost = cost;
984
2.01k
    }
985
5.26k
#endif
986
987
5.26k
    return hb_empty_t ();
988
5.26k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ChainContextFormat3>(OT::ChainContextFormat3 const&)
Line
Count
Source
959
30.1k
  {
960
30.1k
    hb_applicable_t *entry = array.push ();
961
962
30.1k
    entry->init (obj,
963
30.1k
     apply_to<T>
964
30.1k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
30.1k
     , apply_cached_to<T>
966
30.1k
     , cache_func_to<T>
967
30.1k
#endif
968
30.1k
     );
969
970
30.1k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
30.1k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
30.1k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
30.1k
#endif
986
987
30.1k
    return hb_empty_t ();
988
30.1k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ChainContextFormat1_4<OT::Layout::MediumTypes> >(OT::ChainContextFormat1_4<OT::Layout::MediumTypes> const&)
Line
Count
Source
959
23
  {
960
23
    hb_applicable_t *entry = array.push ();
961
962
23
    entry->init (obj,
963
23
     apply_to<T>
964
23
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
23
     , apply_cached_to<T>
966
23
     , cache_func_to<T>
967
23
#endif
968
23
     );
969
970
23
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
23
    unsigned cost = cache_cost (obj, hb_prioritize);
980
23
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
23
#endif
986
987
23
    return hb_empty_t ();
988
23
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::ChainContextFormat2_5<OT::Layout::MediumTypes> >(OT::ChainContextFormat2_5<OT::Layout::MediumTypes> const&)
Line
Count
Source
959
50
  {
960
50
    hb_applicable_t *entry = array.push ();
961
962
50
    entry->init (obj,
963
50
     apply_to<T>
964
50
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
50
     , apply_cached_to<T>
966
50
     , cache_func_to<T>
967
50
#endif
968
50
     );
969
970
50
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
50
    unsigned cost = cache_cost (obj, hb_prioritize);
980
50
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
50
#endif
986
987
50
    return hb_empty_t ();
988
50
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::SmallTypes> const&)
Line
Count
Source
959
26.0k
  {
960
26.0k
    hb_applicable_t *entry = array.push ();
961
962
26.0k
    entry->init (obj,
963
26.0k
     apply_to<T>
964
26.0k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
26.0k
     , apply_cached_to<T>
966
26.0k
     , cache_func_to<T>
967
26.0k
#endif
968
26.0k
     );
969
970
26.0k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
26.0k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
26.0k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
26.0k
#endif
986
987
26.0k
    return hb_empty_t ();
988
26.0k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::SmallTypes> const&)
Line
Count
Source
959
16.4k
  {
960
16.4k
    hb_applicable_t *entry = array.push ();
961
962
16.4k
    entry->init (obj,
963
16.4k
     apply_to<T>
964
16.4k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
16.4k
     , apply_cached_to<T>
966
16.4k
     , cache_func_to<T>
967
16.4k
#endif
968
16.4k
     );
969
970
16.4k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
16.4k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
16.4k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
16.4k
#endif
986
987
16.4k
    return hb_empty_t ();
988
16.4k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat1_3<OT::Layout::MediumTypes> const&)
Line
Count
Source
959
1.35k
  {
960
1.35k
    hb_applicable_t *entry = array.push ();
961
962
1.35k
    entry->init (obj,
963
1.35k
     apply_to<T>
964
1.35k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
1.35k
     , apply_cached_to<T>
966
1.35k
     , cache_func_to<T>
967
1.35k
#endif
968
1.35k
     );
969
970
1.35k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
1.35k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
1.35k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
1.35k
#endif
986
987
1.35k
    return hb_empty_t ();
988
1.35k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::SingleSubstFormat2_4<OT::Layout::MediumTypes> const&)
Line
Count
Source
959
540
  {
960
540
    hb_applicable_t *entry = array.push ();
961
962
540
    entry->init (obj,
963
540
     apply_to<T>
964
540
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
540
     , apply_cached_to<T>
966
540
     , cache_func_to<T>
967
540
#endif
968
540
     );
969
970
540
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
540
    unsigned cost = cache_cost (obj, hb_prioritize);
980
540
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
540
#endif
986
987
540
    return hb_empty_t ();
988
540
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::SmallTypes> const&)
Line
Count
Source
959
10.0k
  {
960
10.0k
    hb_applicable_t *entry = array.push ();
961
962
10.0k
    entry->init (obj,
963
10.0k
     apply_to<T>
964
10.0k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
10.0k
     , apply_cached_to<T>
966
10.0k
     , cache_func_to<T>
967
10.0k
#endif
968
10.0k
     );
969
970
10.0k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
10.0k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
10.0k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
10.0k
#endif
986
987
10.0k
    return hb_empty_t ();
988
10.0k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::MultipleSubstFormat1_2<OT::Layout::MediumTypes> const&)
Line
Count
Source
959
290
  {
960
290
    hb_applicable_t *entry = array.push ();
961
962
290
    entry->init (obj,
963
290
     apply_to<T>
964
290
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
290
     , apply_cached_to<T>
966
290
     , cache_func_to<T>
967
290
#endif
968
290
     );
969
970
290
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
290
    unsigned cost = cache_cost (obj, hb_prioritize);
980
290
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
290
#endif
986
987
290
    return hb_empty_t ();
988
290
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::SmallTypes> const&)
Line
Count
Source
959
1.48k
  {
960
1.48k
    hb_applicable_t *entry = array.push ();
961
962
1.48k
    entry->init (obj,
963
1.48k
     apply_to<T>
964
1.48k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
1.48k
     , apply_cached_to<T>
966
1.48k
     , cache_func_to<T>
967
1.48k
#endif
968
1.48k
     );
969
970
1.48k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
1.48k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
1.48k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
1.48k
#endif
986
987
1.48k
    return hb_empty_t ();
988
1.48k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::AlternateSubstFormat1_2<OT::Layout::MediumTypes> const&)
Line
Count
Source
959
71
  {
960
71
    hb_applicable_t *entry = array.push ();
961
962
71
    entry->init (obj,
963
71
     apply_to<T>
964
71
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
71
     , apply_cached_to<T>
966
71
     , cache_func_to<T>
967
71
#endif
968
71
     );
969
970
71
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
71
    unsigned cost = cache_cost (obj, hb_prioritize);
980
71
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
71
#endif
986
987
71
    return hb_empty_t ();
988
71
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::SmallTypes> const&)
Line
Count
Source
959
15.5k
  {
960
15.5k
    hb_applicable_t *entry = array.push ();
961
962
15.5k
    entry->init (obj,
963
15.5k
     apply_to<T>
964
15.5k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
15.5k
     , apply_cached_to<T>
966
15.5k
     , cache_func_to<T>
967
15.5k
#endif
968
15.5k
     );
969
970
15.5k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
15.5k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
15.5k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
15.5k
#endif
986
987
15.5k
    return hb_empty_t ();
988
15.5k
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> >(OT::Layout::GSUB_impl::LigatureSubstFormat1_2<OT::Layout::MediumTypes> const&)
Line
Count
Source
959
41
  {
960
41
    hb_applicable_t *entry = array.push ();
961
962
41
    entry->init (obj,
963
41
     apply_to<T>
964
41
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
41
     , apply_cached_to<T>
966
41
     , cache_func_to<T>
967
41
#endif
968
41
     );
969
970
41
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
41
    unsigned cost = cache_cost (obj, hb_prioritize);
980
41
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
41
#endif
986
987
41
    return hb_empty_t ();
988
41
  }
hb_empty_t OT::hb_accelerate_subtables_context_t::dispatch<OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1>(OT::Layout::GSUB_impl::ReverseChainSingleSubstFormat1 const&)
Line
Count
Source
959
2.84k
  {
960
2.84k
    hb_applicable_t *entry = array.push ();
961
962
2.84k
    entry->init (obj,
963
2.84k
     apply_to<T>
964
2.84k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
965
2.84k
     , apply_cached_to<T>
966
2.84k
     , cache_func_to<T>
967
2.84k
#endif
968
2.84k
     );
969
970
2.84k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
971
    /* Cache handling
972
     *
973
     * We allow one subtable from each lookup to use a cache. The assumption
974
     * being that multiple subtables of the same lookup cannot use a cache
975
     * because the resources they would use will collide.  As such, we ask
976
     * each subtable to tell us how much it costs (which a cache would avoid),
977
     * and we allocate the cache opportunity to the costliest subtable.
978
     */
979
2.84k
    unsigned cost = cache_cost (obj, hb_prioritize);
980
2.84k
    if (cost > cache_user_cost && !array.in_error ())
981
0
    {
982
0
      cache_user_idx = array.length - 1;
983
0
      cache_user_cost = cost;
984
0
    }
985
2.84k
#endif
986
987
2.84k
    return hb_empty_t ();
988
2.84k
  }
989
1.22M
  static return_t default_return_value () { return hb_empty_t (); }
990
991
  hb_accelerate_subtables_context_t (array_t &array_) :
992
166k
             array (array_) {}
993
994
  array_t &array;
995
996
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
997
  unsigned cache_user_idx = (unsigned) -1;
998
  unsigned cache_user_cost = 0;
999
#endif
1000
};
1001
1002
1003
typedef bool (*intersects_func_t) (const hb_set_t *glyphs, unsigned value, const void *data, void *cache);
1004
typedef void (*intersected_glyphs_func_t) (const hb_set_t *glyphs, const void *data, unsigned value, hb_set_t *intersected_glyphs, void *cache);
1005
typedef void (*collect_glyphs_func_t) (hb_set_t *glyphs, unsigned value, const void *data);
1006
typedef bool (*match_func_t) (hb_glyph_info_t &info, unsigned value, const void *data);
1007
1008
struct ContextClosureFuncs
1009
{
1010
  intersects_func_t intersects;
1011
  intersected_glyphs_func_t intersected_glyphs;
1012
};
1013
struct ContextCollectGlyphsFuncs
1014
{
1015
  collect_glyphs_func_t collect;
1016
};
1017
struct ContextApplyFuncs
1018
{
1019
  match_func_t match;
1020
};
1021
struct ChainContextApplyFuncs
1022
{
1023
  match_func_t match[3];
1024
};
1025
1026
1027
static inline bool intersects_glyph (const hb_set_t *glyphs, unsigned value, const void *data HB_UNUSED, void *cache HB_UNUSED)
1028
0
{
1029
0
  return glyphs->has (value);
1030
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-face.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-layout.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::intersects_glyph(hb_set_t const*, unsigned int, void const*, void*)
1031
static inline bool intersects_class (const hb_set_t *glyphs, unsigned value, const void *data, void *cache)
1032
0
{
1033
0
  const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
1034
0
  hb_map_t *map = (hb_map_t *) cache;
1035
1036
0
  hb_codepoint_t *cached_v;
1037
0
  if (map->has (value, &cached_v))
1038
0
    return *cached_v;
1039
1040
0
  bool v = class_def.intersects_class (glyphs, value);
1041
0
  map->set (value, v);
1042
1043
0
  return v;
1044
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-face.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-layout.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::intersects_class(hb_set_t const*, unsigned int, void const*, void*)
1045
static inline bool intersects_coverage (const hb_set_t *glyphs, unsigned value, const void *data, void *cache HB_UNUSED)
1046
0
{
1047
0
  Offset16To<Coverage> coverage;
1048
0
  coverage = value;
1049
0
  return (data+coverage).intersects (glyphs);
1050
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-face.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-layout.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::intersects_coverage(hb_set_t const*, unsigned int, void const*, void*)
1051
1052
1053
static inline void intersected_glyph (const hb_set_t *glyphs HB_UNUSED, const void *data, unsigned value, hb_set_t *intersected_glyphs, HB_UNUSED void *cache)
1054
0
{
1055
0
  unsigned g = reinterpret_cast<const HBUINT16 *>(data)[value];
1056
0
  intersected_glyphs->add (g);
1057
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-face.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-layout.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::intersected_glyph(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
1058
1059
using intersected_class_cache_t = hb_hashmap_t<unsigned, hb_set_t>;
1060
1061
static inline void intersected_class_glyphs (const hb_set_t *glyphs, const void *data, unsigned value, hb_set_t *intersected_glyphs, void *cache)
1062
0
{
1063
0
  const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
1064
1065
0
  intersected_class_cache_t *map = (intersected_class_cache_t *) cache;
1066
1067
0
  hb_set_t *cached_v;
1068
0
  if (map->has (value, &cached_v))
1069
0
  {
1070
0
    intersected_glyphs->union_ (*cached_v);
1071
0
    return;
1072
0
  }
1073
1074
0
  hb_set_t v;
1075
0
  class_def.intersected_class_glyphs (glyphs, value, &v);
1076
1077
0
  intersected_glyphs->union_ (v);
1078
1079
0
  map->set (value, std::move (v));
1080
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-face.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-layout.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::intersected_class_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
1081
1082
static inline void intersected_coverage_glyphs (const hb_set_t *glyphs, const void *data, unsigned value, hb_set_t *intersected_glyphs, HB_UNUSED void *cache)
1083
0
{
1084
0
  Offset16To<Coverage> coverage;
1085
0
  coverage = value;
1086
0
  (data+coverage).intersect_set (*glyphs, *intersected_glyphs);
1087
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-face.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-layout.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::intersected_coverage_glyphs(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*)
1088
1089
1090
template <typename HBUINT>
1091
static inline bool array_is_subset_of (const hb_set_t *glyphs,
1092
               unsigned int count,
1093
               const HBUINT values[],
1094
               intersects_func_t intersects_func,
1095
               const void *intersects_data,
1096
               void *cache)
1097
0
{
1098
0
  for (const auto &_ : + hb_iter (values, count))
1099
0
    if (!intersects_func (glyphs, _, intersects_data, cache)) return false;
1100
0
  return true;
1101
0
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::array_is_subset_of<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-aat-layout.cc:bool OT::array_is_subset_of<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::array_is_subset_of<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::array_is_subset_of<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::array_is_subset_of<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::array_is_subset_of<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::array_is_subset_of<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::array_is_subset_of<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::array_is_subset_of<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::array_is_subset_of<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_set_t const*, unsigned int, void const*, void*), void const*, void*)
1102
1103
1104
static inline void collect_glyph (hb_set_t *glyphs, unsigned value, const void *data HB_UNUSED)
1105
0
{
1106
0
  glyphs->add (value);
1107
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-layout.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::collect_glyph(hb_set_t*, unsigned int, void const*)
1108
static inline void collect_class (hb_set_t *glyphs, unsigned value, const void *data)
1109
0
{
1110
0
  const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
1111
0
  class_def.collect_class (glyphs, value);
1112
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-layout.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::collect_class(hb_set_t*, unsigned int, void const*)
1113
static inline void collect_coverage (hb_set_t *glyphs, unsigned value, const void *data)
1114
0
{
1115
0
  Offset16To<Coverage> coverage;
1116
0
  coverage = value;
1117
0
  (data+coverage).collect_coverage (glyphs);
1118
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-layout.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::collect_coverage(hb_set_t*, unsigned int, void const*)
1119
template <typename HBUINT>
1120
static inline void collect_array (hb_collect_glyphs_context_t *c HB_UNUSED,
1121
          hb_set_t *glyphs,
1122
          unsigned int count,
1123
          const HBUINT values[],
1124
          collect_glyphs_func_t collect_func,
1125
          const void *collect_data)
1126
0
{
1127
0
  return
1128
0
  + hb_iter (values, count)
1129
0
  | hb_apply ([&] (const HBUINT &_) { collect_func (glyphs, _, collect_data); })
Unexecuted instantiation: hb-ot-layout.cc:OT::collect_array<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)::{lambda(OT::IntType<unsigned short, 2u> const&)#1}::operator()(OT::IntType<unsigned short, 2u> const&) const
Unexecuted instantiation: hb-ot-layout.cc:OT::collect_array<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)::{lambda(OT::IntType<unsigned int, 3u> const&)#1}::operator()(OT::IntType<unsigned int, 3u> const&) const
1130
0
  ;
1131
0
}
Unexecuted instantiation: hb-aat-layout.cc:void OT::collect_array<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-aat-layout.cc:void OT::collect_array<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-face.cc:void OT::collect_array<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-face.cc:void OT::collect_array<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-layout.cc:void OT::collect_array<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-layout.cc:void OT::collect_array<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::collect_array<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::collect_array<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::collect_array<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::collect_array<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, hb_set_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, void (*)(hb_set_t*, unsigned int, void const*), void const*)
1132
1133
1134
static inline bool match_glyph (hb_glyph_info_t &info, unsigned value, const void *data HB_UNUSED)
1135
7.82M
{
1136
7.82M
  return info.codepoint == value;
1137
7.82M
}
Unexecuted instantiation: hb-aat-layout.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
hb-ot-layout.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
Line
Count
Source
1135
7.82M
{
1136
7.82M
  return info.codepoint == value;
1137
7.82M
}
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::match_glyph(hb_glyph_info_t&, unsigned int, void const*)
1138
static inline bool match_class (hb_glyph_info_t &info, unsigned value, const void *data)
1139
174
{
1140
174
  const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
1141
174
  return class_def.get_class (info.codepoint) == value;
1142
174
}
Unexecuted instantiation: hb-aat-layout.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
hb-ot-layout.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Line
Count
Source
1139
174
{
1140
174
  const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
1141
174
  return class_def.get_class (info.codepoint) == value;
1142
174
}
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::match_class(hb_glyph_info_t&, unsigned int, void const*)
1143
static inline bool match_class_cached (hb_glyph_info_t &info, unsigned value, const void *data)
1144
0
{
1145
0
  unsigned klass = info.syllable();
1146
0
  if (klass < 255)
1147
0
    return klass == value;
1148
0
  const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
1149
0
  klass = class_def.get_class (info.codepoint);
1150
0
  if (likely (klass < 255))
1151
0
    info.syllable() = klass;
1152
0
  return klass == value;
1153
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-layout.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::match_class_cached(hb_glyph_info_t&, unsigned int, void const*)
1154
static inline bool match_coverage (hb_glyph_info_t &info, unsigned value, const void *data)
1155
146k
{
1156
146k
  Offset16To<Coverage> coverage;
1157
146k
  coverage = value;
1158
146k
  return (data+coverage).get_coverage (info.codepoint) != NOT_COVERED;
1159
146k
}
Unexecuted instantiation: hb-aat-layout.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-face.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
hb-ot-layout.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
Line
Count
Source
1155
146k
{
1156
146k
  Offset16To<Coverage> coverage;
1157
146k
  coverage = value;
1158
146k
  return (data+coverage).get_coverage (info.codepoint) != NOT_COVERED;
1159
146k
}
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::match_coverage(hb_glyph_info_t&, unsigned int, void const*)
1160
1161
template <typename HBUINT>
1162
static inline bool would_match_input (hb_would_apply_context_t *c,
1163
              unsigned int count, /* Including the first glyph (not matched) */
1164
              const HBUINT input[], /* Array of input values--start with second glyph */
1165
              match_func_t match_func,
1166
              const void *match_data)
1167
530
{
1168
530
  if (count != c->len)
1169
502
    return false;
1170
1171
51
  for (unsigned int i = 1; i < count; i++)
1172
28
  {
1173
28
    hb_glyph_info_t info;
1174
28
    info.codepoint = c->glyphs[i];
1175
28
    if (likely (!match_func (info, input[i - 1], match_data)))
1176
5
      return false;
1177
28
  }
1178
1179
23
  return true;
1180
28
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::would_match_input<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::would_match_input<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::would_match_input<OT::IntType<unsigned int, 3u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
hb-ot-layout.cc:bool OT::would_match_input<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Line
Count
Source
1167
530
{
1168
530
  if (count != c->len)
1169
502
    return false;
1170
1171
51
  for (unsigned int i = 1; i < count; i++)
1172
28
  {
1173
28
    hb_glyph_info_t info;
1174
28
    info.codepoint = c->glyphs[i];
1175
28
    if (likely (!match_func (info, input[i - 1], match_data)))
1176
5
      return false;
1177
28
  }
1178
1179
23
  return true;
1180
28
}
Unexecuted instantiation: hb-ot-layout.cc:bool OT::would_match_input<OT::IntType<unsigned int, 3u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::would_match_input<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::would_match_input<OT::IntType<unsigned int, 3u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::would_match_input<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*)
1181
template <typename HBUINT>
1182
static inline bool match_input (hb_ot_apply_context_t *c,
1183
        unsigned int count, /* Including the first glyph (not matched) */
1184
        const HBUINT input[], /* Array of input values--start with second glyph */
1185
        match_func_t match_func,
1186
        const void *match_data,
1187
        unsigned int *end_position,
1188
        unsigned int match_positions[HB_MAX_CONTEXT_LENGTH],
1189
        unsigned int *p_total_component_count = nullptr)
1190
3.35M
{
1191
3.35M
  TRACE_APPLY (nullptr);
1192
1193
3.35M
  if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return_trace (false);
1194
1195
3.34M
  hb_buffer_t *buffer = c->buffer;
1196
1197
3.34M
  hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
1198
3.34M
  skippy_iter.reset (buffer->idx, count - 1);
1199
3.34M
  skippy_iter.set_match_func (match_func, match_data);
1200
3.34M
  skippy_iter.set_glyph_data (input);
1201
1202
  /*
1203
   * This is perhaps the trickiest part of OpenType...  Remarks:
1204
   *
1205
   * - If all components of the ligature were marks, we call this a mark ligature.
1206
   *
1207
   * - If there is no GDEF, and the ligature is NOT a mark ligature, we categorize
1208
   *   it as a ligature glyph.
1209
   *
1210
   * - Ligatures cannot be formed across glyphs attached to different components
1211
   *   of previous ligatures.  Eg. the sequence is LAM,SHADDA,LAM,FATHA,HEH, and
1212
   *   LAM,LAM,HEH form a ligature, leaving SHADDA,FATHA next to eachother.
1213
   *   However, it would be wrong to ligate that SHADDA,FATHA sequence.
1214
   *   There are a couple of exceptions to this:
1215
   *
1216
   *   o If a ligature tries ligating with marks that belong to it itself, go ahead,
1217
   *     assuming that the font designer knows what they are doing (otherwise it can
1218
   *     break Indic stuff when a matra wants to ligate with a conjunct,
1219
   *
1220
   *   o If two marks want to ligate and they belong to different components of the
1221
   *     same ligature glyph, and said ligature glyph is to be ignored according to
1222
   *     mark-filtering rules, then allow.
1223
   *     https://github.com/harfbuzz/harfbuzz/issues/545
1224
   */
1225
1226
3.34M
  unsigned int total_component_count = 0;
1227
3.34M
  total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1228
1229
3.34M
  unsigned int first_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
1230
3.34M
  unsigned int first_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
1231
1232
3.34M
  enum {
1233
3.34M
    LIGBASE_NOT_CHECKED,
1234
3.34M
    LIGBASE_MAY_NOT_SKIP,
1235
3.34M
    LIGBASE_MAY_SKIP
1236
3.34M
  } ligbase = LIGBASE_NOT_CHECKED;
1237
1238
3.34M
  match_positions[0] = buffer->idx;
1239
7.79M
  for (unsigned int i = 1; i < count; i++)
1240
4.64M
  {
1241
4.64M
    unsigned unsafe_to;
1242
4.64M
    if (!skippy_iter.next (&unsafe_to))
1243
201k
    {
1244
201k
      *end_position = unsafe_to;
1245
201k
      return_trace (false);
1246
201k
    }
1247
1248
4.44M
    match_positions[i] = skippy_iter.idx;
1249
1250
4.44M
    unsigned int this_lig_id = _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx]);
1251
4.44M
    unsigned int this_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]);
1252
1253
4.44M
    if (first_lig_id && first_lig_comp)
1254
5
    {
1255
      /* If first component was attached to a previous ligature component,
1256
       * all subsequent components should be attached to the same ligature
1257
       * component, otherwise we shouldn't ligate them... */
1258
5
      if (first_lig_id != this_lig_id || first_lig_comp != this_lig_comp)
1259
5
      {
1260
  /* ...unless, we are attached to a base ligature and that base
1261
   * ligature is ignorable. */
1262
5
  if (ligbase == LIGBASE_NOT_CHECKED)
1263
5
  {
1264
5
    bool found = false;
1265
5
    const auto *out = buffer->out_info;
1266
5
    unsigned int j = buffer->out_len;
1267
5
    while (j && _hb_glyph_info_get_lig_id (&out[j - 1]) == first_lig_id)
1268
5
    {
1269
5
      if (_hb_glyph_info_get_lig_comp (&out[j - 1]) == 0)
1270
5
      {
1271
5
        j--;
1272
5
        found = true;
1273
5
        break;
1274
5
      }
1275
0
      j--;
1276
0
    }
1277
1278
5
    if (found && skippy_iter.may_skip (out[j]) == hb_ot_apply_context_t::matcher_t::SKIP_YES)
1279
0
      ligbase = LIGBASE_MAY_SKIP;
1280
5
    else
1281
5
      ligbase = LIGBASE_MAY_NOT_SKIP;
1282
5
  }
1283
1284
5
  if (ligbase == LIGBASE_MAY_NOT_SKIP)
1285
5
    return_trace (false);
1286
5
      }
1287
5
    }
1288
4.44M
    else
1289
4.44M
    {
1290
      /* If first component was NOT attached to a previous ligature component,
1291
       * all subsequent components should also NOT be attached to any ligature
1292
       * component, unless they are attached to the first component itself! */
1293
4.44M
      if (this_lig_id && this_lig_comp && (this_lig_id != first_lig_id))
1294
0
  return_trace (false);
1295
4.44M
    }
1296
1297
4.44M
    total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->info[skippy_iter.idx]);
1298
4.44M
  }
1299
1300
3.14M
  *end_position = skippy_iter.idx + 1;
1301
1302
3.14M
  if (p_total_component_count)
1303
88.1k
    *p_total_component_count = total_component_count;
1304
1305
3.14M
  return_trace (true);
1306
3.34M
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::match_input<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-aat-layout.cc:bool OT::match_input<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::match_input<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::match_input<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::match_input<OT::HBGlyphID16>(OT::hb_ot_apply_context_t*, unsigned int, OT::HBGlyphID16 const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::match_input<OT::HBGlyphID24>(OT::hb_ot_apply_context_t*, unsigned int, OT::HBGlyphID24 const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
hb-ot-layout.cc:bool OT::match_input<OT::HBGlyphID16>(OT::hb_ot_apply_context_t*, unsigned int, OT::HBGlyphID16 const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
Line
Count
Source
1190
193k
{
1191
193k
  TRACE_APPLY (nullptr);
1192
1193
193k
  if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return_trace (false);
1194
1195
186k
  hb_buffer_t *buffer = c->buffer;
1196
1197
186k
  hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
1198
186k
  skippy_iter.reset (buffer->idx, count - 1);
1199
186k
  skippy_iter.set_match_func (match_func, match_data);
1200
186k
  skippy_iter.set_glyph_data (input);
1201
1202
  /*
1203
   * This is perhaps the trickiest part of OpenType...  Remarks:
1204
   *
1205
   * - If all components of the ligature were marks, we call this a mark ligature.
1206
   *
1207
   * - If there is no GDEF, and the ligature is NOT a mark ligature, we categorize
1208
   *   it as a ligature glyph.
1209
   *
1210
   * - Ligatures cannot be formed across glyphs attached to different components
1211
   *   of previous ligatures.  Eg. the sequence is LAM,SHADDA,LAM,FATHA,HEH, and
1212
   *   LAM,LAM,HEH form a ligature, leaving SHADDA,FATHA next to eachother.
1213
   *   However, it would be wrong to ligate that SHADDA,FATHA sequence.
1214
   *   There are a couple of exceptions to this:
1215
   *
1216
   *   o If a ligature tries ligating with marks that belong to it itself, go ahead,
1217
   *     assuming that the font designer knows what they are doing (otherwise it can
1218
   *     break Indic stuff when a matra wants to ligate with a conjunct,
1219
   *
1220
   *   o If two marks want to ligate and they belong to different components of the
1221
   *     same ligature glyph, and said ligature glyph is to be ignored according to
1222
   *     mark-filtering rules, then allow.
1223
   *     https://github.com/harfbuzz/harfbuzz/issues/545
1224
   */
1225
1226
186k
  unsigned int total_component_count = 0;
1227
186k
  total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1228
1229
186k
  unsigned int first_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
1230
186k
  unsigned int first_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
1231
1232
186k
  enum {
1233
186k
    LIGBASE_NOT_CHECKED,
1234
186k
    LIGBASE_MAY_NOT_SKIP,
1235
186k
    LIGBASE_MAY_SKIP
1236
186k
  } ligbase = LIGBASE_NOT_CHECKED;
1237
1238
186k
  match_positions[0] = buffer->idx;
1239
294k
  for (unsigned int i = 1; i < count; i++)
1240
205k
  {
1241
205k
    unsigned unsafe_to;
1242
205k
    if (!skippy_iter.next (&unsafe_to))
1243
98.3k
    {
1244
98.3k
      *end_position = unsafe_to;
1245
98.3k
      return_trace (false);
1246
98.3k
    }
1247
1248
107k
    match_positions[i] = skippy_iter.idx;
1249
1250
107k
    unsigned int this_lig_id = _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx]);
1251
107k
    unsigned int this_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]);
1252
1253
107k
    if (first_lig_id && first_lig_comp)
1254
5
    {
1255
      /* If first component was attached to a previous ligature component,
1256
       * all subsequent components should be attached to the same ligature
1257
       * component, otherwise we shouldn't ligate them... */
1258
5
      if (first_lig_id != this_lig_id || first_lig_comp != this_lig_comp)
1259
5
      {
1260
  /* ...unless, we are attached to a base ligature and that base
1261
   * ligature is ignorable. */
1262
5
  if (ligbase == LIGBASE_NOT_CHECKED)
1263
5
  {
1264
5
    bool found = false;
1265
5
    const auto *out = buffer->out_info;
1266
5
    unsigned int j = buffer->out_len;
1267
5
    while (j && _hb_glyph_info_get_lig_id (&out[j - 1]) == first_lig_id)
1268
5
    {
1269
5
      if (_hb_glyph_info_get_lig_comp (&out[j - 1]) == 0)
1270
5
      {
1271
5
        j--;
1272
5
        found = true;
1273
5
        break;
1274
5
      }
1275
0
      j--;
1276
0
    }
1277
1278
5
    if (found && skippy_iter.may_skip (out[j]) == hb_ot_apply_context_t::matcher_t::SKIP_YES)
1279
0
      ligbase = LIGBASE_MAY_SKIP;
1280
5
    else
1281
5
      ligbase = LIGBASE_MAY_NOT_SKIP;
1282
5
  }
1283
1284
5
  if (ligbase == LIGBASE_MAY_NOT_SKIP)
1285
5
    return_trace (false);
1286
5
      }
1287
5
    }
1288
107k
    else
1289
107k
    {
1290
      /* If first component was NOT attached to a previous ligature component,
1291
       * all subsequent components should also NOT be attached to any ligature
1292
       * component, unless they are attached to the first component itself! */
1293
107k
      if (this_lig_id && this_lig_comp && (this_lig_id != first_lig_id))
1294
0
  return_trace (false);
1295
107k
    }
1296
1297
107k
    total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->info[skippy_iter.idx]);
1298
107k
  }
1299
1300
88.1k
  *end_position = skippy_iter.idx + 1;
1301
1302
88.1k
  if (p_total_component_count)
1303
88.1k
    *p_total_component_count = total_component_count;
1304
1305
88.1k
  return_trace (true);
1306
186k
}
Unexecuted instantiation: hb-ot-layout.cc:bool OT::match_input<OT::HBGlyphID24>(OT::hb_ot_apply_context_t*, unsigned int, OT::HBGlyphID24 const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
hb-ot-layout.cc:bool OT::match_input<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
Line
Count
Source
1190
3.15M
{
1191
3.15M
  TRACE_APPLY (nullptr);
1192
1193
3.15M
  if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return_trace (false);
1194
1195
3.15M
  hb_buffer_t *buffer = c->buffer;
1196
1197
3.15M
  hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
1198
3.15M
  skippy_iter.reset (buffer->idx, count - 1);
1199
3.15M
  skippy_iter.set_match_func (match_func, match_data);
1200
3.15M
  skippy_iter.set_glyph_data (input);
1201
1202
  /*
1203
   * This is perhaps the trickiest part of OpenType...  Remarks:
1204
   *
1205
   * - If all components of the ligature were marks, we call this a mark ligature.
1206
   *
1207
   * - If there is no GDEF, and the ligature is NOT a mark ligature, we categorize
1208
   *   it as a ligature glyph.
1209
   *
1210
   * - Ligatures cannot be formed across glyphs attached to different components
1211
   *   of previous ligatures.  Eg. the sequence is LAM,SHADDA,LAM,FATHA,HEH, and
1212
   *   LAM,LAM,HEH form a ligature, leaving SHADDA,FATHA next to eachother.
1213
   *   However, it would be wrong to ligate that SHADDA,FATHA sequence.
1214
   *   There are a couple of exceptions to this:
1215
   *
1216
   *   o If a ligature tries ligating with marks that belong to it itself, go ahead,
1217
   *     assuming that the font designer knows what they are doing (otherwise it can
1218
   *     break Indic stuff when a matra wants to ligate with a conjunct,
1219
   *
1220
   *   o If two marks want to ligate and they belong to different components of the
1221
   *     same ligature glyph, and said ligature glyph is to be ignored according to
1222
   *     mark-filtering rules, then allow.
1223
   *     https://github.com/harfbuzz/harfbuzz/issues/545
1224
   */
1225
1226
3.15M
  unsigned int total_component_count = 0;
1227
3.15M
  total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1228
1229
3.15M
  unsigned int first_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
1230
3.15M
  unsigned int first_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
1231
1232
3.15M
  enum {
1233
3.15M
    LIGBASE_NOT_CHECKED,
1234
3.15M
    LIGBASE_MAY_NOT_SKIP,
1235
3.15M
    LIGBASE_MAY_SKIP
1236
3.15M
  } ligbase = LIGBASE_NOT_CHECKED;
1237
1238
3.15M
  match_positions[0] = buffer->idx;
1239
7.49M
  for (unsigned int i = 1; i < count; i++)
1240
4.44M
  {
1241
4.44M
    unsigned unsafe_to;
1242
4.44M
    if (!skippy_iter.next (&unsafe_to))
1243
102k
    {
1244
102k
      *end_position = unsafe_to;
1245
102k
      return_trace (false);
1246
102k
    }
1247
1248
4.34M
    match_positions[i] = skippy_iter.idx;
1249
1250
4.34M
    unsigned int this_lig_id = _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx]);
1251
4.34M
    unsigned int this_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]);
1252
1253
4.34M
    if (first_lig_id && first_lig_comp)
1254
0
    {
1255
      /* If first component was attached to a previous ligature component,
1256
       * all subsequent components should be attached to the same ligature
1257
       * component, otherwise we shouldn't ligate them... */
1258
0
      if (first_lig_id != this_lig_id || first_lig_comp != this_lig_comp)
1259
0
      {
1260
  /* ...unless, we are attached to a base ligature and that base
1261
   * ligature is ignorable. */
1262
0
  if (ligbase == LIGBASE_NOT_CHECKED)
1263
0
  {
1264
0
    bool found = false;
1265
0
    const auto *out = buffer->out_info;
1266
0
    unsigned int j = buffer->out_len;
1267
0
    while (j && _hb_glyph_info_get_lig_id (&out[j - 1]) == first_lig_id)
1268
0
    {
1269
0
      if (_hb_glyph_info_get_lig_comp (&out[j - 1]) == 0)
1270
0
      {
1271
0
        j--;
1272
0
        found = true;
1273
0
        break;
1274
0
      }
1275
0
      j--;
1276
0
    }
1277
1278
0
    if (found && skippy_iter.may_skip (out[j]) == hb_ot_apply_context_t::matcher_t::SKIP_YES)
1279
0
      ligbase = LIGBASE_MAY_SKIP;
1280
0
    else
1281
0
      ligbase = LIGBASE_MAY_NOT_SKIP;
1282
0
  }
1283
1284
0
  if (ligbase == LIGBASE_MAY_NOT_SKIP)
1285
0
    return_trace (false);
1286
0
      }
1287
0
    }
1288
4.34M
    else
1289
4.34M
    {
1290
      /* If first component was NOT attached to a previous ligature component,
1291
       * all subsequent components should also NOT be attached to any ligature
1292
       * component, unless they are attached to the first component itself! */
1293
4.34M
      if (this_lig_id && this_lig_comp && (this_lig_id != first_lig_id))
1294
0
  return_trace (false);
1295
4.34M
    }
1296
1297
4.34M
    total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->info[skippy_iter.idx]);
1298
4.34M
  }
1299
1300
3.05M
  *end_position = skippy_iter.idx + 1;
1301
1302
3.05M
  if (p_total_component_count)
1303
0
    *p_total_component_count = total_component_count;
1304
1305
3.05M
  return_trace (true);
1306
3.15M
}
Unexecuted instantiation: hb-ot-layout.cc:bool OT::match_input<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::match_input<OT::HBGlyphID16>(OT::hb_ot_apply_context_t*, unsigned int, OT::HBGlyphID16 const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::match_input<OT::HBGlyphID24>(OT::hb_ot_apply_context_t*, unsigned int, OT::HBGlyphID24 const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::match_input<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::match_input<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::match_input<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::match_input<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*, unsigned int*, unsigned int*)
1307
static inline bool ligate_input (hb_ot_apply_context_t *c,
1308
         unsigned int count, /* Including the first glyph */
1309
         const unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
1310
         unsigned int match_end,
1311
         hb_codepoint_t lig_glyph,
1312
         unsigned int total_component_count)
1313
88.1k
{
1314
88.1k
  TRACE_APPLY (nullptr);
1315
1316
88.1k
  hb_buffer_t *buffer = c->buffer;
1317
1318
88.1k
  buffer->merge_clusters (buffer->idx, match_end);
1319
1320
  /* - If a base and one or more marks ligate, consider that as a base, NOT
1321
   *   ligature, such that all following marks can still attach to it.
1322
   *   https://github.com/harfbuzz/harfbuzz/issues/1109
1323
   *
1324
   * - If all components of the ligature were marks, we call this a mark ligature.
1325
   *   If it *is* a mark ligature, we don't allocate a new ligature id, and leave
1326
   *   the ligature to keep its old ligature id.  This will allow it to attach to
1327
   *   a base ligature in GPOS.  Eg. if the sequence is: LAM,LAM,SHADDA,FATHA,HEH,
1328
   *   and LAM,LAM,HEH for a ligature, they will leave SHADDA and FATHA with a
1329
   *   ligature id and component value of 2.  Then if SHADDA,FATHA form a ligature
1330
   *   later, we don't want them to lose their ligature id/component, otherwise
1331
   *   GPOS will fail to correctly position the mark ligature on top of the
1332
   *   LAM,LAM,HEH ligature.  See:
1333
   *     https://bugzilla.gnome.org/show_bug.cgi?id=676343
1334
   *
1335
   * - If a ligature is formed of components that some of which are also ligatures
1336
   *   themselves, and those ligature components had marks attached to *their*
1337
   *   components, we have to attach the marks to the new ligature component
1338
   *   positions!  Now *that*'s tricky!  And these marks may be following the
1339
   *   last component of the whole sequence, so we should loop forward looking
1340
   *   for them and update them.
1341
   *
1342
   *   Eg. the sequence is LAM,LAM,SHADDA,FATHA,HEH, and the font first forms a
1343
   *   'calt' ligature of LAM,HEH, leaving the SHADDA and FATHA with a ligature
1344
   *   id and component == 1.  Now, during 'liga', the LAM and the LAM-HEH ligature
1345
   *   form a LAM-LAM-HEH ligature.  We need to reassign the SHADDA and FATHA to
1346
   *   the new ligature with a component value of 2.
1347
   *
1348
   *   This in fact happened to a font...  See:
1349
   *   https://bugzilla.gnome.org/show_bug.cgi?id=437633
1350
   */
1351
1352
88.1k
  bool is_base_ligature = _hb_glyph_info_is_base_glyph (&buffer->info[match_positions[0]]);
1353
88.1k
  bool is_mark_ligature = _hb_glyph_info_is_mark (&buffer->info[match_positions[0]]);
1354
91.3k
  for (unsigned int i = 1; i < count; i++)
1355
88.2k
    if (!_hb_glyph_info_is_mark (&buffer->info[match_positions[i]]))
1356
85.0k
    {
1357
85.0k
      is_base_ligature = false;
1358
85.0k
      is_mark_ligature = false;
1359
85.0k
      break;
1360
85.0k
    }
1361
88.1k
  bool is_ligature = !is_base_ligature && !is_mark_ligature;
1362
1363
88.1k
  unsigned int klass = is_ligature ? HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE : 0;
1364
88.1k
  unsigned int lig_id = is_ligature ? _hb_allocate_lig_id (buffer) : 0;
1365
88.1k
  unsigned int last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
1366
88.1k
  unsigned int last_num_components = _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1367
88.1k
  unsigned int components_so_far = last_num_components;
1368
1369
88.1k
  if (is_ligature)
1370
85.1k
  {
1371
85.1k
    _hb_glyph_info_set_lig_props_for_ligature (&buffer->cur(), lig_id, total_component_count);
1372
85.1k
    if (_hb_glyph_info_get_general_category (&buffer->cur()) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
1373
452
    {
1374
452
      _hb_glyph_info_set_general_category (&buffer->cur(), HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER);
1375
452
    }
1376
85.1k
  }
1377
88.1k
  c->replace_glyph_with_ligature (lig_glyph, klass);
1378
1379
177k
  for (unsigned int i = 1; i < count; i++)
1380
88.9k
  {
1381
89.1k
    while (buffer->idx < match_positions[i] && buffer->successful)
1382
216
    {
1383
216
      if (is_ligature)
1384
216
      {
1385
216
  unsigned int this_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
1386
216
  if (this_comp == 0)
1387
62
    this_comp = last_num_components;
1388
216
  unsigned int new_lig_comp = components_so_far - last_num_components +
1389
216
            hb_min (this_comp, last_num_components);
1390
216
    _hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp);
1391
216
      }
1392
216
      (void) buffer->next_glyph ();
1393
216
    }
1394
1395
88.9k
    last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
1396
88.9k
    last_num_components = _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1397
88.9k
    components_so_far += last_num_components;
1398
1399
    /* Skip the base glyph */
1400
88.9k
    buffer->idx++;
1401
88.9k
  }
1402
1403
88.1k
  if (!is_mark_ligature && last_lig_id)
1404
40.0k
  {
1405
    /* Re-adjust components for any marks following. */
1406
40.9k
    for (unsigned i = buffer->idx; i < buffer->len; ++i)
1407
40.3k
    {
1408
40.3k
      if (last_lig_id != _hb_glyph_info_get_lig_id (&buffer->info[i])) break;
1409
1410
3.28k
      unsigned this_comp = _hb_glyph_info_get_lig_comp (&buffer->info[i]);
1411
3.28k
      if (!this_comp) break;
1412
1413
858
      unsigned new_lig_comp = components_so_far - last_num_components +
1414
858
            hb_min (this_comp, last_num_components);
1415
858
      _hb_glyph_info_set_lig_props_for_mark (&buffer->info[i], lig_id, new_lig_comp);
1416
858
    }
1417
40.0k
  }
1418
88.1k
  return_trace (true);
1419
88.1k
}
Unexecuted instantiation: hb-aat-layout.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int const*, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: hb-ot-face.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int const*, unsigned int, unsigned int, unsigned int)
hb-ot-layout.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int const*, unsigned int, unsigned int, unsigned int)
Line
Count
Source
1313
88.1k
{
1314
88.1k
  TRACE_APPLY (nullptr);
1315
1316
88.1k
  hb_buffer_t *buffer = c->buffer;
1317
1318
88.1k
  buffer->merge_clusters (buffer->idx, match_end);
1319
1320
  /* - If a base and one or more marks ligate, consider that as a base, NOT
1321
   *   ligature, such that all following marks can still attach to it.
1322
   *   https://github.com/harfbuzz/harfbuzz/issues/1109
1323
   *
1324
   * - If all components of the ligature were marks, we call this a mark ligature.
1325
   *   If it *is* a mark ligature, we don't allocate a new ligature id, and leave
1326
   *   the ligature to keep its old ligature id.  This will allow it to attach to
1327
   *   a base ligature in GPOS.  Eg. if the sequence is: LAM,LAM,SHADDA,FATHA,HEH,
1328
   *   and LAM,LAM,HEH for a ligature, they will leave SHADDA and FATHA with a
1329
   *   ligature id and component value of 2.  Then if SHADDA,FATHA form a ligature
1330
   *   later, we don't want them to lose their ligature id/component, otherwise
1331
   *   GPOS will fail to correctly position the mark ligature on top of the
1332
   *   LAM,LAM,HEH ligature.  See:
1333
   *     https://bugzilla.gnome.org/show_bug.cgi?id=676343
1334
   *
1335
   * - If a ligature is formed of components that some of which are also ligatures
1336
   *   themselves, and those ligature components had marks attached to *their*
1337
   *   components, we have to attach the marks to the new ligature component
1338
   *   positions!  Now *that*'s tricky!  And these marks may be following the
1339
   *   last component of the whole sequence, so we should loop forward looking
1340
   *   for them and update them.
1341
   *
1342
   *   Eg. the sequence is LAM,LAM,SHADDA,FATHA,HEH, and the font first forms a
1343
   *   'calt' ligature of LAM,HEH, leaving the SHADDA and FATHA with a ligature
1344
   *   id and component == 1.  Now, during 'liga', the LAM and the LAM-HEH ligature
1345
   *   form a LAM-LAM-HEH ligature.  We need to reassign the SHADDA and FATHA to
1346
   *   the new ligature with a component value of 2.
1347
   *
1348
   *   This in fact happened to a font...  See:
1349
   *   https://bugzilla.gnome.org/show_bug.cgi?id=437633
1350
   */
1351
1352
88.1k
  bool is_base_ligature = _hb_glyph_info_is_base_glyph (&buffer->info[match_positions[0]]);
1353
88.1k
  bool is_mark_ligature = _hb_glyph_info_is_mark (&buffer->info[match_positions[0]]);
1354
91.3k
  for (unsigned int i = 1; i < count; i++)
1355
88.2k
    if (!_hb_glyph_info_is_mark (&buffer->info[match_positions[i]]))
1356
85.0k
    {
1357
85.0k
      is_base_ligature = false;
1358
85.0k
      is_mark_ligature = false;
1359
85.0k
      break;
1360
85.0k
    }
1361
88.1k
  bool is_ligature = !is_base_ligature && !is_mark_ligature;
1362
1363
88.1k
  unsigned int klass = is_ligature ? HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE : 0;
1364
88.1k
  unsigned int lig_id = is_ligature ? _hb_allocate_lig_id (buffer) : 0;
1365
88.1k
  unsigned int last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
1366
88.1k
  unsigned int last_num_components = _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1367
88.1k
  unsigned int components_so_far = last_num_components;
1368
1369
88.1k
  if (is_ligature)
1370
85.1k
  {
1371
85.1k
    _hb_glyph_info_set_lig_props_for_ligature (&buffer->cur(), lig_id, total_component_count);
1372
85.1k
    if (_hb_glyph_info_get_general_category (&buffer->cur()) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
1373
452
    {
1374
452
      _hb_glyph_info_set_general_category (&buffer->cur(), HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER);
1375
452
    }
1376
85.1k
  }
1377
88.1k
  c->replace_glyph_with_ligature (lig_glyph, klass);
1378
1379
177k
  for (unsigned int i = 1; i < count; i++)
1380
88.9k
  {
1381
89.1k
    while (buffer->idx < match_positions[i] && buffer->successful)
1382
216
    {
1383
216
      if (is_ligature)
1384
216
      {
1385
216
  unsigned int this_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
1386
216
  if (this_comp == 0)
1387
62
    this_comp = last_num_components;
1388
216
  unsigned int new_lig_comp = components_so_far - last_num_components +
1389
216
            hb_min (this_comp, last_num_components);
1390
216
    _hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp);
1391
216
      }
1392
216
      (void) buffer->next_glyph ();
1393
216
    }
1394
1395
88.9k
    last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
1396
88.9k
    last_num_components = _hb_glyph_info_get_lig_num_comps (&buffer->cur());
1397
88.9k
    components_so_far += last_num_components;
1398
1399
    /* Skip the base glyph */
1400
88.9k
    buffer->idx++;
1401
88.9k
  }
1402
1403
88.1k
  if (!is_mark_ligature && last_lig_id)
1404
40.0k
  {
1405
    /* Re-adjust components for any marks following. */
1406
40.9k
    for (unsigned i = buffer->idx; i < buffer->len; ++i)
1407
40.3k
    {
1408
40.3k
      if (last_lig_id != _hb_glyph_info_get_lig_id (&buffer->info[i])) break;
1409
1410
3.28k
      unsigned this_comp = _hb_glyph_info_get_lig_comp (&buffer->info[i]);
1411
3.28k
      if (!this_comp) break;
1412
1413
858
      unsigned new_lig_comp = components_so_far - last_num_components +
1414
858
            hb_min (this_comp, last_num_components);
1415
858
      _hb_glyph_info_set_lig_props_for_mark (&buffer->info[i], lig_id, new_lig_comp);
1416
858
    }
1417
40.0k
  }
1418
88.1k
  return_trace (true);
1419
88.1k
}
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int const*, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::ligate_input(OT::hb_ot_apply_context_t*, unsigned int, unsigned int const*, unsigned int, unsigned int, unsigned int)
1420
1421
template <typename HBUINT>
1422
static inline bool match_backtrack (hb_ot_apply_context_t *c,
1423
            unsigned int count,
1424
            const HBUINT backtrack[],
1425
            match_func_t match_func,
1426
            const void *match_data,
1427
            unsigned int *match_start)
1428
1.60M
{
1429
1.60M
  TRACE_APPLY (nullptr);
1430
1431
1.60M
  hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context;
1432
1.60M
  skippy_iter.reset (c->buffer->backtrack_len (), count);
1433
1.60M
  skippy_iter.set_match_func (match_func, match_data);
1434
1.60M
  skippy_iter.set_glyph_data (backtrack);
1435
1436
3.62M
  for (unsigned int i = 0; i < count; i++)
1437
2.05M
  {
1438
2.05M
    unsigned unsafe_from;
1439
2.05M
    if (!skippy_iter.prev (&unsafe_from))
1440
32.9k
    {
1441
32.9k
      *match_start = unsafe_from;
1442
32.9k
      return_trace (false);
1443
32.9k
    }
1444
2.05M
  }
1445
1446
1.56M
  *match_start = skippy_iter.idx;
1447
1.56M
  return_trace (true);
1448
1.60M
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::match_backtrack<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-aat-layout.cc:bool OT::match_backtrack<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::match_backtrack<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::match_backtrack<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
hb-ot-layout.cc:bool OT::match_backtrack<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Line
Count
Source
1428
1.60M
{
1429
1.60M
  TRACE_APPLY (nullptr);
1430
1431
1.60M
  hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context;
1432
1.60M
  skippy_iter.reset (c->buffer->backtrack_len (), count);
1433
1.60M
  skippy_iter.set_match_func (match_func, match_data);
1434
1.60M
  skippy_iter.set_glyph_data (backtrack);
1435
1436
3.62M
  for (unsigned int i = 0; i < count; i++)
1437
2.05M
  {
1438
2.05M
    unsigned unsafe_from;
1439
2.05M
    if (!skippy_iter.prev (&unsafe_from))
1440
32.9k
    {
1441
32.9k
      *match_start = unsafe_from;
1442
32.9k
      return_trace (false);
1443
32.9k
    }
1444
2.05M
  }
1445
1446
1.56M
  *match_start = skippy_iter.idx;
1447
1.56M
  return_trace (true);
1448
1.60M
}
Unexecuted instantiation: hb-ot-layout.cc:bool OT::match_backtrack<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::match_backtrack<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::match_backtrack<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::match_backtrack<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::match_backtrack<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int*)
1449
1450
template <typename HBUINT>
1451
static inline bool match_lookahead (hb_ot_apply_context_t *c,
1452
            unsigned int count,
1453
            const HBUINT lookahead[],
1454
            match_func_t match_func,
1455
            const void *match_data,
1456
            unsigned int start_index,
1457
            unsigned int *end_index)
1458
1.61M
{
1459
1.61M
  TRACE_APPLY (nullptr);
1460
1461
1.61M
  hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context;
1462
1.61M
  skippy_iter.reset (start_index - 1, count);
1463
1.61M
  skippy_iter.set_match_func (match_func, match_data);
1464
1.61M
  skippy_iter.set_glyph_data (lookahead);
1465
1466
2.93M
  for (unsigned int i = 0; i < count; i++)
1467
1.34M
  {
1468
1.34M
    unsigned unsafe_to;
1469
1.34M
    if (!skippy_iter.next (&unsafe_to))
1470
11.0k
    {
1471
11.0k
      *end_index = unsafe_to;
1472
11.0k
      return_trace (false);
1473
11.0k
    }
1474
1.34M
  }
1475
1476
1.59M
  *end_index = skippy_iter.idx + 1;
1477
1.59M
  return_trace (true);
1478
1.61M
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::match_lookahead<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-aat-layout.cc:bool OT::match_lookahead<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::match_lookahead<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-ot-face.cc:bool OT::match_lookahead<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
hb-ot-layout.cc:bool OT::match_lookahead<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Line
Count
Source
1458
1.61M
{
1459
1.61M
  TRACE_APPLY (nullptr);
1460
1461
1.61M
  hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context;
1462
1.61M
  skippy_iter.reset (start_index - 1, count);
1463
1.61M
  skippy_iter.set_match_func (match_func, match_data);
1464
1.61M
  skippy_iter.set_glyph_data (lookahead);
1465
1466
2.93M
  for (unsigned int i = 0; i < count; i++)
1467
1.34M
  {
1468
1.34M
    unsigned unsafe_to;
1469
1.34M
    if (!skippy_iter.next (&unsafe_to))
1470
11.0k
    {
1471
11.0k
      *end_index = unsafe_to;
1472
11.0k
      return_trace (false);
1473
11.0k
    }
1474
1.34M
  }
1475
1476
1.59M
  *end_index = skippy_iter.idx + 1;
1477
1.59M
  return_trace (true);
1478
1.61M
}
Unexecuted instantiation: hb-ot-layout.cc:bool OT::match_lookahead<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::match_lookahead<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::match_lookahead<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::match_lookahead<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::match_lookahead<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, bool (*)(hb_glyph_info_t&, unsigned int, void const*), void const*, unsigned int, unsigned int*)
1479
1480
1481
1482
struct LookupRecord
1483
{
1484
  bool serialize (hb_serialize_context_t *c,
1485
      const hb_map_t         *lookup_map) const
1486
0
  {
1487
0
    TRACE_SERIALIZE (this);
1488
0
    auto *out = c->embed (*this);
1489
0
    if (unlikely (!out)) return_trace (false);
1490
0
1491
0
    return_trace (c->check_assign (out->lookupListIndex, lookup_map->get (lookupListIndex), HB_SERIALIZE_ERROR_INT_OVERFLOW));
1492
0
  }
1493
1494
  bool sanitize (hb_sanitize_context_t *c) const
1495
0
  {
1496
0
    TRACE_SANITIZE (this);
1497
0
    return_trace (c->check_struct (this));
1498
0
  }
1499
1500
  HBUINT16  sequenceIndex;    /* Index into current glyph
1501
           * sequence--first glyph = 0 */
1502
  HBUINT16  lookupListIndex;  /* Lookup to apply to that
1503
           * position--zero--based */
1504
  public:
1505
  DEFINE_SIZE_STATIC (4);
1506
};
1507
1508
static unsigned serialize_lookuprecord_array (hb_serialize_context_t *c,
1509
                const hb_array_t<const LookupRecord> lookupRecords,
1510
                const hb_map_t *lookup_map)
1511
0
{
1512
0
  unsigned count = 0;
1513
0
  for (const LookupRecord& r : lookupRecords)
1514
0
  {
1515
0
    if (!lookup_map->has (r.lookupListIndex))
1516
0
      continue;
1517
0
1518
0
    if (!r.serialize (c, lookup_map))
1519
0
      return 0;
1520
0
1521
0
    count++;
1522
0
  }
1523
0
  return count;
1524
0
}
Unexecuted instantiation: hb-aat-layout.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-ot-face.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-ot-layout.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::serialize_lookuprecord_array(hb_serialize_context_t*, hb_array_t<OT::LookupRecord const>, hb_map_t const*)
1525
1526
enum ContextFormat { SimpleContext = 1, ClassBasedContext = 2, CoverageBasedContext = 3 };
1527
1528
template <typename HBUINT>
1529
static void context_closure_recurse_lookups (hb_closure_context_t *c,
1530
               unsigned inputCount, const HBUINT input[],
1531
               unsigned lookupCount,
1532
               const LookupRecord lookupRecord[] /* Array of LookupRecords--in design order */,
1533
               unsigned value,
1534
               ContextFormat context_format,
1535
               const void *data,
1536
               intersected_glyphs_func_t intersected_glyphs_func,
1537
               void *cache)
1538
0
{
1539
0
  hb_set_t covered_seq_indicies;
1540
0
  hb_set_t pos_glyphs;
1541
0
  for (unsigned int i = 0; i < lookupCount; i++)
1542
0
  {
1543
0
    unsigned seqIndex = lookupRecord[i].sequenceIndex;
1544
0
    if (seqIndex >= inputCount) continue;
1545
1546
0
    bool has_pos_glyphs = false;
1547
1548
0
    if (!covered_seq_indicies.has (seqIndex))
1549
0
    {
1550
0
      has_pos_glyphs = true;
1551
0
      pos_glyphs.clear ();
1552
0
      if (seqIndex == 0)
1553
0
      {
1554
0
        switch (context_format) {
1555
0
        case ContextFormat::SimpleContext:
1556
0
          pos_glyphs.add (value);
1557
0
          break;
1558
0
        case ContextFormat::ClassBasedContext:
1559
0
          intersected_glyphs_func (&c->parent_active_glyphs (), data, value, &pos_glyphs, cache);
1560
0
          break;
1561
0
        case ContextFormat::CoverageBasedContext:
1562
0
          pos_glyphs.set (c->parent_active_glyphs ());
1563
0
          break;
1564
0
        }
1565
0
      }
1566
0
      else
1567
0
      {
1568
0
        const void *input_data = input;
1569
0
        unsigned input_value = seqIndex - 1;
1570
0
        if (context_format != ContextFormat::SimpleContext)
1571
0
        {
1572
0
          input_data = data;
1573
0
          input_value = input[seqIndex - 1];
1574
0
        }
1575
1576
0
        intersected_glyphs_func (c->glyphs, input_data, input_value, &pos_glyphs, cache);
1577
0
      }
1578
0
    }
1579
1580
0
    covered_seq_indicies.add (seqIndex);
1581
0
    if (has_pos_glyphs) {
1582
0
      c->push_cur_active_glyphs () = std::move (pos_glyphs);
1583
0
    } else {
1584
0
      c->push_cur_active_glyphs ().set (*c->glyphs);
1585
0
    }
1586
1587
0
    unsigned endIndex = inputCount;
1588
0
    if (context_format == ContextFormat::CoverageBasedContext)
1589
0
      endIndex += 1;
1590
1591
0
    c->recurse (lookupRecord[i].lookupListIndex, &covered_seq_indicies, seqIndex, endIndex);
1592
1593
0
    c->pop_cur_done_glyphs ();
1594
0
  }
1595
0
}
Unexecuted instantiation: hb-aat-layout.cc:void OT::context_closure_recurse_lookups<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-ot-face.cc:void OT::context_closure_recurse_lookups<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-ot-face.cc:void OT::context_closure_recurse_lookups<OT::IntType<unsigned int, 3u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-ot-layout.cc:void OT::context_closure_recurse_lookups<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-ot-layout.cc:void OT::context_closure_recurse_lookups<OT::IntType<unsigned int, 3u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::context_closure_recurse_lookups<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::context_closure_recurse_lookups<OT::IntType<unsigned int, 3u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::context_closure_recurse_lookups<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextFormat, void const*, void (*)(hb_set_t const*, void const*, unsigned int, hb_set_t*, void*), void*)
1596
1597
template <typename context_t>
1598
static inline void recurse_lookups (context_t *c,
1599
                                    unsigned int lookupCount,
1600
                                    const LookupRecord lookupRecord[] /* Array of LookupRecords--in design order */)
1601
0
{
1602
0
  for (unsigned int i = 0; i < lookupCount; i++)
1603
0
    c->recurse (lookupRecord[i].lookupListIndex);
1604
0
}
Unexecuted instantiation: hb-aat-layout.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-aat-layout.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-face.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-face.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-layout.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-layout.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::recurse_lookups<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*, unsigned int, OT::LookupRecord const*)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::recurse_lookups<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*, unsigned int, OT::LookupRecord const*)
1605
1606
static inline void apply_lookup (hb_ot_apply_context_t *c,
1607
         unsigned int count, /* Including the first glyph */
1608
         unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
1609
         unsigned int lookupCount,
1610
         const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
1611
         unsigned int match_end)
1612
3.01M
{
1613
3.01M
  hb_buffer_t *buffer = c->buffer;
1614
3.01M
  int end;
1615
1616
  /* All positions are distance from beginning of *output* buffer.
1617
   * Adjust. */
1618
3.01M
  {
1619
3.01M
    unsigned int bl = buffer->backtrack_len ();
1620
3.01M
    end = bl + match_end - buffer->idx;
1621
1622
3.01M
    int delta = bl - buffer->idx;
1623
    /* Convert positions to new indexing. */
1624
10.3M
    for (unsigned int j = 0; j < count; j++)
1625
7.32M
      match_positions[j] += delta;
1626
3.01M
  }
1627
1628
1.54G
  for (unsigned int i = 0; i < lookupCount && buffer->successful; i++)
1629
1.54G
  {
1630
1.54G
    unsigned int idx = lookupRecord[i].sequenceIndex;
1631
1.54G
    if (idx >= count)
1632
969M
      continue;
1633
1634
576M
    unsigned int orig_len = buffer->backtrack_len () + buffer->lookahead_len ();
1635
1636
    /* This can happen if earlier recursed lookups deleted many entries. */
1637
576M
    if (unlikely (match_positions[idx] >= orig_len))
1638
24.3k
      continue;
1639
1640
576M
    if (unlikely (!buffer->move_to (match_positions[idx])))
1641
1
      break;
1642
1643
576M
    if (unlikely (buffer->max_ops <= 0))
1644
23.0k
      break;
1645
1646
576M
    if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
1647
0
    {
1648
0
      if (buffer->have_output)
1649
0
        c->buffer->sync_so_far ();
1650
0
      c->buffer->message (c->font,
1651
0
        "recursing to lookup %u at %u",
1652
0
        (unsigned) lookupRecord[i].lookupListIndex,
1653
0
        buffer->idx);
1654
0
    }
1655
1656
576M
    if (!c->recurse (lookupRecord[i].lookupListIndex))
1657
573M
      continue;
1658
1659
3.27M
    if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
1660
0
    {
1661
0
      if (buffer->have_output)
1662
0
        c->buffer->sync_so_far ();
1663
0
      c->buffer->message (c->font,
1664
0
        "recursed to lookup %u",
1665
0
        (unsigned) lookupRecord[i].lookupListIndex);
1666
0
    }
1667
1668
3.27M
    unsigned int new_len = buffer->backtrack_len () + buffer->lookahead_len ();
1669
3.27M
    int delta = new_len - orig_len;
1670
1671
3.27M
    if (!delta)
1672
2.72M
      continue;
1673
1674
    /* Recursed lookup changed buffer len.  Adjust.
1675
     *
1676
     * TODO:
1677
     *
1678
     * Right now, if buffer length increased by n, we assume n new glyphs
1679
     * were added right after the current position, and if buffer length
1680
     * was decreased by n, we assume n match positions after the current
1681
     * one where removed.  The former (buffer length increased) case is
1682
     * fine, but the decrease case can be improved in at least two ways,
1683
     * both of which are significant:
1684
     *
1685
     *   - If recursed-to lookup is MultipleSubst and buffer length
1686
     *     decreased, then it's current match position that was deleted,
1687
     *     NOT the one after it.
1688
     *
1689
     *   - If buffer length was decreased by n, it does not necessarily
1690
     *     mean that n match positions where removed, as there recursed-to
1691
     *     lookup might had a different LookupFlag.  Here's a constructed
1692
     *     case of that:
1693
     *     https://github.com/harfbuzz/harfbuzz/discussions/3538
1694
     *
1695
     * It should be possible to construct tests for both of these cases.
1696
     */
1697
1698
547k
    end += delta;
1699
547k
    if (end < int (match_positions[idx]))
1700
13.3k
    {
1701
      /* End might end up being smaller than match_positions[idx] if the recursed
1702
       * lookup ended up removing many items.
1703
       * Just never rewind end beyond start of current position, since that is
1704
       * not possible in the recursed lookup.  Also adjust delta as such.
1705
       *
1706
       * https://bugs.chromium.org/p/chromium/issues/detail?id=659496
1707
       * https://github.com/harfbuzz/harfbuzz/issues/1611
1708
       */
1709
13.3k
      delta += match_positions[idx] - end;
1710
13.3k
      end = match_positions[idx];
1711
13.3k
    }
1712
1713
547k
    unsigned int next = idx + 1; /* next now is the position after the recursed lookup. */
1714
1715
547k
    if (delta > 0)
1716
422k
    {
1717
422k
      if (unlikely (delta + count > HB_MAX_CONTEXT_LENGTH))
1718
159k
  break;
1719
422k
    }
1720
124k
    else
1721
124k
    {
1722
      /* NOTE: delta is non-positive. */
1723
124k
      delta = hb_max (delta, (int) next - (int) count);
1724
124k
      next -= delta;
1725
124k
    }
1726
1727
    /* Shift! */
1728
387k
    memmove (match_positions + next + delta, match_positions + next,
1729
387k
       (count - next) * sizeof (match_positions[0]));
1730
387k
    next += delta;
1731
387k
    count += delta;
1732
1733
    /* Fill in new entries. */
1734
1.44M
    for (unsigned int j = idx + 1; j < next; j++)
1735
1.06M
      match_positions[j] = match_positions[j - 1] + 1;
1736
1737
    /* And fixup the rest. */
1738
2.71M
    for (; next < count; next++)
1739
2.32M
      match_positions[next] += delta;
1740
387k
  }
1741
1742
3.01M
  (void) buffer->move_to (end);
1743
3.01M
}
Unexecuted instantiation: hb-aat-layout.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int*, unsigned int, OT::LookupRecord const*, unsigned int)
Unexecuted instantiation: hb-ot-face.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int*, unsigned int, OT::LookupRecord const*, unsigned int)
hb-ot-layout.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int*, unsigned int, OT::LookupRecord const*, unsigned int)
Line
Count
Source
1612
3.01M
{
1613
3.01M
  hb_buffer_t *buffer = c->buffer;
1614
3.01M
  int end;
1615
1616
  /* All positions are distance from beginning of *output* buffer.
1617
   * Adjust. */
1618
3.01M
  {
1619
3.01M
    unsigned int bl = buffer->backtrack_len ();
1620
3.01M
    end = bl + match_end - buffer->idx;
1621
1622
3.01M
    int delta = bl - buffer->idx;
1623
    /* Convert positions to new indexing. */
1624
10.3M
    for (unsigned int j = 0; j < count; j++)
1625
7.32M
      match_positions[j] += delta;
1626
3.01M
  }
1627
1628
1.54G
  for (unsigned int i = 0; i < lookupCount && buffer->successful; i++)
1629
1.54G
  {
1630
1.54G
    unsigned int idx = lookupRecord[i].sequenceIndex;
1631
1.54G
    if (idx >= count)
1632
969M
      continue;
1633
1634
576M
    unsigned int orig_len = buffer->backtrack_len () + buffer->lookahead_len ();
1635
1636
    /* This can happen if earlier recursed lookups deleted many entries. */
1637
576M
    if (unlikely (match_positions[idx] >= orig_len))
1638
24.3k
      continue;
1639
1640
576M
    if (unlikely (!buffer->move_to (match_positions[idx])))
1641
1
      break;
1642
1643
576M
    if (unlikely (buffer->max_ops <= 0))
1644
23.0k
      break;
1645
1646
576M
    if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
1647
0
    {
1648
0
      if (buffer->have_output)
1649
0
        c->buffer->sync_so_far ();
1650
0
      c->buffer->message (c->font,
1651
0
        "recursing to lookup %u at %u",
1652
0
        (unsigned) lookupRecord[i].lookupListIndex,
1653
0
        buffer->idx);
1654
0
    }
1655
1656
576M
    if (!c->recurse (lookupRecord[i].lookupListIndex))
1657
573M
      continue;
1658
1659
3.27M
    if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
1660
0
    {
1661
0
      if (buffer->have_output)
1662
0
        c->buffer->sync_so_far ();
1663
0
      c->buffer->message (c->font,
1664
0
        "recursed to lookup %u",
1665
0
        (unsigned) lookupRecord[i].lookupListIndex);
1666
0
    }
1667
1668
3.27M
    unsigned int new_len = buffer->backtrack_len () + buffer->lookahead_len ();
1669
3.27M
    int delta = new_len - orig_len;
1670
1671
3.27M
    if (!delta)
1672
2.72M
      continue;
1673
1674
    /* Recursed lookup changed buffer len.  Adjust.
1675
     *
1676
     * TODO:
1677
     *
1678
     * Right now, if buffer length increased by n, we assume n new glyphs
1679
     * were added right after the current position, and if buffer length
1680
     * was decreased by n, we assume n match positions after the current
1681
     * one where removed.  The former (buffer length increased) case is
1682
     * fine, but the decrease case can be improved in at least two ways,
1683
     * both of which are significant:
1684
     *
1685
     *   - If recursed-to lookup is MultipleSubst and buffer length
1686
     *     decreased, then it's current match position that was deleted,
1687
     *     NOT the one after it.
1688
     *
1689
     *   - If buffer length was decreased by n, it does not necessarily
1690
     *     mean that n match positions where removed, as there recursed-to
1691
     *     lookup might had a different LookupFlag.  Here's a constructed
1692
     *     case of that:
1693
     *     https://github.com/harfbuzz/harfbuzz/discussions/3538
1694
     *
1695
     * It should be possible to construct tests for both of these cases.
1696
     */
1697
1698
547k
    end += delta;
1699
547k
    if (end < int (match_positions[idx]))
1700
13.3k
    {
1701
      /* End might end up being smaller than match_positions[idx] if the recursed
1702
       * lookup ended up removing many items.
1703
       * Just never rewind end beyond start of current position, since that is
1704
       * not possible in the recursed lookup.  Also adjust delta as such.
1705
       *
1706
       * https://bugs.chromium.org/p/chromium/issues/detail?id=659496
1707
       * https://github.com/harfbuzz/harfbuzz/issues/1611
1708
       */
1709
13.3k
      delta += match_positions[idx] - end;
1710
13.3k
      end = match_positions[idx];
1711
13.3k
    }
1712
1713
547k
    unsigned int next = idx + 1; /* next now is the position after the recursed lookup. */
1714
1715
547k
    if (delta > 0)
1716
422k
    {
1717
422k
      if (unlikely (delta + count > HB_MAX_CONTEXT_LENGTH))
1718
159k
  break;
1719
422k
    }
1720
124k
    else
1721
124k
    {
1722
      /* NOTE: delta is non-positive. */
1723
124k
      delta = hb_max (delta, (int) next - (int) count);
1724
124k
      next -= delta;
1725
124k
    }
1726
1727
    /* Shift! */
1728
387k
    memmove (match_positions + next + delta, match_positions + next,
1729
387k
       (count - next) * sizeof (match_positions[0]));
1730
387k
    next += delta;
1731
387k
    count += delta;
1732
1733
    /* Fill in new entries. */
1734
1.44M
    for (unsigned int j = idx + 1; j < next; j++)
1735
1.06M
      match_positions[j] = match_positions[j - 1] + 1;
1736
1737
    /* And fixup the rest. */
1738
2.71M
    for (; next < count; next++)
1739
2.32M
      match_positions[next] += delta;
1740
387k
  }
1741
1742
3.01M
  (void) buffer->move_to (end);
1743
3.01M
}
Unexecuted instantiation: hb-ot-shaper-arabic.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int*, unsigned int, OT::LookupRecord const*, unsigned int)
Unexecuted instantiation: hb-ot-shape-fallback.cc:OT::apply_lookup(OT::hb_ot_apply_context_t*, unsigned int, unsigned int*, unsigned int, OT::LookupRecord const*, unsigned int)
1744
1745
1746
1747
/* Contextual lookups */
1748
1749
struct ContextClosureLookupContext
1750
{
1751
  ContextClosureFuncs funcs;
1752
  ContextFormat context_format;
1753
  const void *intersects_data;
1754
  void *intersects_cache;
1755
  void *intersected_glyphs_cache;
1756
};
1757
1758
struct ContextCollectGlyphsLookupContext
1759
{
1760
  ContextCollectGlyphsFuncs funcs;
1761
  const void *collect_data;
1762
};
1763
1764
struct ContextApplyLookupContext
1765
{
1766
  ContextApplyFuncs funcs;
1767
  const void *match_data;
1768
};
1769
1770
template <typename HBUINT>
1771
static inline bool context_intersects (const hb_set_t *glyphs,
1772
               unsigned int inputCount, /* Including the first glyph (not matched) */
1773
               const HBUINT input[], /* Array of input values--start with second glyph */
1774
               ContextClosureLookupContext &lookup_context)
1775
0
{
1776
0
  return array_is_subset_of (glyphs,
1777
0
           inputCount ? inputCount - 1 : 0, input,
1778
0
           lookup_context.funcs.intersects,
1779
0
           lookup_context.intersects_data,
1780
0
           lookup_context.intersects_cache);
1781
0
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::context_intersects<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-aat-layout.cc:bool OT::context_intersects<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::context_intersects<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::context_intersects<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::context_intersects<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::context_intersects<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::context_intersects<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::context_intersects<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::context_intersects<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::context_intersects<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, OT::ContextClosureLookupContext&)
1782
1783
template <typename HBUINT>
1784
static inline void context_closure_lookup (hb_closure_context_t *c,
1785
             unsigned int inputCount, /* Including the first glyph (not matched) */
1786
             const HBUINT input[], /* Array of input values--start with second glyph */
1787
             unsigned int lookupCount,
1788
             const LookupRecord lookupRecord[],
1789
             unsigned value, /* Index of first glyph in Coverage or Class value in ClassDef table */
1790
             ContextClosureLookupContext &lookup_context)
1791
0
{
1792
0
  if (context_intersects (c->glyphs,
1793
0
        inputCount, input,
1794
0
        lookup_context))
1795
0
    context_closure_recurse_lookups (c,
1796
0
             inputCount, input,
1797
0
             lookupCount, lookupRecord,
1798
0
             value,
1799
0
             lookup_context.context_format,
1800
0
             lookup_context.intersects_data,
1801
0
             lookup_context.funcs.intersected_glyphs,
1802
0
             lookup_context.intersected_glyphs_cache);
1803
0
}
Unexecuted instantiation: hb-aat-layout.cc:void OT::context_closure_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:void OT::context_closure_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:void OT::context_closure_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:void OT::context_closure_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:void OT::context_closure_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::context_closure_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::context_closure_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::context_closure_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ContextClosureLookupContext&)
1804
1805
template <typename HBUINT>
1806
static inline void context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c,
1807
              unsigned int inputCount, /* Including the first glyph (not matched) */
1808
              const HBUINT input[], /* Array of input values--start with second glyph */
1809
              unsigned int lookupCount,
1810
              const LookupRecord lookupRecord[],
1811
              ContextCollectGlyphsLookupContext &lookup_context)
1812
0
{
1813
0
  collect_array (c, c->input,
1814
0
     inputCount ? inputCount - 1 : 0, input,
1815
0
     lookup_context.funcs.collect, lookup_context.collect_data);
1816
0
  recurse_lookups (c,
1817
0
       lookupCount, lookupRecord);
1818
0
}
Unexecuted instantiation: hb-aat-layout.cc:void OT::context_collect_glyphs_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-aat-layout.cc:void OT::context_collect_glyphs_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:void OT::context_collect_glyphs_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:void OT::context_collect_glyphs_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:void OT::context_collect_glyphs_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:void OT::context_collect_glyphs_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::context_collect_glyphs_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::context_collect_glyphs_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::context_collect_glyphs_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::context_collect_glyphs_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ContextCollectGlyphsLookupContext&)
1819
1820
template <typename HBUINT>
1821
static inline bool context_would_apply_lookup (hb_would_apply_context_t *c,
1822
                 unsigned int inputCount, /* Including the first glyph (not matched) */
1823
                 const HBUINT input[], /* Array of input values--start with second glyph */
1824
                 unsigned int lookupCount HB_UNUSED,
1825
                 const LookupRecord lookupRecord[] HB_UNUSED,
1826
                 const ContextApplyLookupContext &lookup_context)
1827
427
{
1828
427
  return would_match_input (c,
1829
427
          inputCount, input,
1830
427
          lookup_context.funcs.match, lookup_context.match_data);
1831
427
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::context_would_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::context_would_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::context_would_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
hb-ot-layout.cc:bool OT::context_would_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Line
Count
Source
1827
427
{
1828
427
  return would_match_input (c,
1829
427
          inputCount, input,
1830
427
          lookup_context.funcs.match, lookup_context.match_data);
1831
427
}
Unexecuted instantiation: hb-ot-layout.cc:bool OT::context_would_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::context_would_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::context_would_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::context_would_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
1832
1833
template <typename HBUINT>
1834
static inline bool context_apply_lookup (hb_ot_apply_context_t *c,
1835
           unsigned int inputCount, /* Including the first glyph (not matched) */
1836
           const HBUINT input[], /* Array of input values--start with second glyph */
1837
           unsigned int lookupCount,
1838
           const LookupRecord lookupRecord[],
1839
           const ContextApplyLookupContext &lookup_context)
1840
1.46M
{
1841
1.46M
  unsigned match_end = 0;
1842
1.46M
  unsigned match_positions[HB_MAX_CONTEXT_LENGTH];
1843
1.46M
  if (match_input (c,
1844
1.46M
       inputCount, input,
1845
1.46M
       lookup_context.funcs.match, lookup_context.match_data,
1846
1.46M
       &match_end, match_positions))
1847
1.44M
  {
1848
1.44M
    c->buffer->unsafe_to_break (c->buffer->idx, match_end);
1849
1.44M
    apply_lookup (c,
1850
1.44M
      inputCount, match_positions,
1851
1.44M
      lookupCount, lookupRecord,
1852
1.44M
      match_end);
1853
1.44M
    return true;
1854
1.44M
  }
1855
21.2k
  else
1856
21.2k
  {
1857
21.2k
    c->buffer->unsafe_to_concat (c->buffer->idx, match_end);
1858
21.2k
    return false;
1859
21.2k
  }
1860
1.46M
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::context_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-aat-layout.cc:bool OT::context_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::context_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::context_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
hb-ot-layout.cc:bool OT::context_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Line
Count
Source
1840
1.46M
{
1841
1.46M
  unsigned match_end = 0;
1842
1.46M
  unsigned match_positions[HB_MAX_CONTEXT_LENGTH];
1843
1.46M
  if (match_input (c,
1844
1.46M
       inputCount, input,
1845
1.46M
       lookup_context.funcs.match, lookup_context.match_data,
1846
1.46M
       &match_end, match_positions))
1847
1.44M
  {
1848
1.44M
    c->buffer->unsafe_to_break (c->buffer->idx, match_end);
1849
1.44M
    apply_lookup (c,
1850
1.44M
      inputCount, match_positions,
1851
1.44M
      lookupCount, lookupRecord,
1852
1.44M
      match_end);
1853
1.44M
    return true;
1854
1.44M
  }
1855
21.2k
  else
1856
21.2k
  {
1857
21.2k
    c->buffer->unsafe_to_concat (c->buffer->idx, match_end);
1858
21.2k
    return false;
1859
21.2k
  }
1860
1.46M
}
Unexecuted instantiation: hb-ot-layout.cc:bool OT::context_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::context_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::context_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::context_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::context_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext const&)
1861
1862
template <typename Types>
1863
struct Rule
1864
{
1865
  bool intersects (const hb_set_t *glyphs, ContextClosureLookupContext &lookup_context) const
1866
0
  {
1867
0
    return context_intersects (glyphs,
1868
0
             inputCount, inputZ.arrayZ,
1869
0
             lookup_context);
1870
0
  }
Unexecuted instantiation: OT::Rule<OT::Layout::SmallTypes>::intersects(hb_set_t const*, OT::ContextClosureLookupContext&) const
Unexecuted instantiation: OT::Rule<OT::Layout::MediumTypes>::intersects(hb_set_t const*, OT::ContextClosureLookupContext&) const
1871
1872
  void closure (hb_closure_context_t *c, unsigned value, ContextClosureLookupContext &lookup_context) const
1873
0
  {
1874
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
1875
1876
0
    const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
1877
0
             (inputZ.as_array ((inputCount ? inputCount - 1 : 0)));
1878
0
    context_closure_lookup (c,
1879
0
          inputCount, inputZ.arrayZ,
1880
0
          lookupCount, lookupRecord.arrayZ,
1881
0
          value, lookup_context);
1882
0
  }
Unexecuted instantiation: OT::Rule<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*, unsigned int, OT::ContextClosureLookupContext&) const
Unexecuted instantiation: OT::Rule<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*, unsigned int, OT::ContextClosureLookupContext&) const
1883
1884
  void closure_lookups (hb_closure_lookups_context_t *c,
1885
                        ContextClosureLookupContext &lookup_context) const
1886
0
  {
1887
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
1888
0
    if (!intersects (c->glyphs, lookup_context)) return;
1889
0
1890
0
    const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
1891
0
             (inputZ.as_array (inputCount ? inputCount - 1 : 0));
1892
0
    recurse_lookups (c, lookupCount, lookupRecord.arrayZ);
1893
0
  }
Unexecuted instantiation: OT::Rule<OT::Layout::SmallTypes>::closure_lookups(OT::hb_closure_lookups_context_t*, OT::ContextClosureLookupContext&) const
Unexecuted instantiation: OT::Rule<OT::Layout::MediumTypes>::closure_lookups(OT::hb_closure_lookups_context_t*, OT::ContextClosureLookupContext&) const
1894
1895
  void collect_glyphs (hb_collect_glyphs_context_t *c,
1896
           ContextCollectGlyphsLookupContext &lookup_context) const
1897
0
  {
1898
0
    const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
1899
0
             (inputZ.as_array (inputCount ? inputCount - 1 : 0));
1900
0
    context_collect_glyphs_lookup (c,
1901
0
           inputCount, inputZ.arrayZ,
1902
0
           lookupCount, lookupRecord.arrayZ,
1903
0
           lookup_context);
1904
0
  }
Unexecuted instantiation: OT::Rule<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*, OT::ContextCollectGlyphsLookupContext&) const
Unexecuted instantiation: OT::Rule<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*, OT::ContextCollectGlyphsLookupContext&) const
1905
1906
  bool would_apply (hb_would_apply_context_t *c,
1907
        const ContextApplyLookupContext &lookup_context) const
1908
427
  {
1909
427
    const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
1910
427
             (inputZ.as_array (inputCount ? inputCount - 1 : 0));
1911
427
    return context_would_apply_lookup (c,
1912
427
               inputCount, inputZ.arrayZ,
1913
427
               lookupCount, lookupRecord.arrayZ,
1914
427
               lookup_context);
1915
427
  }
OT::Rule<OT::Layout::SmallTypes>::would_apply(OT::hb_would_apply_context_t*, OT::ContextApplyLookupContext const&) const
Line
Count
Source
1908
427
  {
1909
427
    const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
1910
427
             (inputZ.as_array (inputCount ? inputCount - 1 : 0));
1911
427
    return context_would_apply_lookup (c,
1912
427
               inputCount, inputZ.arrayZ,
1913
427
               lookupCount, lookupRecord.arrayZ,
1914
427
               lookup_context);
1915
427
  }
Unexecuted instantiation: OT::Rule<OT::Layout::MediumTypes>::would_apply(OT::hb_would_apply_context_t*, OT::ContextApplyLookupContext const&) const
1916
1917
  bool apply (hb_ot_apply_context_t *c,
1918
        const ContextApplyLookupContext &lookup_context) const
1919
676k
  {
1920
676k
    TRACE_APPLY (this);
1921
676k
    const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
1922
676k
             (inputZ.as_array (inputCount ? inputCount - 1 : 0));
1923
676k
    return_trace (context_apply_lookup (c, inputCount, inputZ.arrayZ, lookupCount, lookupRecord.arrayZ, lookup_context));
1924
676k
  }
OT::Rule<OT::Layout::SmallTypes>::apply(OT::hb_ot_apply_context_t*, OT::ContextApplyLookupContext const&) const
Line
Count
Source
1919
676k
  {
1920
676k
    TRACE_APPLY (this);
1921
676k
    const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
1922
676k
             (inputZ.as_array (inputCount ? inputCount - 1 : 0));
1923
676k
    return_trace (context_apply_lookup (c, inputCount, inputZ.arrayZ, lookupCount, lookupRecord.arrayZ, lookup_context));
1924
676k
  }
Unexecuted instantiation: OT::Rule<OT::Layout::MediumTypes>::apply(OT::hb_ot_apply_context_t*, OT::ContextApplyLookupContext const&) const
1925
1926
  bool serialize (hb_serialize_context_t *c,
1927
      const hb_map_t *input_mapping, /* old->new glyphid or class mapping */
1928
      const hb_map_t *lookup_map) const
1929
0
  {
1930
0
    TRACE_SERIALIZE (this);
1931
0
    auto *out = c->start_embed (this);
1932
0
    if (unlikely (!c->extend_min (out))) return_trace (false);
1933
0
1934
0
    out->inputCount = inputCount;
1935
0
    const auto input = inputZ.as_array (inputCount - 1);
1936
0
    for (const auto org : input)
1937
0
    {
1938
0
      HBUINT16 d;
1939
0
      d = input_mapping->get (org);
1940
0
      c->copy (d);
1941
0
    }
1942
0
1943
0
    const auto &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
1944
0
             (inputZ.as_array ((inputCount ? inputCount - 1 : 0)));
1945
0
1946
0
    unsigned count = serialize_lookuprecord_array (c, lookupRecord.as_array (lookupCount), lookup_map);
1947
0
    return_trace (c->check_assign (out->lookupCount, count, HB_SERIALIZE_ERROR_INT_OVERFLOW));
1948
0
  }
Unexecuted instantiation: OT::Rule<OT::Layout::SmallTypes>::serialize(hb_serialize_context_t*, hb_map_t const*, hb_map_t const*) const
Unexecuted instantiation: OT::Rule<OT::Layout::MediumTypes>::serialize(hb_serialize_context_t*, hb_map_t const*, hb_map_t const*) const
1949
1950
  bool subset (hb_subset_context_t *c,
1951
         const hb_map_t *lookup_map,
1952
         const hb_map_t *klass_map = nullptr) const
1953
0
  {
1954
0
    TRACE_SUBSET (this);
1955
0
    if (unlikely (!inputCount)) return_trace (false);
1956
0
    const auto input = inputZ.as_array (inputCount - 1);
1957
0
1958
0
    const hb_map_t *mapping = klass_map == nullptr ? c->plan->glyph_map : klass_map;
1959
0
    if (!hb_all (input, mapping)) return_trace (false);
1960
0
    return_trace (serialize (c->serializer, mapping, lookup_map));
1961
0
  }
Unexecuted instantiation: OT::Rule<OT::Layout::SmallTypes>::subset(hb_subset_context_t*, hb_map_t const*, hb_map_t const*) const
Unexecuted instantiation: OT::Rule<OT::Layout::MediumTypes>::subset(hb_subset_context_t*, hb_map_t const*, hb_map_t const*) const
1962
1963
  public:
1964
  bool sanitize (hb_sanitize_context_t *c) const
1965
203k
  {
1966
203k
    TRACE_SANITIZE (this);
1967
203k
    return_trace (inputCount.sanitize (c) &&
1968
203k
      lookupCount.sanitize (c) &&
1969
203k
      c->check_range (inputZ.arrayZ,
1970
203k
          inputZ.item_size * (inputCount ? inputCount - 1 : 0) +
1971
203k
          LookupRecord::static_size * lookupCount));
1972
203k
  }
OT::Rule<OT::Layout::SmallTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
1965
198k
  {
1966
198k
    TRACE_SANITIZE (this);
1967
198k
    return_trace (inputCount.sanitize (c) &&
1968
198k
      lookupCount.sanitize (c) &&
1969
198k
      c->check_range (inputZ.arrayZ,
1970
198k
          inputZ.item_size * (inputCount ? inputCount - 1 : 0) +
1971
198k
          LookupRecord::static_size * lookupCount));
1972
198k
  }
OT::Rule<OT::Layout::MediumTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
1965
5.39k
  {
1966
5.39k
    TRACE_SANITIZE (this);
1967
5.39k
    return_trace (inputCount.sanitize (c) &&
1968
5.39k
      lookupCount.sanitize (c) &&
1969
5.39k
      c->check_range (inputZ.arrayZ,
1970
5.39k
          inputZ.item_size * (inputCount ? inputCount - 1 : 0) +
1971
5.39k
          LookupRecord::static_size * lookupCount));
1972
5.39k
  }
1973
1974
  protected:
1975
  HBUINT16  inputCount;   /* Total number of glyphs in input
1976
           * glyph sequence--includes the first
1977
           * glyph */
1978
  HBUINT16  lookupCount;    /* Number of LookupRecords */
1979
  UnsizedArrayOf<typename Types::HBUINT>
1980
    inputZ;     /* Array of match inputs--start with
1981
           * second glyph */
1982
/*UnsizedArrayOf<LookupRecord>
1983
    lookupRecordX;*/  /* Array of LookupRecords--in
1984
           * design order */
1985
  public:
1986
  DEFINE_SIZE_ARRAY (4, inputZ);
1987
};
1988
1989
template <typename Types>
1990
struct RuleSet
1991
{
1992
  using Rule = OT::Rule<Types>;
1993
1994
  bool intersects (const hb_set_t *glyphs,
1995
       ContextClosureLookupContext &lookup_context) const
1996
0
  {
1997
0
    return
1998
0
    + hb_iter (rule)
1999
0
    | hb_map (hb_add (this))
2000
0
    | hb_map ([&] (const Rule &_) { return _.intersects (glyphs, lookup_context); })
2001
0
    | hb_any
2002
0
    ;
2003
0
  }
Unexecuted instantiation: OT::RuleSet<OT::Layout::SmallTypes>::intersects(hb_set_t const*, OT::ContextClosureLookupContext&) const
Unexecuted instantiation: OT::RuleSet<OT::Layout::MediumTypes>::intersects(hb_set_t const*, OT::ContextClosureLookupContext&) const
2004
2005
  void closure (hb_closure_context_t *c, unsigned value,
2006
    ContextClosureLookupContext &lookup_context) const
2007
0
  {
2008
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
2009
2010
0
    return
2011
0
    + hb_iter (rule)
2012
0
    | hb_map (hb_add (this))
2013
0
    | hb_apply ([&] (const Rule &_) { _.closure (c, value, lookup_context); })
Unexecuted instantiation: OT::RuleSet<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*, unsigned int, OT::ContextClosureLookupContext&) const::{lambda(OT::Rule<OT::Layout::SmallTypes> const&)#1}::operator()(OT::Rule<OT::Layout::SmallTypes> const&) const
Unexecuted instantiation: OT::RuleSet<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*, unsigned int, OT::ContextClosureLookupContext&) const::{lambda(OT::Rule<OT::Layout::MediumTypes> const&)#1}::operator()(OT::Rule<OT::Layout::MediumTypes> const&) const
2014
0
    ;
2015
0
  }
Unexecuted instantiation: OT::RuleSet<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*, unsigned int, OT::ContextClosureLookupContext&) const
Unexecuted instantiation: OT::RuleSet<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*, unsigned int, OT::ContextClosureLookupContext&) const
2016
2017
  void closure_lookups (hb_closure_lookups_context_t *c,
2018
                        ContextClosureLookupContext &lookup_context) const
2019
0
  {
2020
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
2021
0
    + hb_iter (rule)
2022
0
    | hb_map (hb_add (this))
2023
0
    | hb_apply ([&] (const Rule &_) { _.closure_lookups (c, lookup_context); })
2024
0
    ;
2025
0
  }
Unexecuted instantiation: OT::RuleSet<OT::Layout::SmallTypes>::closure_lookups(OT::hb_closure_lookups_context_t*, OT::ContextClosureLookupContext&) const
Unexecuted instantiation: OT::RuleSet<OT::Layout::MediumTypes>::closure_lookups(OT::hb_closure_lookups_context_t*, OT::ContextClosureLookupContext&) const
2026
2027
  void collect_glyphs (hb_collect_glyphs_context_t *c,
2028
           ContextCollectGlyphsLookupContext &lookup_context) const
2029
0
  {
2030
0
    return
2031
0
    + hb_iter (rule)
2032
0
    | hb_map (hb_add (this))
2033
0
    | hb_apply ([&] (const Rule &_) { _.collect_glyphs (c, lookup_context); })
Unexecuted instantiation: OT::RuleSet<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*, OT::ContextCollectGlyphsLookupContext&) const::{lambda(OT::Rule<OT::Layout::SmallTypes> const&)#1}::operator()(OT::Rule<OT::Layout::SmallTypes> const&) const
Unexecuted instantiation: OT::RuleSet<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*, OT::ContextCollectGlyphsLookupContext&) const::{lambda(OT::Rule<OT::Layout::MediumTypes> const&)#1}::operator()(OT::Rule<OT::Layout::MediumTypes> const&) const
2034
0
    ;
2035
0
  }
Unexecuted instantiation: OT::RuleSet<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*, OT::ContextCollectGlyphsLookupContext&) const
Unexecuted instantiation: OT::RuleSet<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*, OT::ContextCollectGlyphsLookupContext&) const
2036
2037
  bool would_apply (hb_would_apply_context_t *c,
2038
        const ContextApplyLookupContext &lookup_context) const
2039
140
  {
2040
140
    return
2041
140
    + hb_iter (rule)
2042
140
    | hb_map (hb_add (this))
2043
427
    | hb_map ([&] (const Rule &_) { return _.would_apply (c, lookup_context); })
OT::RuleSet<OT::Layout::SmallTypes>::would_apply(OT::hb_would_apply_context_t*, OT::ContextApplyLookupContext const&) const::{lambda(OT::Rule<OT::Layout::SmallTypes> const&)#1}::operator()(OT::Rule<OT::Layout::SmallTypes> const&) const
Line
Count
Source
2043
427
    | hb_map ([&] (const Rule &_) { return _.would_apply (c, lookup_context); })
Unexecuted instantiation: OT::RuleSet<OT::Layout::MediumTypes>::would_apply(OT::hb_would_apply_context_t*, OT::ContextApplyLookupContext const&) const::{lambda(OT::Rule<OT::Layout::MediumTypes> const&)#1}::operator()(OT::Rule<OT::Layout::MediumTypes> const&) const
2044
140
    | hb_any
2045
140
    ;
2046
140
  }
OT::RuleSet<OT::Layout::SmallTypes>::would_apply(OT::hb_would_apply_context_t*, OT::ContextApplyLookupContext const&) const
Line
Count
Source
2039
140
  {
2040
140
    return
2041
140
    + hb_iter (rule)
2042
140
    | hb_map (hb_add (this))
2043
140
    | hb_map ([&] (const Rule &_) { return _.would_apply (c, lookup_context); })
2044
140
    | hb_any
2045
140
    ;
2046
140
  }
Unexecuted instantiation: OT::RuleSet<OT::Layout::MediumTypes>::would_apply(OT::hb_would_apply_context_t*, OT::ContextApplyLookupContext const&) const
2047
2048
  bool apply (hb_ot_apply_context_t *c,
2049
        const ContextApplyLookupContext &lookup_context) const
2050
676k
  {
2051
676k
    TRACE_APPLY (this);
2052
676k
    return_trace (
2053
676k
    + hb_iter (rule)
2054
676k
    | hb_map (hb_add (this))
2055
676k
    | hb_map ([&] (const Rule &_) { return _.apply (c, lookup_context); })
2056
676k
    | hb_any
2057
676k
    )
2058
676k
    ;
2059
676k
  }
OT::RuleSet<OT::Layout::SmallTypes>::apply(OT::hb_ot_apply_context_t*, OT::ContextApplyLookupContext const&) const
Line
Count
Source
2050
676k
  {
2051
676k
    TRACE_APPLY (this);
2052
676k
    return_trace (
2053
676k
    + hb_iter (rule)
2054
676k
    | hb_map (hb_add (this))
2055
676k
    | hb_map ([&] (const Rule &_) { return _.apply (c, lookup_context); })
2056
676k
    | hb_any
2057
676k
    )
2058
676k
    ;
2059
676k
  }
Unexecuted instantiation: OT::RuleSet<OT::Layout::MediumTypes>::apply(OT::hb_ot_apply_context_t*, OT::ContextApplyLookupContext const&) const
2060
2061
  bool subset (hb_subset_context_t *c,
2062
         const hb_map_t *lookup_map,
2063
         const hb_map_t *klass_map = nullptr) const
2064
0
  {
2065
0
    TRACE_SUBSET (this);
2066
0
2067
0
    auto snap = c->serializer->snapshot ();
2068
0
    auto *out = c->serializer->start_embed (*this);
2069
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
2070
0
2071
0
    for (const Offset16To<Rule>& _ : rule)
2072
0
    {
2073
0
      if (!_) continue;
2074
0
      auto o_snap = c->serializer->snapshot ();
2075
0
      auto *o = out->rule.serialize_append (c->serializer);
2076
0
      if (unlikely (!o)) continue;
2077
0
2078
0
      if (!o->serialize_subset (c, _, this, lookup_map, klass_map))
2079
0
      {
2080
0
  out->rule.pop ();
2081
0
  c->serializer->revert (o_snap);
2082
0
      }
2083
0
    }
2084
0
2085
0
    bool ret = bool (out->rule);
2086
0
    if (!ret) c->serializer->revert (snap);
2087
0
2088
0
    return_trace (ret);
2089
0
  }
Unexecuted instantiation: OT::RuleSet<OT::Layout::SmallTypes>::subset(hb_subset_context_t*, hb_map_t const*, hb_map_t const*) const
Unexecuted instantiation: OT::RuleSet<OT::Layout::MediumTypes>::subset(hb_subset_context_t*, hb_map_t const*, hb_map_t const*) const
2090
2091
  bool sanitize (hb_sanitize_context_t *c) const
2092
19.5k
  {
2093
19.5k
    TRACE_SANITIZE (this);
2094
19.5k
    return_trace (rule.sanitize (c, this));
2095
19.5k
  }
OT::RuleSet<OT::Layout::SmallTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
2092
18.5k
  {
2093
18.5k
    TRACE_SANITIZE (this);
2094
18.5k
    return_trace (rule.sanitize (c, this));
2095
18.5k
  }
OT::RuleSet<OT::Layout::MediumTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
2092
1.02k
  {
2093
1.02k
    TRACE_SANITIZE (this);
2094
1.02k
    return_trace (rule.sanitize (c, this));
2095
1.02k
  }
2096
2097
  protected:
2098
  Array16OfOffset16To<Rule>
2099
    rule;     /* Array of Rule tables
2100
           * ordered by preference */
2101
  public:
2102
  DEFINE_SIZE_ARRAY (2, rule);
2103
};
2104
2105
2106
template <typename Types>
2107
struct ContextFormat1_4
2108
{
2109
  using RuleSet = OT::RuleSet<Types>;
2110
2111
  bool intersects (const hb_set_t *glyphs) const
2112
0
  {
2113
0
    struct ContextClosureLookupContext lookup_context = {
2114
0
      {intersects_glyph, intersected_glyph},
2115
0
      ContextFormat::SimpleContext,
2116
0
      nullptr
2117
0
    };
2118
0
2119
0
    return
2120
0
    + hb_zip (this+coverage, ruleSet)
2121
0
    | hb_filter (*glyphs, hb_first)
2122
0
    | hb_map (hb_second)
2123
0
    | hb_map (hb_add (this))
2124
0
    | hb_map ([&] (const RuleSet &_) { return _.intersects (glyphs, lookup_context); })
2125
0
    | hb_any
2126
0
    ;
2127
0
  }
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::SmallTypes>::intersects(hb_set_t const*) const
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::MediumTypes>::intersects(hb_set_t const*) const
2128
2129
  bool may_have_non_1to1 () const
2130
0
  { return true; }
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::SmallTypes>::may_have_non_1to1() const
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::MediumTypes>::may_have_non_1to1() const
2131
2132
  void closure (hb_closure_context_t *c) const
2133
0
  {
2134
0
    hb_set_t& cur_active_glyphs = c->push_cur_active_glyphs ();
2135
0
    get_coverage ().intersect_set (c->previous_parent_active_glyphs (), cur_active_glyphs);
2136
2137
0
    struct ContextClosureLookupContext lookup_context = {
2138
0
      {intersects_glyph, intersected_glyph},
2139
0
      ContextFormat::SimpleContext,
2140
0
      nullptr
2141
0
    };
2142
2143
0
    + hb_zip (this+coverage, hb_range ((unsigned) ruleSet.len))
2144
0
    | hb_filter ([&] (hb_codepoint_t _) {
2145
0
      return c->previous_parent_active_glyphs ().has (_);
2146
0
    }, hb_first)
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const::{lambda(unsigned int)#1}::operator()(unsigned int) const
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const::{lambda(unsigned int)#1}::operator()(unsigned int) const
2147
0
    | hb_map ([&](const hb_pair_t<hb_codepoint_t, unsigned> _) { return hb_pair_t<unsigned, const RuleSet&> (_.first, this+ruleSet[_.second]); })
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const::{lambda(hb_pair_t<unsigned int, unsigned int>)#1}::operator()(hb_pair_t<unsigned int, unsigned int>) const
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const::{lambda(hb_pair_t<unsigned int, unsigned int>)#1}::operator()(hb_pair_t<unsigned int, unsigned int>) const
2148
0
    | hb_apply ([&] (const hb_pair_t<unsigned, const RuleSet&>& _) { _.second.closure (c, _.first, lookup_context); })
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const::{lambda(hb_pair_t<unsigned int, OT::RuleSet<OT::Layout::SmallTypes> const&> const&)#1}::operator()(hb_pair_t<unsigned int, OT::RuleSet<OT::Layout::SmallTypes> const&> const&) const
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const::{lambda(hb_pair_t<unsigned int, OT::RuleSet<OT::Layout::MediumTypes> const&> const&)#1}::operator()(hb_pair_t<unsigned int, OT::RuleSet<OT::Layout::MediumTypes> const&> const&) const
2149
0
    ;
2150
2151
0
    c->pop_cur_done_glyphs ();
2152
0
  }
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const
2153
2154
  void closure_lookups (hb_closure_lookups_context_t *c) const
2155
0
  {
2156
0
    struct ContextClosureLookupContext lookup_context = {
2157
0
      {intersects_glyph, nullptr},
2158
0
      ContextFormat::SimpleContext,
2159
0
      nullptr
2160
0
    };
2161
0
2162
0
    + hb_zip (this+coverage, ruleSet)
2163
0
    | hb_filter (*c->glyphs, hb_first)
2164
0
    | hb_map (hb_second)
2165
0
    | hb_map (hb_add (this))
2166
0
    | hb_apply ([&] (const RuleSet &_) { _.closure_lookups (c, lookup_context); })
2167
0
    ;
2168
0
  }
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::SmallTypes>::closure_lookups(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::MediumTypes>::closure_lookups(OT::hb_closure_lookups_context_t*) const
2169
2170
0
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const {}
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::SmallTypes>::collect_variation_indices(OT::hb_collect_variation_indices_context_t*) const
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::MediumTypes>::collect_variation_indices(OT::hb_collect_variation_indices_context_t*) const
2171
2172
  void collect_glyphs (hb_collect_glyphs_context_t *c) const
2173
0
  {
2174
0
    (this+coverage).collect_coverage (c->input);
2175
2176
0
    struct ContextCollectGlyphsLookupContext lookup_context = {
2177
0
      {collect_glyph},
2178
0
      nullptr
2179
0
    };
2180
2181
0
    + hb_iter (ruleSet)
2182
0
    | hb_map (hb_add (this))
2183
0
    | hb_apply ([&] (const RuleSet &_) { _.collect_glyphs (c, lookup_context); })
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const::{lambda(OT::RuleSet<OT::Layout::SmallTypes> const&)#1}::operator()(OT::RuleSet<OT::Layout::SmallTypes> const&) const
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const::{lambda(OT::RuleSet<OT::Layout::MediumTypes> const&)#1}::operator()(OT::RuleSet<OT::Layout::MediumTypes> const&) const
2184
0
    ;
2185
0
  }
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const
2186
2187
  bool would_apply (hb_would_apply_context_t *c) const
2188
136
  {
2189
136
    const RuleSet &rule_set = this+ruleSet[(this+coverage).get_coverage (c->glyphs[0])];
2190
136
    struct ContextApplyLookupContext lookup_context = {
2191
136
      {match_glyph},
2192
136
      nullptr
2193
136
    };
2194
136
    return rule_set.would_apply (c, lookup_context);
2195
136
  }
OT::ContextFormat1_4<OT::Layout::SmallTypes>::would_apply(OT::hb_would_apply_context_t*) const
Line
Count
Source
2188
136
  {
2189
136
    const RuleSet &rule_set = this+ruleSet[(this+coverage).get_coverage (c->glyphs[0])];
2190
136
    struct ContextApplyLookupContext lookup_context = {
2191
136
      {match_glyph},
2192
136
      nullptr
2193
136
    };
2194
136
    return rule_set.would_apply (c, lookup_context);
2195
136
  }
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::MediumTypes>::would_apply(OT::hb_would_apply_context_t*) const
2196
2197
2.59k
  const Coverage &get_coverage () const { return this+coverage; }
OT::ContextFormat1_4<OT::Layout::SmallTypes>::get_coverage() const
Line
Count
Source
2197
2.57k
  const Coverage &get_coverage () const { return this+coverage; }
OT::ContextFormat1_4<OT::Layout::MediumTypes>::get_coverage() const
Line
Count
Source
2197
21
  const Coverage &get_coverage () const { return this+coverage; }
2198
2199
  bool apply (hb_ot_apply_context_t *c) const
2200
678k
  {
2201
678k
    TRACE_APPLY (this);
2202
678k
    unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
2203
678k
    if (likely (index == NOT_COVERED))
2204
2.17k
      return_trace (false);
2205
2206
676k
    const RuleSet &rule_set = this+ruleSet[index];
2207
676k
    struct ContextApplyLookupContext lookup_context = {
2208
676k
      {match_glyph},
2209
676k
      nullptr
2210
676k
    };
2211
676k
    return_trace (rule_set.apply (c, lookup_context));
2212
678k
  }
OT::ContextFormat1_4<OT::Layout::SmallTypes>::apply(OT::hb_ot_apply_context_t*) const
Line
Count
Source
2200
678k
  {
2201
678k
    TRACE_APPLY (this);
2202
678k
    unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
2203
678k
    if (likely (index == NOT_COVERED))
2204
2.17k
      return_trace (false);
2205
2206
676k
    const RuleSet &rule_set = this+ruleSet[index];
2207
676k
    struct ContextApplyLookupContext lookup_context = {
2208
676k
      {match_glyph},
2209
676k
      nullptr
2210
676k
    };
2211
676k
    return_trace (rule_set.apply (c, lookup_context));
2212
678k
  }
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::MediumTypes>::apply(OT::hb_ot_apply_context_t*) const
2213
2214
  bool subset (hb_subset_context_t *c) const
2215
0
  {
2216
0
    TRACE_SUBSET (this);
2217
0
    const hb_set_t &glyphset = *c->plan->glyphset_gsub ();
2218
0
    const hb_map_t &glyph_map = *c->plan->glyph_map;
2219
0
2220
0
    auto *out = c->serializer->start_embed (*this);
2221
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
2222
0
    out->format = format;
2223
0
2224
0
    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
2225
0
    hb_sorted_vector_t<hb_codepoint_t> new_coverage;
2226
0
    + hb_zip (this+coverage, ruleSet)
2227
0
    | hb_filter (glyphset, hb_first)
2228
0
    | hb_filter (subset_offset_array (c, out->ruleSet, this, lookup_map), hb_second)
2229
0
    | hb_map (hb_first)
2230
0
    | hb_map (glyph_map)
2231
0
    | hb_sink (new_coverage)
2232
0
    ;
2233
0
2234
0
    out->coverage.serialize_serialize (c->serializer, new_coverage.iter ());
2235
0
    return_trace (bool (new_coverage));
2236
0
  }
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::SmallTypes>::subset(hb_subset_context_t*) const
Unexecuted instantiation: OT::ContextFormat1_4<OT::Layout::MediumTypes>::subset(hb_subset_context_t*) const
2237
2238
  bool sanitize (hb_sanitize_context_t *c) const
2239
5.72k
  {
2240
5.72k
    TRACE_SANITIZE (this);
2241
5.72k
    return_trace (coverage.sanitize (c, this) && ruleSet.sanitize (c, this));
2242
5.72k
  }
OT::ContextFormat1_4<OT::Layout::SmallTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
2239
5.33k
  {
2240
5.33k
    TRACE_SANITIZE (this);
2241
5.33k
    return_trace (coverage.sanitize (c, this) && ruleSet.sanitize (c, this));
2242
5.33k
  }
OT::ContextFormat1_4<OT::Layout::MediumTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
2239
389
  {
2240
389
    TRACE_SANITIZE (this);
2241
389
    return_trace (coverage.sanitize (c, this) && ruleSet.sanitize (c, this));
2242
389
  }
2243
2244
  protected:
2245
  HBUINT16  format;     /* Format identifier--format = 1 */
2246
  typename Types::template OffsetTo<Coverage>
2247
    coverage;   /* Offset to Coverage table--from
2248
           * beginning of table */
2249
  Array16Of<typename Types::template OffsetTo<RuleSet>>
2250
    ruleSet;    /* Array of RuleSet tables
2251
           * ordered by Coverage Index */
2252
  public:
2253
  DEFINE_SIZE_ARRAY (2 + 2 * Types::size, ruleSet);
2254
};
2255
2256
2257
template <typename Types>
2258
struct ContextFormat2_5
2259
{
2260
  using RuleSet = OT::RuleSet<SmallTypes>;
2261
2262
  bool intersects (const hb_set_t *glyphs) const
2263
0
  {
2264
0
    if (!(this+coverage).intersects (glyphs))
2265
0
      return false;
2266
0
2267
0
    const ClassDef &class_def = this+classDef;
2268
0
2269
0
    hb_map_t cache;
2270
0
    struct ContextClosureLookupContext lookup_context = {
2271
0
      {intersects_class, nullptr},
2272
0
      ContextFormat::ClassBasedContext,
2273
0
      &class_def,
2274
0
      &cache
2275
0
    };
2276
0
2277
0
    hb_set_t retained_coverage_glyphs;
2278
0
    (this+coverage).intersect_set (*glyphs, retained_coverage_glyphs);
2279
0
2280
0
    hb_set_t coverage_glyph_classes;
2281
0
    class_def.intersected_classes (&retained_coverage_glyphs, &coverage_glyph_classes);
2282
0
2283
0
2284
0
    return
2285
0
    + hb_iter (ruleSet)
2286
0
    | hb_map (hb_add (this))
2287
0
    | hb_enumerate
2288
0
    | hb_map ([&] (const hb_pair_t<unsigned, const RuleSet &> p)
2289
0
        { return class_def.intersects_class (glyphs, p.first) &&
2290
0
           coverage_glyph_classes.has (p.first) &&
2291
0
           p.second.intersects (glyphs, lookup_context); })
2292
0
    | hb_any
2293
0
    ;
2294
0
  }
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::SmallTypes>::intersects(hb_set_t const*) const
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::MediumTypes>::intersects(hb_set_t const*) const
2295
2296
  bool may_have_non_1to1 () const
2297
0
  { return true; }
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::SmallTypes>::may_have_non_1to1() const
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::MediumTypes>::may_have_non_1to1() const
2298
2299
  void closure (hb_closure_context_t *c) const
2300
0
  {
2301
0
    if (!(this+coverage).intersects (c->glyphs))
2302
0
      return;
2303
2304
0
    hb_set_t& cur_active_glyphs = c->push_cur_active_glyphs ();
2305
0
    get_coverage ().intersect_set (c->previous_parent_active_glyphs (),
2306
0
                                                 cur_active_glyphs);
2307
2308
0
    const ClassDef &class_def = this+classDef;
2309
2310
0
    hb_map_t cache;
2311
0
    intersected_class_cache_t intersected_cache;
2312
0
    struct ContextClosureLookupContext lookup_context = {
2313
0
      {intersects_class, intersected_class_glyphs},
2314
0
      ContextFormat::ClassBasedContext,
2315
0
      &class_def,
2316
0
      &cache,
2317
0
      &intersected_cache
2318
0
    };
2319
2320
0
    + hb_enumerate (ruleSet)
2321
0
    | hb_filter ([&] (unsigned _)
2322
0
    { return class_def.intersects_class (&c->parent_active_glyphs (), _); },
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const::{lambda(unsigned int)#1}::operator()(unsigned int) const
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const::{lambda(unsigned int)#1}::operator()(unsigned int) const
2323
0
     hb_first)
2324
0
    | hb_apply ([&] (const hb_pair_t<unsigned, const typename Types::template OffsetTo<RuleSet>&> _)
2325
0
                {
2326
0
                  const RuleSet& rule_set = this+_.second;
2327
0
                  rule_set.closure (c, _.first, lookup_context);
2328
0
                })
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const::{lambda(hb_pair_t<unsigned int, OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::IntType<unsigned short, 2u>, true> const&>)#1}::operator()(hb_pair_t<unsigned int, OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::IntType<unsigned short, 2u>, true> const&>) const
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const::{lambda(hb_pair_t<unsigned int, OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::IntType<unsigned int, 3u>, true> const&>)#1}::operator()(hb_pair_t<unsigned int, OT::OffsetTo<OT::RuleSet<OT::Layout::SmallTypes>, OT::IntType<unsigned int, 3u>, true> const&>) const
2329
0
    ;
2330
2331
0
    c->pop_cur_done_glyphs ();
2332
0
  }
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const
2333
2334
  void closure_lookups (hb_closure_lookups_context_t *c) const
2335
0
  {
2336
0
    if (!(this+coverage).intersects (c->glyphs))
2337
0
      return;
2338
0
2339
0
    const ClassDef &class_def = this+classDef;
2340
0
2341
0
    hb_map_t cache;
2342
0
    struct ContextClosureLookupContext lookup_context = {
2343
0
      {intersects_class, nullptr},
2344
0
      ContextFormat::ClassBasedContext,
2345
0
      &class_def,
2346
0
      &cache
2347
0
    };
2348
0
2349
0
    + hb_iter (ruleSet)
2350
0
    | hb_map (hb_add (this))
2351
0
    | hb_enumerate
2352
0
    | hb_filter ([&] (const hb_pair_t<unsigned, const RuleSet &> p)
2353
0
    { return class_def.intersects_class (c->glyphs, p.first); })
2354
0
    | hb_map (hb_second)
2355
0
    | hb_apply ([&] (const RuleSet & _)
2356
0
    { _.closure_lookups (c, lookup_context); });
2357
0
  }
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::SmallTypes>::closure_lookups(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::MediumTypes>::closure_lookups(OT::hb_closure_lookups_context_t*) const
2358
2359
0
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const {}
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::SmallTypes>::collect_variation_indices(OT::hb_collect_variation_indices_context_t*) const
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::MediumTypes>::collect_variation_indices(OT::hb_collect_variation_indices_context_t*) const
2360
2361
  void collect_glyphs (hb_collect_glyphs_context_t *c) const
2362
0
  {
2363
0
    (this+coverage).collect_coverage (c->input);
2364
2365
0
    const ClassDef &class_def = this+classDef;
2366
0
    struct ContextCollectGlyphsLookupContext lookup_context = {
2367
0
      {collect_class},
2368
0
      &class_def
2369
0
    };
2370
2371
0
    + hb_iter (ruleSet)
2372
0
    | hb_map (hb_add (this))
2373
0
    | hb_apply ([&] (const RuleSet &_) { _.collect_glyphs (c, lookup_context); })
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const::{lambda(OT::RuleSet<OT::Layout::SmallTypes> const&)#1}::operator()(OT::RuleSet<OT::Layout::SmallTypes> const&) const
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const::{lambda(OT::RuleSet<OT::Layout::SmallTypes> const&)#1}::operator()(OT::RuleSet<OT::Layout::SmallTypes> const&) const
2374
0
    ;
2375
0
  }
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const
2376
2377
  bool would_apply (hb_would_apply_context_t *c) const
2378
4
  {
2379
4
    const ClassDef &class_def = this+classDef;
2380
4
    unsigned int index = class_def.get_class (c->glyphs[0]);
2381
4
    const RuleSet &rule_set = this+ruleSet[index];
2382
4
    struct ContextApplyLookupContext lookup_context = {
2383
4
      {match_class},
2384
4
      &class_def
2385
4
    };
2386
4
    return rule_set.would_apply (c, lookup_context);
2387
4
  }
OT::ContextFormat2_5<OT::Layout::SmallTypes>::would_apply(OT::hb_would_apply_context_t*) const
Line
Count
Source
2378
4
  {
2379
4
    const ClassDef &class_def = this+classDef;
2380
4
    unsigned int index = class_def.get_class (c->glyphs[0]);
2381
4
    const RuleSet &rule_set = this+ruleSet[index];
2382
4
    struct ContextApplyLookupContext lookup_context = {
2383
4
      {match_class},
2384
4
      &class_def
2385
4
    };
2386
4
    return rule_set.would_apply (c, lookup_context);
2387
4
  }
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::MediumTypes>::would_apply(OT::hb_would_apply_context_t*) const
2388
2389
3.11k
  const Coverage &get_coverage () const { return this+coverage; }
OT::ContextFormat2_5<OT::Layout::SmallTypes>::get_coverage() const
Line
Count
Source
2389
3.05k
  const Coverage &get_coverage () const { return this+coverage; }
OT::ContextFormat2_5<OT::Layout::MediumTypes>::get_coverage() const
Line
Count
Source
2389
61
  const Coverage &get_coverage () const { return this+coverage; }
2390
2391
  unsigned cache_cost () const
2392
3.11k
  {
2393
3.11k
    unsigned c = (this+classDef).cost () * ruleSet.len;
2394
3.11k
    return c >= 4 ? c : 0;
2395
3.11k
  }
OT::ContextFormat2_5<OT::Layout::SmallTypes>::cache_cost() const
Line
Count
Source
2392
3.05k
  {
2393
3.05k
    unsigned c = (this+classDef).cost () * ruleSet.len;
2394
3.05k
    return c >= 4 ? c : 0;
2395
3.05k
  }
OT::ContextFormat2_5<OT::Layout::MediumTypes>::cache_cost() const
Line
Count
Source
2392
61
  {
2393
61
    unsigned c = (this+classDef).cost () * ruleSet.len;
2394
61
    return c >= 4 ? c : 0;
2395
61
  }
2396
  bool cache_func (hb_ot_apply_context_t *c, bool enter) const
2397
84
  {
2398
84
    if (enter)
2399
42
    {
2400
42
      if (!HB_BUFFER_TRY_ALLOCATE_VAR (c->buffer, syllable))
2401
0
  return false;
2402
42
      auto &info = c->buffer->info;
2403
42
      unsigned count = c->buffer->len;
2404
150
      for (unsigned i = 0; i < count; i++)
2405
108
  info[i].syllable() = 255;
2406
42
      c->new_syllables = 255;
2407
42
      return true;
2408
42
    }
2409
42
    else
2410
42
    {
2411
42
      c->new_syllables = (unsigned) -1;
2412
42
      HB_BUFFER_DEALLOCATE_VAR (c->buffer, syllable);
2413
42
      return true;
2414
42
    }
2415
84
  }
OT::ContextFormat2_5<OT::Layout::SmallTypes>::cache_func(OT::hb_ot_apply_context_t*, bool) const
Line
Count
Source
2397
84
  {
2398
84
    if (enter)
2399
42
    {
2400
42
      if (!HB_BUFFER_TRY_ALLOCATE_VAR (c->buffer, syllable))
2401
0
  return false;
2402
42
      auto &info = c->buffer->info;
2403
42
      unsigned count = c->buffer->len;
2404
150
      for (unsigned i = 0; i < count; i++)
2405
108
  info[i].syllable() = 255;
2406
42
      c->new_syllables = 255;
2407
42
      return true;
2408
42
    }
2409
42
    else
2410
42
    {
2411
42
      c->new_syllables = (unsigned) -1;
2412
42
      HB_BUFFER_DEALLOCATE_VAR (c->buffer, syllable);
2413
42
      return true;
2414
42
    }
2415
84
  }
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::MediumTypes>::cache_func(OT::hb_ot_apply_context_t*, bool) const
2416
2417
  bool apply (hb_ot_apply_context_t *c, bool cached = false) const
2418
722
  {
2419
722
    TRACE_APPLY (this);
2420
722
    unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
2421
722
    if (likely (index == NOT_COVERED)) return_trace (false);
2422
2423
506
    const ClassDef &class_def = this+classDef;
2424
2425
506
    struct ContextApplyLookupContext lookup_context = {
2426
506
      {cached ? match_class_cached : match_class},
2427
506
      &class_def
2428
506
    };
2429
2430
506
    if (cached && c->buffer->cur().syllable() < 255)
2431
0
      index = c->buffer->cur().syllable ();
2432
506
    else
2433
506
    {
2434
506
      index = class_def.get_class (c->buffer->cur().codepoint);
2435
506
      if (cached && index < 255)
2436
46
  c->buffer->cur().syllable() = index;
2437
506
    }
2438
506
    const RuleSet &rule_set = this+ruleSet[index];
2439
506
    return_trace (rule_set.apply (c, lookup_context));
2440
722
  }
OT::ContextFormat2_5<OT::Layout::SmallTypes>::apply(OT::hb_ot_apply_context_t*, bool) const
Line
Count
Source
2418
722
  {
2419
722
    TRACE_APPLY (this);
2420
722
    unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
2421
722
    if (likely (index == NOT_COVERED)) return_trace (false);
2422
2423
506
    const ClassDef &class_def = this+classDef;
2424
2425
506
    struct ContextApplyLookupContext lookup_context = {
2426
506
      {cached ? match_class_cached : match_class},
2427
506
      &class_def
2428
506
    };
2429
2430
506
    if (cached && c->buffer->cur().syllable() < 255)
2431
0
      index = c->buffer->cur().syllable ();
2432
506
    else
2433
506
    {
2434
506
      index = class_def.get_class (c->buffer->cur().codepoint);
2435
506
      if (cached && index < 255)
2436
46
  c->buffer->cur().syllable() = index;
2437
506
    }
2438
506
    const RuleSet &rule_set = this+ruleSet[index];
2439
506
    return_trace (rule_set.apply (c, lookup_context));
2440
722
  }
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::MediumTypes>::apply(OT::hb_ot_apply_context_t*, bool) const
2441
2442
  bool subset (hb_subset_context_t *c) const
2443
0
  {
2444
0
    TRACE_SUBSET (this);
2445
0
    auto *out = c->serializer->start_embed (*this);
2446
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
2447
0
    out->format = format;
2448
0
    if (unlikely (!out->coverage.serialize_subset (c, coverage, this)))
2449
0
      return_trace (false);
2450
0
2451
0
    hb_map_t klass_map;
2452
0
    out->classDef.serialize_subset (c, classDef, this, &klass_map);
2453
0
2454
0
    const hb_set_t* glyphset = c->plan->glyphset_gsub ();
2455
0
    hb_set_t retained_coverage_glyphs;
2456
0
    (this+coverage).intersect_set (*glyphset, retained_coverage_glyphs);
2457
0
2458
0
    hb_set_t coverage_glyph_classes;
2459
0
    (this+classDef).intersected_classes (&retained_coverage_glyphs, &coverage_glyph_classes);
2460
0
2461
0
    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
2462
0
    bool ret = true;
2463
0
    int non_zero_index = -1, index = 0;
2464
0
    auto snapshot = c->serializer->snapshot();
2465
0
    for (const auto& _ : + hb_enumerate (ruleSet)
2466
0
       | hb_filter (klass_map, hb_first))
2467
0
    {
2468
0
      auto *o = out->ruleSet.serialize_append (c->serializer);
2469
0
      if (unlikely (!o))
2470
0
      {
2471
0
  ret = false;
2472
0
  break;
2473
0
      }
2474
0
2475
0
      if (coverage_glyph_classes.has (_.first) &&
2476
0
    o->serialize_subset (c, _.second, this, lookup_map, &klass_map)) {
2477
0
  non_zero_index = index;
2478
0
        snapshot = c->serializer->snapshot();
2479
0
      }
2480
0
2481
0
      index++;
2482
0
    }
2483
0
2484
0
    if (!ret || non_zero_index == -1) return_trace (false);
2485
0
2486
0
    //prune empty trailing ruleSets
2487
0
    --index;
2488
0
    while (index > non_zero_index)
2489
0
    {
2490
0
      out->ruleSet.pop ();
2491
0
      index--;
2492
0
    }
2493
0
    c->serializer->revert (snapshot);
2494
0
2495
0
    return_trace (bool (out->ruleSet));
2496
0
  }
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::SmallTypes>::subset(hb_subset_context_t*) const
Unexecuted instantiation: OT::ContextFormat2_5<OT::Layout::MediumTypes>::subset(hb_subset_context_t*) const
2497
2498
  bool sanitize (hb_sanitize_context_t *c) const
2499
5.34k
  {
2500
5.34k
    TRACE_SANITIZE (this);
2501
5.34k
    return_trace (coverage.sanitize (c, this) && classDef.sanitize (c, this) && ruleSet.sanitize (c, this));
2502
5.34k
  }
OT::ContextFormat2_5<OT::Layout::SmallTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
2499
5.13k
  {
2500
5.13k
    TRACE_SANITIZE (this);
2501
5.13k
    return_trace (coverage.sanitize (c, this) && classDef.sanitize (c, this) && ruleSet.sanitize (c, this));
2502
5.13k
  }
OT::ContextFormat2_5<OT::Layout::MediumTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
2499
213
  {
2500
213
    TRACE_SANITIZE (this);
2501
213
    return_trace (coverage.sanitize (c, this) && classDef.sanitize (c, this) && ruleSet.sanitize (c, this));
2502
213
  }
2503
2504
  protected:
2505
  HBUINT16  format;     /* Format identifier--format = 2 */
2506
  typename Types::template OffsetTo<Coverage>
2507
    coverage;   /* Offset to Coverage table--from
2508
           * beginning of table */
2509
  typename Types::template OffsetTo<ClassDef>
2510
    classDef;   /* Offset to glyph ClassDef table--from
2511
           * beginning of table */
2512
  Array16Of<typename Types::template OffsetTo<RuleSet>>
2513
    ruleSet;    /* Array of RuleSet tables
2514
           * ordered by class */
2515
  public:
2516
  DEFINE_SIZE_ARRAY (4 + 2 * Types::size, ruleSet);
2517
};
2518
2519
2520
struct ContextFormat3
2521
{
2522
  using RuleSet = OT::RuleSet<SmallTypes>;
2523
2524
  bool intersects (const hb_set_t *glyphs) const
2525
0
  {
2526
0
    if (!(this+coverageZ[0]).intersects (glyphs))
2527
0
      return false;
2528
0
2529
0
    struct ContextClosureLookupContext lookup_context = {
2530
0
      {intersects_coverage, nullptr},
2531
0
      ContextFormat::CoverageBasedContext,
2532
0
      this
2533
0
    };
2534
0
    return context_intersects (glyphs,
2535
0
             glyphCount, (const HBUINT16 *) (coverageZ.arrayZ + 1),
2536
0
             lookup_context);
2537
0
  }
2538
2539
  bool may_have_non_1to1 () const
2540
0
  { return true; }
2541
2542
  void closure (hb_closure_context_t *c) const
2543
0
  {
2544
0
    if (!(this+coverageZ[0]).intersects (c->glyphs))
2545
0
      return;
2546
2547
0
    hb_set_t& cur_active_glyphs = c->push_cur_active_glyphs ();
2548
0
    get_coverage ().intersect_set (c->previous_parent_active_glyphs (),
2549
0
                                                 cur_active_glyphs);
2550
2551
2552
0
    const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount));
2553
0
    struct ContextClosureLookupContext lookup_context = {
2554
0
      {intersects_coverage, intersected_coverage_glyphs},
2555
0
      ContextFormat::CoverageBasedContext,
2556
0
      this
2557
0
    };
2558
0
    context_closure_lookup (c,
2559
0
          glyphCount, (const HBUINT16 *) (coverageZ.arrayZ + 1),
2560
0
          lookupCount, lookupRecord,
2561
0
          0, lookup_context);
2562
2563
0
    c->pop_cur_done_glyphs ();
2564
0
  }
2565
2566
  void closure_lookups (hb_closure_lookups_context_t *c) const
2567
0
  {
2568
0
    if (!intersects (c->glyphs))
2569
0
      return;
2570
0
    const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount));
2571
0
    recurse_lookups (c, lookupCount, lookupRecord);
2572
0
  }
2573
2574
0
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const {}
2575
2576
  void collect_glyphs (hb_collect_glyphs_context_t *c) const
2577
0
  {
2578
0
    (this+coverageZ[0]).collect_coverage (c->input);
2579
2580
0
    const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount));
2581
0
    struct ContextCollectGlyphsLookupContext lookup_context = {
2582
0
      {collect_coverage},
2583
0
      this
2584
0
    };
2585
2586
0
    context_collect_glyphs_lookup (c,
2587
0
           glyphCount, (const HBUINT16 *) (coverageZ.arrayZ + 1),
2588
0
           lookupCount, lookupRecord,
2589
0
           lookup_context);
2590
0
  }
2591
2592
  bool would_apply (hb_would_apply_context_t *c) const
2593
0
  {
2594
0
    const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount));
2595
0
    struct ContextApplyLookupContext lookup_context = {
2596
0
      {match_coverage},
2597
0
      this
2598
0
    };
2599
0
    return context_would_apply_lookup (c,
2600
0
               glyphCount, (const HBUINT16 *) (coverageZ.arrayZ + 1),
2601
0
               lookupCount, lookupRecord,
2602
0
               lookup_context);
2603
0
  }
2604
2605
1.14k
  const Coverage &get_coverage () const { return this+coverageZ[0]; }
2606
2607
  bool apply (hb_ot_apply_context_t *c) const
2608
798k
  {
2609
798k
    TRACE_APPLY (this);
2610
798k
    unsigned int index = (this+coverageZ[0]).get_coverage (c->buffer->cur().codepoint);
2611
798k
    if (likely (index == NOT_COVERED)) return_trace (false);
2612
2613
790k
    const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount));
2614
790k
    struct ContextApplyLookupContext lookup_context = {
2615
790k
      {match_coverage},
2616
790k
      this
2617
790k
    };
2618
790k
    return_trace (context_apply_lookup (c, glyphCount, (const HBUINT16 *) (coverageZ.arrayZ + 1), lookupCount, lookupRecord, lookup_context));
2619
798k
  }
2620
2621
  bool subset (hb_subset_context_t *c) const
2622
0
  {
2623
0
    TRACE_SUBSET (this);
2624
0
    auto *out = c->serializer->start_embed (this);
2625
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
2626
0
2627
0
    out->format = format;
2628
0
    out->glyphCount = glyphCount;
2629
0
2630
0
    auto coverages = coverageZ.as_array (glyphCount);
2631
0
2632
0
    for (const Offset16To<Coverage>& offset : coverages)
2633
0
    {
2634
0
      /* TODO(subset) This looks like should not be necessary to write this way. */
2635
0
      auto *o = c->serializer->allocate_size<Offset16To<Coverage>> (Offset16To<Coverage>::static_size);
2636
0
      if (unlikely (!o)) return_trace (false);
2637
0
      if (!o->serialize_subset (c, offset, this)) return_trace (false);
2638
0
    }
2639
0
2640
0
    const auto& lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>> (coverageZ.as_array (glyphCount));
2641
0
    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
2642
0
2643
0
2644
0
    unsigned count = serialize_lookuprecord_array (c->serializer, lookupRecord.as_array (lookupCount), lookup_map);
2645
0
    return_trace (c->serializer->check_assign (out->lookupCount, count, HB_SERIALIZE_ERROR_INT_OVERFLOW));
2646
0
  }
2647
2648
  bool sanitize (hb_sanitize_context_t *c) const
2649
2.16k
  {
2650
2.16k
    TRACE_SANITIZE (this);
2651
2.16k
    if (!c->check_struct (this)) return_trace (false);
2652
2.15k
    unsigned int count = glyphCount;
2653
2.15k
    if (!count) return_trace (false); /* We want to access coverageZ[0] freely. */
2654
2.10k
    if (!c->check_array (coverageZ.arrayZ, count)) return_trace (false);
2655
10.7k
    for (unsigned int i = 0; i < count; i++)
2656
8.66k
      if (!coverageZ[i].sanitize (c, this)) return_trace (false);
2657
2.05k
    const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount));
2658
2.05k
    return_trace (c->check_array (lookupRecord, lookupCount));
2659
2.08k
  }
2660
2661
  protected:
2662
  HBUINT16  format;     /* Format identifier--format = 3 */
2663
  HBUINT16  glyphCount;   /* Number of glyphs in the input glyph
2664
           * sequence */
2665
  HBUINT16  lookupCount;    /* Number of LookupRecords */
2666
  UnsizedArrayOf<Offset16To<Coverage>>
2667
    coverageZ;    /* Array of offsets to Coverage
2668
           * table in glyph sequence order */
2669
/*UnsizedArrayOf<LookupRecord>
2670
    lookupRecordX;*/  /* Array of LookupRecords--in
2671
           * design order */
2672
  public:
2673
  DEFINE_SIZE_ARRAY (6, coverageZ);
2674
};
2675
2676
struct Context
2677
{
2678
  template <typename context_t, typename ...Ts>
2679
  typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
2680
56.5k
  {
2681
56.5k
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
2682
55.2k
    TRACE_DISPATCH (this, u.format);
2683
55.2k
    switch (u.format) {
2684
8.04k
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
2685
8.19k
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
2686
3.30k
    case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
2687
0
#ifndef HB_NO_BEYOND_64K
2688
410
    case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
2689
274
    case 5: return_trace (c->dispatch (u.format5, std::forward<Ts> (ds)...));
2690
0
#endif
2691
35.0k
    default:return_trace (c->default_return_value ());
2692
55.2k
    }
2693
55.2k
  }
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::Context::dispatch<OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::Context::dispatch<OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::Context::dispatch<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::Context::dispatch<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: hb_subset_context_t::return_t OT::Context::dispatch<hb_subset_context_t>(hb_subset_context_t*) const
hb_sanitize_context_t::return_t OT::Context::dispatch<hb_sanitize_context_t>(hb_sanitize_context_t*) const
Line
Count
Source
2680
36.8k
  {
2681
36.8k
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
2682
35.5k
    TRACE_DISPATCH (this, u.format);
2683
35.5k
    switch (u.format) {
2684
5.33k
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
2685
5.13k
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
2686
2.16k
    case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
2687
0
#ifndef HB_NO_BEYOND_64K
2688
389
    case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
2689
213
    case 5: return_trace (c->dispatch (u.format5, std::forward<Ts> (ds)...));
2690
0
#endif
2691
22.3k
    default:return_trace (c->default_return_value ());
2692
35.5k
    }
2693
35.5k
  }
Unexecuted instantiation: OT::hb_collect_variation_indices_context_t::return_t OT::Context::dispatch<OT::hb_collect_variation_indices_context_t>(OT::hb_collect_variation_indices_context_t*) const
OT::hb_accelerate_subtables_context_t::return_t OT::Context::dispatch<OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Line
Count
Source
2680
18.4k
  {
2681
18.4k
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
2682
18.4k
    TRACE_DISPATCH (this, u.format);
2683
18.4k
    switch (u.format) {
2684
2.57k
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
2685
3.05k
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
2686
1.14k
    case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
2687
0
#ifndef HB_NO_BEYOND_64K
2688
21
    case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
2689
61
    case 5: return_trace (c->dispatch (u.format5, std::forward<Ts> (ds)...));
2690
0
#endif
2691
11.6k
    default:return_trace (c->default_return_value ());
2692
18.4k
    }
2693
18.4k
  }
Unexecuted instantiation: OT::hb_have_non_1to1_context_t::return_t OT::Context::dispatch<OT::hb_have_non_1to1_context_t>(OT::hb_have_non_1to1_context_t*) const
Unexecuted instantiation: OT::hb_closure_context_t::return_t OT::Context::dispatch<OT::hb_closure_context_t>(OT::hb_closure_context_t*) const
OT::hb_would_apply_context_t::return_t OT::Context::dispatch<OT::hb_would_apply_context_t>(OT::hb_would_apply_context_t*) const
Line
Count
Source
2680
1.18k
  {
2681
1.18k
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
2682
1.18k
    TRACE_DISPATCH (this, u.format);
2683
1.18k
    switch (u.format) {
2684
136
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
2685
4
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
2686
0
    case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
2687
0
#ifndef HB_NO_BEYOND_64K
2688
0
    case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
2689
0
    case 5: return_trace (c->dispatch (u.format5, std::forward<Ts> (ds)...));
2690
0
#endif
2691
1.04k
    default:return_trace (c->default_return_value ());
2692
1.18k
    }
2693
1.18k
  }
Unexecuted instantiation: hb_get_glyph_alternates_dispatch_t::return_t OT::Context::dispatch<hb_get_glyph_alternates_dispatch_t, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&>(hb_get_glyph_alternates_dispatch_t*, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&) const
Unexecuted instantiation: hb_position_single_dispatch_t::return_t OT::Context::dispatch<hb_position_single_dispatch_t, hb_font_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&>(hb_position_single_dispatch_t*, hb_font_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&) const
2694
2695
  protected:
2696
  union {
2697
  HBUINT16      format;   /* Format identifier */
2698
  ContextFormat1_4<SmallTypes>  format1;
2699
  ContextFormat2_5<SmallTypes>  format2;
2700
  ContextFormat3    format3;
2701
#ifndef HB_NO_BEYOND_64K
2702
  ContextFormat1_4<MediumTypes> format4;
2703
  ContextFormat2_5<MediumTypes> format5;
2704
#endif
2705
  } u;
2706
};
2707
2708
2709
/* Chaining Contextual lookups */
2710
2711
struct ChainContextClosureLookupContext
2712
{
2713
  ContextClosureFuncs funcs;
2714
  ContextFormat context_format;
2715
  const void *intersects_data[3];
2716
  void *intersects_cache[3];
2717
  void *intersected_glyphs_cache;
2718
};
2719
2720
struct ChainContextCollectGlyphsLookupContext
2721
{
2722
  ContextCollectGlyphsFuncs funcs;
2723
  const void *collect_data[3];
2724
};
2725
2726
struct ChainContextApplyLookupContext
2727
{
2728
  ChainContextApplyFuncs funcs;
2729
  const void *match_data[3];
2730
};
2731
2732
template <typename HBUINT>
2733
static inline bool chain_context_intersects (const hb_set_t *glyphs,
2734
               unsigned int backtrackCount,
2735
               const HBUINT backtrack[],
2736
               unsigned int inputCount, /* Including the first glyph (not matched) */
2737
               const HBUINT input[], /* Array of input values--start with second glyph */
2738
               unsigned int lookaheadCount,
2739
               const HBUINT lookahead[],
2740
               ChainContextClosureLookupContext &lookup_context)
2741
0
{
2742
0
  return array_is_subset_of (glyphs,
2743
0
           backtrackCount, backtrack,
2744
0
           lookup_context.funcs.intersects,
2745
0
           lookup_context.intersects_data[0],
2746
0
           lookup_context.intersects_cache[0])
2747
0
      && array_is_subset_of (glyphs,
2748
0
           inputCount ? inputCount - 1 : 0, input,
2749
0
           lookup_context.funcs.intersects,
2750
0
           lookup_context.intersects_data[1],
2751
0
           lookup_context.intersects_cache[1])
2752
0
      && array_is_subset_of (glyphs,
2753
0
           lookaheadCount, lookahead,
2754
0
           lookup_context.funcs.intersects,
2755
0
           lookup_context.intersects_data[2],
2756
0
           lookup_context.intersects_cache[2]);
2757
0
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::chain_context_intersects<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-aat-layout.cc:bool OT::chain_context_intersects<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::chain_context_intersects<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::chain_context_intersects<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::chain_context_intersects<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:bool OT::chain_context_intersects<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::chain_context_intersects<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::chain_context_intersects<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::chain_context_intersects<OT::IntType<unsigned short, 2u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::chain_context_intersects<OT::IntType<unsigned int, 3u> >(hb_set_t const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, OT::ChainContextClosureLookupContext&)
2758
2759
template <typename HBUINT>
2760
static inline void chain_context_closure_lookup (hb_closure_context_t *c,
2761
             unsigned int backtrackCount,
2762
             const HBUINT backtrack[],
2763
             unsigned int inputCount, /* Including the first glyph (not matched) */
2764
             const HBUINT input[], /* Array of input values--start with second glyph */
2765
             unsigned int lookaheadCount,
2766
             const HBUINT lookahead[],
2767
             unsigned int lookupCount,
2768
             const LookupRecord lookupRecord[],
2769
             unsigned value,
2770
             ChainContextClosureLookupContext &lookup_context)
2771
0
{
2772
0
  if (chain_context_intersects (c->glyphs,
2773
0
        backtrackCount, backtrack,
2774
0
        inputCount, input,
2775
0
        lookaheadCount, lookahead,
2776
0
        lookup_context))
2777
0
    context_closure_recurse_lookups (c,
2778
0
         inputCount, input,
2779
0
         lookupCount, lookupRecord,
2780
0
         value,
2781
0
         lookup_context.context_format,
2782
0
         lookup_context.intersects_data[1],
2783
0
         lookup_context.funcs.intersected_glyphs,
2784
0
         lookup_context.intersected_glyphs_cache);
2785
0
}
Unexecuted instantiation: hb-aat-layout.cc:void OT::chain_context_closure_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:void OT::chain_context_closure_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:void OT::chain_context_closure_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:void OT::chain_context_closure_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:void OT::chain_context_closure_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::chain_context_closure_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::chain_context_closure_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::chain_context_closure_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_closure_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, unsigned int, OT::ChainContextClosureLookupContext&)
2786
2787
template <typename HBUINT>
2788
static inline void chain_context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c,
2789
              unsigned int backtrackCount,
2790
              const HBUINT backtrack[],
2791
              unsigned int inputCount, /* Including the first glyph (not matched) */
2792
              const HBUINT input[], /* Array of input values--start with second glyph */
2793
              unsigned int lookaheadCount,
2794
              const HBUINT lookahead[],
2795
              unsigned int lookupCount,
2796
              const LookupRecord lookupRecord[],
2797
              ChainContextCollectGlyphsLookupContext &lookup_context)
2798
0
{
2799
0
  collect_array (c, c->before,
2800
0
     backtrackCount, backtrack,
2801
0
     lookup_context.funcs.collect, lookup_context.collect_data[0]);
2802
0
  collect_array (c, c->input,
2803
0
     inputCount ? inputCount - 1 : 0, input,
2804
0
     lookup_context.funcs.collect, lookup_context.collect_data[1]);
2805
0
  collect_array (c, c->after,
2806
0
     lookaheadCount, lookahead,
2807
0
     lookup_context.funcs.collect, lookup_context.collect_data[2]);
2808
0
  recurse_lookups (c,
2809
0
       lookupCount, lookupRecord);
2810
0
}
Unexecuted instantiation: hb-aat-layout.cc:void OT::chain_context_collect_glyphs_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-aat-layout.cc:void OT::chain_context_collect_glyphs_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:void OT::chain_context_collect_glyphs_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-face.cc:void OT::chain_context_collect_glyphs_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:void OT::chain_context_collect_glyphs_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-layout.cc:void OT::chain_context_collect_glyphs_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::chain_context_collect_glyphs_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void OT::chain_context_collect_glyphs_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::chain_context_collect_glyphs_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void OT::chain_context_collect_glyphs_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_collect_glyphs_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextCollectGlyphsLookupContext&)
2811
2812
template <typename HBUINT>
2813
static inline bool chain_context_would_apply_lookup (hb_would_apply_context_t *c,
2814
                 unsigned int backtrackCount,
2815
                 const HBUINT backtrack[] HB_UNUSED,
2816
                 unsigned int inputCount, /* Including the first glyph (not matched) */
2817
                 const HBUINT input[], /* Array of input values--start with second glyph */
2818
                 unsigned int lookaheadCount,
2819
                 const HBUINT lookahead[] HB_UNUSED,
2820
                 unsigned int lookupCount HB_UNUSED,
2821
                 const LookupRecord lookupRecord[] HB_UNUSED,
2822
                 const ChainContextApplyLookupContext &lookup_context)
2823
103
{
2824
103
  return (c->zero_context ? !backtrackCount && !lookaheadCount : true)
2825
103
      && would_match_input (c,
2826
103
          inputCount, input,
2827
103
          lookup_context.funcs.match[1], lookup_context.match_data[1]);
2828
103
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::chain_context_would_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::chain_context_would_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::chain_context_would_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
hb-ot-layout.cc:bool OT::chain_context_would_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Line
Count
Source
2823
103
{
2824
103
  return (c->zero_context ? !backtrackCount && !lookaheadCount : true)
2825
103
      && would_match_input (c,
2826
103
          inputCount, input,
2827
103
          lookup_context.funcs.match[1], lookup_context.match_data[1]);
2828
103
}
Unexecuted instantiation: hb-ot-layout.cc:bool OT::chain_context_would_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::chain_context_would_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::chain_context_would_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::chain_context_would_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_would_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
2829
2830
template <typename HBUINT>
2831
static inline bool chain_context_apply_lookup (hb_ot_apply_context_t *c,
2832
                 unsigned int backtrackCount,
2833
                 const HBUINT backtrack[],
2834
                 unsigned int inputCount, /* Including the first glyph (not matched) */
2835
                 const HBUINT input[], /* Array of input values--start with second glyph */
2836
                 unsigned int lookaheadCount,
2837
                 const HBUINT lookahead[],
2838
                 unsigned int lookupCount,
2839
                 const LookupRecord lookupRecord[],
2840
                 const ChainContextApplyLookupContext &lookup_context)
2841
1.69M
{
2842
1.69M
  unsigned end_index = c->buffer->idx;
2843
1.69M
  unsigned match_end = 0;
2844
1.69M
  unsigned match_positions[HB_MAX_CONTEXT_LENGTH];
2845
1.69M
  if (!(match_input (c,
2846
1.69M
         inputCount, input,
2847
1.69M
         lookup_context.funcs.match[1], lookup_context.match_data[1],
2848
1.69M
         &match_end, match_positions) && (end_index = match_end)
2849
1.69M
       && match_lookahead (c,
2850
1.60M
         lookaheadCount, lookahead,
2851
1.60M
         lookup_context.funcs.match[2], lookup_context.match_data[2],
2852
1.60M
         match_end, &end_index)))
2853
92.8k
  {
2854
92.8k
    c->buffer->unsafe_to_concat (c->buffer->idx, end_index);
2855
92.8k
    return false;
2856
92.8k
  }
2857
2858
1.59M
  unsigned start_index = c->buffer->out_len;
2859
1.59M
  if (!match_backtrack (c,
2860
1.59M
      backtrackCount, backtrack,
2861
1.59M
      lookup_context.funcs.match[0], lookup_context.match_data[0],
2862
1.59M
      &start_index))
2863
30.9k
  {
2864
30.9k
    c->buffer->unsafe_to_concat_from_outbuffer (start_index, end_index);
2865
30.9k
    return false;
2866
30.9k
  }
2867
2868
1.56M
  c->buffer->unsafe_to_break_from_outbuffer (start_index, end_index);
2869
1.56M
  apply_lookup (c,
2870
1.56M
    inputCount, match_positions,
2871
1.56M
    lookupCount, lookupRecord,
2872
1.56M
    match_end);
2873
1.56M
  return true;
2874
1.59M
}
Unexecuted instantiation: hb-aat-layout.cc:bool OT::chain_context_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-aat-layout.cc:bool OT::chain_context_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::chain_context_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-face.cc:bool OT::chain_context_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
hb-ot-layout.cc:bool OT::chain_context_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Line
Count
Source
2841
1.69M
{
2842
1.69M
  unsigned end_index = c->buffer->idx;
2843
1.69M
  unsigned match_end = 0;
2844
1.69M
  unsigned match_positions[HB_MAX_CONTEXT_LENGTH];
2845
1.69M
  if (!(match_input (c,
2846
1.69M
         inputCount, input,
2847
1.69M
         lookup_context.funcs.match[1], lookup_context.match_data[1],
2848
1.69M
         &match_end, match_positions) && (end_index = match_end)
2849
1.69M
       && match_lookahead (c,
2850
1.60M
         lookaheadCount, lookahead,
2851
1.60M
         lookup_context.funcs.match[2], lookup_context.match_data[2],
2852
1.60M
         match_end, &end_index)))
2853
92.8k
  {
2854
92.8k
    c->buffer->unsafe_to_concat (c->buffer->idx, end_index);
2855
92.8k
    return false;
2856
92.8k
  }
2857
2858
1.59M
  unsigned start_index = c->buffer->out_len;
2859
1.59M
  if (!match_backtrack (c,
2860
1.59M
      backtrackCount, backtrack,
2861
1.59M
      lookup_context.funcs.match[0], lookup_context.match_data[0],
2862
1.59M
      &start_index))
2863
30.9k
  {
2864
30.9k
    c->buffer->unsafe_to_concat_from_outbuffer (start_index, end_index);
2865
30.9k
    return false;
2866
30.9k
  }
2867
2868
1.56M
  c->buffer->unsafe_to_break_from_outbuffer (start_index, end_index);
2869
1.56M
  apply_lookup (c,
2870
1.56M
    inputCount, match_positions,
2871
1.56M
    lookupCount, lookupRecord,
2872
1.56M
    match_end);
2873
1.56M
  return true;
2874
1.59M
}
Unexecuted instantiation: hb-ot-layout.cc:bool OT::chain_context_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::chain_context_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:bool OT::chain_context_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::chain_context_apply_lookup<OT::IntType<unsigned short, 2u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:bool OT::chain_context_apply_lookup<OT::IntType<unsigned int, 3u> >(OT::hb_ot_apply_context_t*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::IntType<unsigned int, 3u> const*, unsigned int, OT::LookupRecord const*, OT::ChainContextApplyLookupContext const&)
2875
2876
template <typename Types>
2877
struct ChainRule
2878
{
2879
  bool intersects (const hb_set_t *glyphs, ChainContextClosureLookupContext &lookup_context) const
2880
0
  {
2881
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
2882
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
2883
0
    return chain_context_intersects (glyphs,
2884
0
             backtrack.len, backtrack.arrayZ,
2885
0
             input.lenP1, input.arrayZ,
2886
0
             lookahead.len, lookahead.arrayZ,
2887
0
             lookup_context);
2888
0
  }
Unexecuted instantiation: OT::ChainRule<OT::Layout::SmallTypes>::intersects(hb_set_t const*, OT::ChainContextClosureLookupContext&) const
Unexecuted instantiation: OT::ChainRule<OT::Layout::MediumTypes>::intersects(hb_set_t const*, OT::ChainContextClosureLookupContext&) const
2889
2890
  void closure (hb_closure_context_t *c, unsigned value,
2891
    ChainContextClosureLookupContext &lookup_context) const
2892
0
  {
2893
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
2894
2895
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
2896
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
2897
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
2898
0
    chain_context_closure_lookup (c,
2899
0
          backtrack.len, backtrack.arrayZ,
2900
0
          input.lenP1, input.arrayZ,
2901
0
          lookahead.len, lookahead.arrayZ,
2902
0
          lookup.len, lookup.arrayZ,
2903
0
          value,
2904
0
          lookup_context);
2905
0
  }
Unexecuted instantiation: OT::ChainRule<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*, unsigned int, OT::ChainContextClosureLookupContext&) const
Unexecuted instantiation: OT::ChainRule<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*, unsigned int, OT::ChainContextClosureLookupContext&) const
2906
2907
  void closure_lookups (hb_closure_lookups_context_t *c,
2908
                        ChainContextClosureLookupContext &lookup_context) const
2909
0
  {
2910
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
2911
0
    if (!intersects (c->glyphs, lookup_context)) return;
2912
0
2913
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
2914
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
2915
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
2916
0
    recurse_lookups (c, lookup.len, lookup.arrayZ);
2917
0
  }
Unexecuted instantiation: OT::ChainRule<OT::Layout::SmallTypes>::closure_lookups(OT::hb_closure_lookups_context_t*, OT::ChainContextClosureLookupContext&) const
Unexecuted instantiation: OT::ChainRule<OT::Layout::MediumTypes>::closure_lookups(OT::hb_closure_lookups_context_t*, OT::ChainContextClosureLookupContext&) const
2918
2919
  void collect_glyphs (hb_collect_glyphs_context_t *c,
2920
           ChainContextCollectGlyphsLookupContext &lookup_context) const
2921
0
  {
2922
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
2923
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
2924
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
2925
0
    chain_context_collect_glyphs_lookup (c,
2926
0
           backtrack.len, backtrack.arrayZ,
2927
0
           input.lenP1, input.arrayZ,
2928
0
           lookahead.len, lookahead.arrayZ,
2929
0
           lookup.len, lookup.arrayZ,
2930
0
           lookup_context);
2931
0
  }
Unexecuted instantiation: OT::ChainRule<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*, OT::ChainContextCollectGlyphsLookupContext&) const
Unexecuted instantiation: OT::ChainRule<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*, OT::ChainContextCollectGlyphsLookupContext&) const
2932
2933
  bool would_apply (hb_would_apply_context_t *c,
2934
        const ChainContextApplyLookupContext &lookup_context) const
2935
103
  {
2936
103
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
2937
103
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
2938
103
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
2939
103
    return chain_context_would_apply_lookup (c,
2940
103
               backtrack.len, backtrack.arrayZ,
2941
103
               input.lenP1, input.arrayZ,
2942
103
               lookahead.len, lookahead.arrayZ, lookup.len,
2943
103
               lookup.arrayZ, lookup_context);
2944
103
  }
OT::ChainRule<OT::Layout::SmallTypes>::would_apply(OT::hb_would_apply_context_t*, OT::ChainContextApplyLookupContext const&) const
Line
Count
Source
2935
103
  {
2936
103
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
2937
103
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
2938
103
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
2939
103
    return chain_context_would_apply_lookup (c,
2940
103
               backtrack.len, backtrack.arrayZ,
2941
103
               input.lenP1, input.arrayZ,
2942
103
               lookahead.len, lookahead.arrayZ, lookup.len,
2943
103
               lookup.arrayZ, lookup_context);
2944
103
  }
Unexecuted instantiation: OT::ChainRule<OT::Layout::MediumTypes>::would_apply(OT::hb_would_apply_context_t*, OT::ChainContextApplyLookupContext const&) const
2945
2946
  bool apply (hb_ot_apply_context_t *c,
2947
        const ChainContextApplyLookupContext &lookup_context) const
2948
1.54M
  {
2949
1.54M
    TRACE_APPLY (this);
2950
1.54M
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
2951
1.54M
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
2952
1.54M
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
2953
1.54M
    return_trace (chain_context_apply_lookup (c,
2954
1.54M
                backtrack.len, backtrack.arrayZ,
2955
1.54M
                input.lenP1, input.arrayZ,
2956
1.54M
                lookahead.len, lookahead.arrayZ, lookup.len,
2957
1.54M
                lookup.arrayZ, lookup_context));
2958
1.54M
  }
OT::ChainRule<OT::Layout::SmallTypes>::apply(OT::hb_ot_apply_context_t*, OT::ChainContextApplyLookupContext const&) const
Line
Count
Source
2948
1.54M
  {
2949
1.54M
    TRACE_APPLY (this);
2950
1.54M
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
2951
1.54M
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
2952
1.54M
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
2953
1.54M
    return_trace (chain_context_apply_lookup (c,
2954
1.54M
                backtrack.len, backtrack.arrayZ,
2955
1.54M
                input.lenP1, input.arrayZ,
2956
1.54M
                lookahead.len, lookahead.arrayZ, lookup.len,
2957
1.54M
                lookup.arrayZ, lookup_context));
2958
1.54M
  }
Unexecuted instantiation: OT::ChainRule<OT::Layout::MediumTypes>::apply(OT::hb_ot_apply_context_t*, OT::ChainContextApplyLookupContext const&) const
2959
2960
  template<typename Iterator,
2961
     hb_requires (hb_is_iterator (Iterator))>
2962
  void serialize_array (hb_serialize_context_t *c,
2963
      HBUINT16 len,
2964
      Iterator it) const
2965
0
  {
2966
0
    c->copy (len);
2967
0
    for (const auto g : it)
2968
0
      c->copy ((HBUINT16) g);
2969
0
  }
Unexecuted instantiation: void OT::ChainRule<OT::Layout::SmallTypes>::serialize_array<hb_map_iter_t<hb_array_t<OT::IntType<unsigned short, 2u> const>, hb_map_t const*&, (hb_function_sortedness_t)0, (void*)0>, (void*)0>(hb_serialize_context_t*, OT::IntType<unsigned short, 2u>, hb_map_iter_t<hb_array_t<OT::IntType<unsigned short, 2u> const>, hb_map_t const*&, (hb_function_sortedness_t)0, (void*)0>) const
Unexecuted instantiation: void OT::ChainRule<OT::Layout::MediumTypes>::serialize_array<hb_map_iter_t<hb_array_t<OT::IntType<unsigned int, 3u> const>, hb_map_t const*&, (hb_function_sortedness_t)0, (void*)0>, (void*)0>(hb_serialize_context_t*, OT::IntType<unsigned short, 2u>, hb_map_iter_t<hb_array_t<OT::IntType<unsigned int, 3u> const>, hb_map_t const*&, (hb_function_sortedness_t)0, (void*)0>) const
2970
2971
  bool serialize (hb_serialize_context_t *c,
2972
      const hb_map_t *lookup_map,
2973
      const hb_map_t *backtrack_map,
2974
      const hb_map_t *input_map = nullptr,
2975
      const hb_map_t *lookahead_map = nullptr) const
2976
0
  {
2977
0
    TRACE_SERIALIZE (this);
2978
0
    auto *out = c->start_embed (this);
2979
0
    if (unlikely (!out)) return_trace (false);
2980
0
2981
0
    const hb_map_t *mapping = backtrack_map;
2982
0
    serialize_array (c, backtrack.len, + backtrack.iter ()
2983
0
               | hb_map (mapping));
2984
0
2985
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
2986
0
    if (input_map) mapping = input_map;
2987
0
    serialize_array (c, input.lenP1, + input.iter ()
2988
0
             | hb_map (mapping));
2989
0
2990
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
2991
0
    if (lookahead_map) mapping = lookahead_map;
2992
0
    serialize_array (c, lookahead.len, + lookahead.iter ()
2993
0
               | hb_map (mapping));
2994
0
2995
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
2996
0
2997
0
    HBUINT16* lookupCount = c->embed (&(lookup.len));
2998
0
    if (!lookupCount) return_trace (false);
2999
0
3000
0
    unsigned count = serialize_lookuprecord_array (c, lookup.as_array (), lookup_map);
3001
0
    return_trace (c->check_assign (*lookupCount, count, HB_SERIALIZE_ERROR_INT_OVERFLOW));
3002
0
  }
Unexecuted instantiation: OT::ChainRule<OT::Layout::SmallTypes>::serialize(hb_serialize_context_t*, hb_map_t const*, hb_map_t const*, hb_map_t const*, hb_map_t const*) const
Unexecuted instantiation: OT::ChainRule<OT::Layout::MediumTypes>::serialize(hb_serialize_context_t*, hb_map_t const*, hb_map_t const*, hb_map_t const*, hb_map_t const*) const
3003
3004
  bool subset (hb_subset_context_t *c,
3005
         const hb_map_t *lookup_map,
3006
         const hb_map_t *backtrack_map = nullptr,
3007
         const hb_map_t *input_map = nullptr,
3008
         const hb_map_t *lookahead_map = nullptr) const
3009
0
  {
3010
0
    TRACE_SUBSET (this);
3011
0
3012
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3013
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3014
0
3015
0
    if (!backtrack_map)
3016
0
    {
3017
0
      const hb_set_t &glyphset = *c->plan->glyphset_gsub ();
3018
0
      if (!hb_all (backtrack, glyphset) ||
3019
0
    !hb_all (input, glyphset) ||
3020
0
    !hb_all (lookahead, glyphset))
3021
0
  return_trace (false);
3022
0
3023
0
      serialize (c->serializer, lookup_map, c->plan->glyph_map);
3024
0
    }
3025
0
    else
3026
0
    {
3027
0
      if (!hb_all (backtrack, backtrack_map) ||
3028
0
    !hb_all (input, input_map) ||
3029
0
    !hb_all (lookahead, lookahead_map))
3030
0
  return_trace (false);
3031
0
3032
0
      serialize (c->serializer, lookup_map, backtrack_map, input_map, lookahead_map);
3033
0
    }
3034
0
3035
0
    return_trace (true);
3036
0
  }
Unexecuted instantiation: OT::ChainRule<OT::Layout::SmallTypes>::subset(hb_subset_context_t*, hb_map_t const*, hb_map_t const*, hb_map_t const*, hb_map_t const*) const
Unexecuted instantiation: OT::ChainRule<OT::Layout::MediumTypes>::subset(hb_subset_context_t*, hb_map_t const*, hb_map_t const*, hb_map_t const*, hb_map_t const*) const
3037
3038
  bool sanitize (hb_sanitize_context_t *c) const
3039
350k
  {
3040
350k
    TRACE_SANITIZE (this);
3041
350k
    if (!backtrack.sanitize (c)) return_trace (false);
3042
342k
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3043
342k
    if (!input.sanitize (c)) return_trace (false);
3044
340k
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3045
340k
    if (!lookahead.sanitize (c)) return_trace (false);
3046
339k
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3047
339k
    return_trace (lookup.sanitize (c));
3048
340k
  }
OT::ChainRule<OT::Layout::SmallTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
3039
342k
  {
3040
342k
    TRACE_SANITIZE (this);
3041
342k
    if (!backtrack.sanitize (c)) return_trace (false);
3042
335k
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3043
335k
    if (!input.sanitize (c)) return_trace (false);
3044
333k
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3045
333k
    if (!lookahead.sanitize (c)) return_trace (false);
3046
332k
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3047
332k
    return_trace (lookup.sanitize (c));
3048
333k
  }
OT::ChainRule<OT::Layout::MediumTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
3039
8.13k
  {
3040
8.13k
    TRACE_SANITIZE (this);
3041
8.13k
    if (!backtrack.sanitize (c)) return_trace (false);
3042
7.00k
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3043
7.00k
    if (!input.sanitize (c)) return_trace (false);
3044
6.69k
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3045
6.69k
    if (!lookahead.sanitize (c)) return_trace (false);
3046
6.44k
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3047
6.44k
    return_trace (lookup.sanitize (c));
3048
6.69k
  }
3049
3050
  protected:
3051
  Array16Of<typename Types::HBUINT>
3052
    backtrack;    /* Array of backtracking values
3053
           * (to be matched before the input
3054
           * sequence) */
3055
  HeadlessArrayOf<typename Types::HBUINT>
3056
    inputX;     /* Array of input values (start with
3057
           * second glyph) */
3058
  Array16Of<typename Types::HBUINT>
3059
    lookaheadX;   /* Array of lookahead values's (to be
3060
           * matched after the input sequence) */
3061
  Array16Of<LookupRecord>
3062
    lookupX;    /* Array of LookupRecords--in
3063
           * design order) */
3064
  public:
3065
  DEFINE_SIZE_MIN (8);
3066
};
3067
3068
template <typename Types>
3069
struct ChainRuleSet
3070
{
3071
  using ChainRule = OT::ChainRule<Types>;
3072
3073
  bool intersects (const hb_set_t *glyphs, ChainContextClosureLookupContext &lookup_context) const
3074
0
  {
3075
0
    return
3076
0
    + hb_iter (rule)
3077
0
    | hb_map (hb_add (this))
3078
0
    | hb_map ([&] (const ChainRule &_) { return _.intersects (glyphs, lookup_context); })
3079
0
    | hb_any
3080
0
    ;
3081
0
  }
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::SmallTypes>::intersects(hb_set_t const*, OT::ChainContextClosureLookupContext&) const
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::MediumTypes>::intersects(hb_set_t const*, OT::ChainContextClosureLookupContext&) const
3082
  void closure (hb_closure_context_t *c, unsigned value, ChainContextClosureLookupContext &lookup_context) const
3083
0
  {
3084
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
3085
3086
0
    return
3087
0
    + hb_iter (rule)
3088
0
    | hb_map (hb_add (this))
3089
0
    | hb_apply ([&] (const ChainRule &_) { _.closure (c, value, lookup_context); })
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*, unsigned int, OT::ChainContextClosureLookupContext&) const::{lambda(OT::ChainRule<OT::Layout::SmallTypes> const&)#1}::operator()(OT::ChainRule<OT::Layout::SmallTypes> const&) const
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*, unsigned int, OT::ChainContextClosureLookupContext&) const::{lambda(OT::ChainRule<OT::Layout::MediumTypes> const&)#1}::operator()(OT::ChainRule<OT::Layout::MediumTypes> const&) const
3090
0
    ;
3091
0
  }
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*, unsigned int, OT::ChainContextClosureLookupContext&) const
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*, unsigned int, OT::ChainContextClosureLookupContext&) const
3092
3093
  void closure_lookups (hb_closure_lookups_context_t *c,
3094
                        ChainContextClosureLookupContext &lookup_context) const
3095
0
  {
3096
0
    if (unlikely (c->lookup_limit_exceeded ())) return;
3097
0
3098
0
    + hb_iter (rule)
3099
0
    | hb_map (hb_add (this))
3100
0
    | hb_apply ([&] (const ChainRule &_) { _.closure_lookups (c, lookup_context); })
3101
0
    ;
3102
0
  }
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::SmallTypes>::closure_lookups(OT::hb_closure_lookups_context_t*, OT::ChainContextClosureLookupContext&) const
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::MediumTypes>::closure_lookups(OT::hb_closure_lookups_context_t*, OT::ChainContextClosureLookupContext&) const
3103
3104
  void collect_glyphs (hb_collect_glyphs_context_t *c, ChainContextCollectGlyphsLookupContext &lookup_context) const
3105
0
  {
3106
0
    return
3107
0
    + hb_iter (rule)
3108
0
    | hb_map (hb_add (this))
3109
0
    | hb_apply ([&] (const ChainRule &_) { _.collect_glyphs (c, lookup_context); })
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*, OT::ChainContextCollectGlyphsLookupContext&) const::{lambda(OT::ChainRule<OT::Layout::SmallTypes> const&)#1}::operator()(OT::ChainRule<OT::Layout::SmallTypes> const&) const
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*, OT::ChainContextCollectGlyphsLookupContext&) const::{lambda(OT::ChainRule<OT::Layout::MediumTypes> const&)#1}::operator()(OT::ChainRule<OT::Layout::MediumTypes> const&) const
3110
0
    ;
3111
0
  }
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*, OT::ChainContextCollectGlyphsLookupContext&) const
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*, OT::ChainContextCollectGlyphsLookupContext&) const
3112
3113
  bool would_apply (hb_would_apply_context_t *c,
3114
        const ChainContextApplyLookupContext &lookup_context) const
3115
133
  {
3116
133
    return
3117
133
    + hb_iter (rule)
3118
133
    | hb_map (hb_add (this))
3119
133
    | hb_map ([&] (const ChainRule &_) { return _.would_apply (c, lookup_context); })
OT::ChainRuleSet<OT::Layout::SmallTypes>::would_apply(OT::hb_would_apply_context_t*, OT::ChainContextApplyLookupContext const&) const::{lambda(OT::ChainRule<OT::Layout::SmallTypes> const&)#1}::operator()(OT::ChainRule<OT::Layout::SmallTypes> const&) const
Line
Count
Source
3119
103
    | hb_map ([&] (const ChainRule &_) { return _.would_apply (c, lookup_context); })
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::MediumTypes>::would_apply(OT::hb_would_apply_context_t*, OT::ChainContextApplyLookupContext const&) const::{lambda(OT::ChainRule<OT::Layout::MediumTypes> const&)#1}::operator()(OT::ChainRule<OT::Layout::MediumTypes> const&) const
3120
133
    | hb_any
3121
133
    ;
3122
133
  }
OT::ChainRuleSet<OT::Layout::SmallTypes>::would_apply(OT::hb_would_apply_context_t*, OT::ChainContextApplyLookupContext const&) const
Line
Count
Source
3115
133
  {
3116
133
    return
3117
133
    + hb_iter (rule)
3118
133
    | hb_map (hb_add (this))
3119
133
    | hb_map ([&] (const ChainRule &_) { return _.would_apply (c, lookup_context); })
3120
133
    | hb_any
3121
133
    ;
3122
133
  }
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::MediumTypes>::would_apply(OT::hb_would_apply_context_t*, OT::ChainContextApplyLookupContext const&) const
3123
3124
  bool apply (hb_ot_apply_context_t *c,
3125
        const ChainContextApplyLookupContext &lookup_context) const
3126
1.89M
  {
3127
1.89M
    TRACE_APPLY (this);
3128
1.89M
    return_trace (
3129
1.89M
    + hb_iter (rule)
3130
1.89M
    | hb_map (hb_add (this))
3131
1.89M
    | hb_map ([&] (const ChainRule &_) { return _.apply (c, lookup_context); })
3132
1.89M
    | hb_any
3133
1.89M
    )
3134
1.89M
    ;
3135
1.89M
  }
OT::ChainRuleSet<OT::Layout::SmallTypes>::apply(OT::hb_ot_apply_context_t*, OT::ChainContextApplyLookupContext const&) const
Line
Count
Source
3126
1.89M
  {
3127
1.89M
    TRACE_APPLY (this);
3128
1.89M
    return_trace (
3129
1.89M
    + hb_iter (rule)
3130
1.89M
    | hb_map (hb_add (this))
3131
1.89M
    | hb_map ([&] (const ChainRule &_) { return _.apply (c, lookup_context); })
3132
1.89M
    | hb_any
3133
1.89M
    )
3134
1.89M
    ;
3135
1.89M
  }
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::MediumTypes>::apply(OT::hb_ot_apply_context_t*, OT::ChainContextApplyLookupContext const&) const
3136
3137
  bool subset (hb_subset_context_t *c,
3138
         const hb_map_t *lookup_map,
3139
         const hb_map_t *backtrack_klass_map = nullptr,
3140
         const hb_map_t *input_klass_map = nullptr,
3141
         const hb_map_t *lookahead_klass_map = nullptr) const
3142
0
  {
3143
0
    TRACE_SUBSET (this);
3144
0
3145
0
    auto snap = c->serializer->snapshot ();
3146
0
    auto *out = c->serializer->start_embed (*this);
3147
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
3148
0
3149
0
    for (const Offset16To<ChainRule>& _ : rule)
3150
0
    {
3151
0
      if (!_) continue;
3152
0
      auto o_snap = c->serializer->snapshot ();
3153
0
      auto *o = out->rule.serialize_append (c->serializer);
3154
0
      if (unlikely (!o)) continue;
3155
0
3156
0
      if (!o->serialize_subset (c, _, this,
3157
0
        lookup_map,
3158
0
        backtrack_klass_map,
3159
0
        input_klass_map,
3160
0
        lookahead_klass_map))
3161
0
      {
3162
0
  out->rule.pop ();
3163
0
  c->serializer->revert (o_snap);
3164
0
      }
3165
0
    }
3166
0
3167
0
    bool ret = bool (out->rule);
3168
0
    if (!ret) c->serializer->revert (snap);
3169
0
3170
0
    return_trace (ret);
3171
0
  }
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::SmallTypes>::subset(hb_subset_context_t*, hb_map_t const*, hb_map_t const*, hb_map_t const*, hb_map_t const*) const
Unexecuted instantiation: OT::ChainRuleSet<OT::Layout::MediumTypes>::subset(hb_subset_context_t*, hb_map_t const*, hb_map_t const*, hb_map_t const*, hb_map_t const*) const
3172
3173
  bool sanitize (hb_sanitize_context_t *c) const
3174
26.2k
  {
3175
26.2k
    TRACE_SANITIZE (this);
3176
26.2k
    return_trace (rule.sanitize (c, this));
3177
26.2k
  }
OT::ChainRuleSet<OT::Layout::SmallTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
3174
24.0k
  {
3175
24.0k
    TRACE_SANITIZE (this);
3176
24.0k
    return_trace (rule.sanitize (c, this));
3177
24.0k
  }
OT::ChainRuleSet<OT::Layout::MediumTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
3174
2.14k
  {
3175
2.14k
    TRACE_SANITIZE (this);
3176
2.14k
    return_trace (rule.sanitize (c, this));
3177
2.14k
  }
3178
3179
  protected:
3180
  Array16OfOffset16To<ChainRule>
3181
    rule;     /* Array of ChainRule tables
3182
           * ordered by preference */
3183
  public:
3184
  DEFINE_SIZE_ARRAY (2, rule);
3185
};
3186
3187
template <typename Types>
3188
struct ChainContextFormat1_4
3189
{
3190
  using ChainRuleSet = OT::ChainRuleSet<Types>;
3191
3192
  bool intersects (const hb_set_t *glyphs) const
3193
0
  {
3194
0
    struct ChainContextClosureLookupContext lookup_context = {
3195
0
      {intersects_glyph, intersected_glyph},
3196
0
      ContextFormat::SimpleContext,
3197
0
      {nullptr, nullptr, nullptr}
3198
0
    };
3199
0
3200
0
    return
3201
0
    + hb_zip (this+coverage, ruleSet)
3202
0
    | hb_filter (*glyphs, hb_first)
3203
0
    | hb_map (hb_second)
3204
0
    | hb_map (hb_add (this))
3205
0
    | hb_map ([&] (const ChainRuleSet &_) { return _.intersects (glyphs, lookup_context); })
3206
0
    | hb_any
3207
0
    ;
3208
0
  }
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::intersects(hb_set_t const*) const
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::intersects(hb_set_t const*) const
3209
3210
  bool may_have_non_1to1 () const
3211
0
  { return true; }
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::may_have_non_1to1() const
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::may_have_non_1to1() const
3212
3213
  void closure (hb_closure_context_t *c) const
3214
0
  {
3215
0
    hb_set_t& cur_active_glyphs = c->push_cur_active_glyphs ();
3216
0
    get_coverage ().intersect_set (c->previous_parent_active_glyphs (),
3217
0
                                                 cur_active_glyphs);
3218
3219
0
    struct ChainContextClosureLookupContext lookup_context = {
3220
0
      {intersects_glyph, intersected_glyph},
3221
0
      ContextFormat::SimpleContext,
3222
0
      {nullptr, nullptr, nullptr}
3223
0
    };
3224
3225
0
    + hb_zip (this+coverage, hb_range ((unsigned) ruleSet.len))
3226
0
    | hb_filter ([&] (hb_codepoint_t _) {
3227
0
      return c->previous_parent_active_glyphs ().has (_);
3228
0
    }, hb_first)
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const::{lambda(unsigned int)#1}::operator()(unsigned int) const
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const::{lambda(unsigned int)#1}::operator()(unsigned int) const
3229
0
    | hb_map ([&](const hb_pair_t<hb_codepoint_t, unsigned> _) { return hb_pair_t<unsigned, const ChainRuleSet&> (_.first, this+ruleSet[_.second]); })
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const::{lambda(hb_pair_t<unsigned int, unsigned int>)#1}::operator()(hb_pair_t<unsigned int, unsigned int>) const
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const::{lambda(hb_pair_t<unsigned int, unsigned int>)#1}::operator()(hb_pair_t<unsigned int, unsigned int>) const
3230
0
    | hb_apply ([&] (const hb_pair_t<unsigned, const ChainRuleSet&>& _) { _.second.closure (c, _.first, lookup_context); })
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const::{lambda(hb_pair_t<unsigned int, OT::ChainRuleSet<OT::Layout::SmallTypes> const&> const&)#1}::operator()(hb_pair_t<unsigned int, OT::ChainRuleSet<OT::Layout::SmallTypes> const&> const&) const
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const::{lambda(hb_pair_t<unsigned int, OT::ChainRuleSet<OT::Layout::MediumTypes> const&> const&)#1}::operator()(hb_pair_t<unsigned int, OT::ChainRuleSet<OT::Layout::MediumTypes> const&> const&) const
3231
0
    ;
3232
3233
0
    c->pop_cur_done_glyphs ();
3234
0
  }
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const
3235
3236
  void closure_lookups (hb_closure_lookups_context_t *c) const
3237
0
  {
3238
0
    struct ChainContextClosureLookupContext lookup_context = {
3239
0
      {intersects_glyph, nullptr},
3240
0
      ContextFormat::SimpleContext,
3241
0
      {nullptr, nullptr, nullptr}
3242
0
    };
3243
0
3244
0
    + hb_zip (this+coverage, ruleSet)
3245
0
    | hb_filter (*c->glyphs, hb_first)
3246
0
    | hb_map (hb_second)
3247
0
    | hb_map (hb_add (this))
3248
0
    | hb_apply ([&] (const ChainRuleSet &_) { _.closure_lookups (c, lookup_context); })
3249
0
    ;
3250
0
  }
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::closure_lookups(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::closure_lookups(OT::hb_closure_lookups_context_t*) const
3251
3252
0
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const {}
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::collect_variation_indices(OT::hb_collect_variation_indices_context_t*) const
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::collect_variation_indices(OT::hb_collect_variation_indices_context_t*) const
3253
3254
  void collect_glyphs (hb_collect_glyphs_context_t *c) const
3255
0
  {
3256
0
    (this+coverage).collect_coverage (c->input);
3257
3258
0
    struct ChainContextCollectGlyphsLookupContext lookup_context = {
3259
0
      {collect_glyph},
3260
0
      {nullptr, nullptr, nullptr}
3261
0
    };
3262
3263
0
    + hb_iter (ruleSet)
3264
0
    | hb_map (hb_add (this))
3265
0
    | hb_apply ([&] (const ChainRuleSet &_) { _.collect_glyphs (c, lookup_context); })
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const::{lambda(OT::ChainRuleSet<OT::Layout::SmallTypes> const&)#1}::operator()(OT::ChainRuleSet<OT::Layout::SmallTypes> const&) const
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const::{lambda(OT::ChainRuleSet<OT::Layout::MediumTypes> const&)#1}::operator()(OT::ChainRuleSet<OT::Layout::MediumTypes> const&) const
3266
0
    ;
3267
0
  }
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const
3268
3269
  bool would_apply (hb_would_apply_context_t *c) const
3270
129
  {
3271
129
    const ChainRuleSet &rule_set = this+ruleSet[(this+coverage).get_coverage (c->glyphs[0])];
3272
129
    struct ChainContextApplyLookupContext lookup_context = {
3273
129
      {{match_glyph, match_glyph, match_glyph}},
3274
129
      {nullptr, nullptr, nullptr}
3275
129
    };
3276
129
    return rule_set.would_apply (c, lookup_context);
3277
129
  }
OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::would_apply(OT::hb_would_apply_context_t*) const
Line
Count
Source
3270
129
  {
3271
129
    const ChainRuleSet &rule_set = this+ruleSet[(this+coverage).get_coverage (c->glyphs[0])];
3272
129
    struct ChainContextApplyLookupContext lookup_context = {
3273
129
      {{match_glyph, match_glyph, match_glyph}},
3274
129
      {nullptr, nullptr, nullptr}
3275
129
    };
3276
129
    return rule_set.would_apply (c, lookup_context);
3277
129
  }
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::would_apply(OT::hb_would_apply_context_t*) const
3278
3279
2.19k
  const Coverage &get_coverage () const { return this+coverage; }
OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::get_coverage() const
Line
Count
Source
3279
2.17k
  const Coverage &get_coverage () const { return this+coverage; }
OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::get_coverage() const
Line
Count
Source
3279
23
  const Coverage &get_coverage () const { return this+coverage; }
3280
3281
  bool apply (hb_ot_apply_context_t *c) const
3282
1.45M
  {
3283
1.45M
    TRACE_APPLY (this);
3284
1.45M
    unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
3285
1.45M
    if (likely (index == NOT_COVERED)) return_trace (false);
3286
3287
1.45M
    const ChainRuleSet &rule_set = this+ruleSet[index];
3288
1.45M
    struct ChainContextApplyLookupContext lookup_context = {
3289
1.45M
      {{match_glyph, match_glyph, match_glyph}},
3290
1.45M
      {nullptr, nullptr, nullptr}
3291
1.45M
    };
3292
1.45M
    return_trace (rule_set.apply (c, lookup_context));
3293
1.45M
  }
OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::apply(OT::hb_ot_apply_context_t*) const
Line
Count
Source
3282
1.45M
  {
3283
1.45M
    TRACE_APPLY (this);
3284
1.45M
    unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
3285
1.45M
    if (likely (index == NOT_COVERED)) return_trace (false);
3286
3287
1.45M
    const ChainRuleSet &rule_set = this+ruleSet[index];
3288
1.45M
    struct ChainContextApplyLookupContext lookup_context = {
3289
1.45M
      {{match_glyph, match_glyph, match_glyph}},
3290
1.45M
      {nullptr, nullptr, nullptr}
3291
1.45M
    };
3292
1.45M
    return_trace (rule_set.apply (c, lookup_context));
3293
1.45M
  }
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::apply(OT::hb_ot_apply_context_t*) const
3294
3295
  bool subset (hb_subset_context_t *c) const
3296
0
  {
3297
0
    TRACE_SUBSET (this);
3298
0
    const hb_set_t &glyphset = *c->plan->glyphset_gsub ();
3299
0
    const hb_map_t &glyph_map = *c->plan->glyph_map;
3300
0
3301
0
    auto *out = c->serializer->start_embed (*this);
3302
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
3303
0
    out->format = format;
3304
0
3305
0
    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
3306
0
    hb_sorted_vector_t<hb_codepoint_t> new_coverage;
3307
0
    + hb_zip (this+coverage, ruleSet)
3308
0
    | hb_filter (glyphset, hb_first)
3309
0
    | hb_filter (subset_offset_array (c, out->ruleSet, this, lookup_map), hb_second)
3310
0
    | hb_map (hb_first)
3311
0
    | hb_map (glyph_map)
3312
0
    | hb_sink (new_coverage)
3313
0
    ;
3314
0
3315
0
    out->coverage.serialize_serialize (c->serializer, new_coverage.iter ());
3316
0
    return_trace (bool (new_coverage));
3317
0
  }
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::subset(hb_subset_context_t*) const
Unexecuted instantiation: OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::subset(hb_subset_context_t*) const
3318
3319
  bool sanitize (hb_sanitize_context_t *c) const
3320
5.48k
  {
3321
5.48k
    TRACE_SANITIZE (this);
3322
5.48k
    return_trace (coverage.sanitize (c, this) && ruleSet.sanitize (c, this));
3323
5.48k
  }
OT::ChainContextFormat1_4<OT::Layout::SmallTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
3320
4.92k
  {
3321
4.92k
    TRACE_SANITIZE (this);
3322
4.92k
    return_trace (coverage.sanitize (c, this) && ruleSet.sanitize (c, this));
3323
4.92k
  }
OT::ChainContextFormat1_4<OT::Layout::MediumTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
3320
557
  {
3321
557
    TRACE_SANITIZE (this);
3322
557
    return_trace (coverage.sanitize (c, this) && ruleSet.sanitize (c, this));
3323
557
  }
3324
3325
  protected:
3326
  HBUINT16  format;     /* Format identifier--format = 1 */
3327
  typename Types::template OffsetTo<Coverage>
3328
    coverage;   /* Offset to Coverage table--from
3329
           * beginning of table */
3330
  Array16Of<typename Types::template OffsetTo<ChainRuleSet>>
3331
    ruleSet;    /* Array of ChainRuleSet tables
3332
           * ordered by Coverage Index */
3333
  public:
3334
  DEFINE_SIZE_ARRAY (2 + 2 * Types::size, ruleSet);
3335
};
3336
3337
template <typename Types>
3338
struct ChainContextFormat2_5
3339
{
3340
  using ChainRuleSet = OT::ChainRuleSet<SmallTypes>;
3341
3342
  bool intersects (const hb_set_t *glyphs) const
3343
0
  {
3344
0
    if (!(this+coverage).intersects (glyphs))
3345
0
      return false;
3346
0
3347
0
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
3348
0
    const ClassDef &input_class_def = this+inputClassDef;
3349
0
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
3350
0
3351
0
    hb_map_t caches[3] = {};
3352
0
    struct ChainContextClosureLookupContext lookup_context = {
3353
0
      {intersects_class, nullptr},
3354
0
      ContextFormat::ClassBasedContext,
3355
0
      {&backtrack_class_def,
3356
0
       &input_class_def,
3357
0
       &lookahead_class_def},
3358
0
      {&caches[0], &caches[1], &caches[2]}
3359
0
    };
3360
0
3361
0
    hb_set_t retained_coverage_glyphs;
3362
0
    (this+coverage).intersect_set (*glyphs, retained_coverage_glyphs);
3363
0
3364
0
    hb_set_t coverage_glyph_classes;
3365
0
    input_class_def.intersected_classes (&retained_coverage_glyphs, &coverage_glyph_classes);
3366
0
3367
0
    return
3368
0
    + hb_iter (ruleSet)
3369
0
    | hb_map (hb_add (this))
3370
0
    | hb_enumerate
3371
0
    | hb_map ([&] (const hb_pair_t<unsigned, const ChainRuleSet &> p)
3372
0
        { return input_class_def.intersects_class (glyphs, p.first) &&
3373
0
           coverage_glyph_classes.has (p.first) &&
3374
0
           p.second.intersects (glyphs, lookup_context); })
3375
0
    | hb_any
3376
0
    ;
3377
0
  }
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::intersects(hb_set_t const*) const
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::intersects(hb_set_t const*) const
3378
3379
  bool may_have_non_1to1 () const
3380
0
  { return true; }
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::may_have_non_1to1() const
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::may_have_non_1to1() const
3381
3382
  void closure (hb_closure_context_t *c) const
3383
0
  {
3384
0
    if (!(this+coverage).intersects (c->glyphs))
3385
0
      return;
3386
3387
0
    hb_set_t& cur_active_glyphs = c->push_cur_active_glyphs ();
3388
0
    get_coverage ().intersect_set (c->previous_parent_active_glyphs (),
3389
0
                                                 cur_active_glyphs);
3390
3391
3392
0
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
3393
0
    const ClassDef &input_class_def = this+inputClassDef;
3394
0
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
3395
3396
0
    hb_map_t caches[3] = {};
3397
0
    intersected_class_cache_t intersected_cache;
3398
0
    struct ChainContextClosureLookupContext lookup_context = {
3399
0
      {intersects_class, intersected_class_glyphs},
3400
0
      ContextFormat::ClassBasedContext,
3401
0
      {&backtrack_class_def,
3402
0
       &input_class_def,
3403
0
       &lookahead_class_def},
3404
0
      {&caches[0], &caches[1], &caches[2]},
3405
0
      &intersected_cache
3406
0
    };
3407
3408
0
    + hb_enumerate (ruleSet)
3409
0
    | hb_filter ([&] (unsigned _)
3410
0
    { return input_class_def.intersects_class (&c->parent_active_glyphs (), _); },
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const::{lambda(unsigned int)#1}::operator()(unsigned int) const
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const::{lambda(unsigned int)#1}::operator()(unsigned int) const
3411
0
     hb_first)
3412
0
    | hb_apply ([&] (const hb_pair_t<unsigned, const typename Types::template OffsetTo<ChainRuleSet>&> _)
3413
0
                {
3414
0
                  const ChainRuleSet& chainrule_set = this+_.second;
3415
0
                  chainrule_set.closure (c, _.first, lookup_context);
3416
0
                })
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const::{lambda(hb_pair_t<unsigned int, OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::IntType<unsigned short, 2u>, true> const&>)#1}::operator()(hb_pair_t<unsigned int, OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::IntType<unsigned short, 2u>, true> const&>) const
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const::{lambda(hb_pair_t<unsigned int, OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::IntType<unsigned int, 3u>, true> const&>)#1}::operator()(hb_pair_t<unsigned int, OT::OffsetTo<OT::ChainRuleSet<OT::Layout::SmallTypes>, OT::IntType<unsigned int, 3u>, true> const&>) const
3417
0
    ;
3418
3419
0
    c->pop_cur_done_glyphs ();
3420
0
  }
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::closure(OT::hb_closure_context_t*) const
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::closure(OT::hb_closure_context_t*) const
3421
3422
  void closure_lookups (hb_closure_lookups_context_t *c) const
3423
0
  {
3424
0
    if (!(this+coverage).intersects (c->glyphs))
3425
0
      return;
3426
0
3427
0
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
3428
0
    const ClassDef &input_class_def = this+inputClassDef;
3429
0
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
3430
0
3431
0
    hb_map_t caches[3] = {};
3432
0
    struct ChainContextClosureLookupContext lookup_context = {
3433
0
      {intersects_class, nullptr},
3434
0
      ContextFormat::ClassBasedContext,
3435
0
      {&backtrack_class_def,
3436
0
       &input_class_def,
3437
0
       &lookahead_class_def},
3438
0
      {&caches[0], &caches[1], &caches[2]}
3439
0
    };
3440
0
3441
0
    + hb_iter (ruleSet)
3442
0
    | hb_map (hb_add (this))
3443
0
    | hb_enumerate
3444
0
    | hb_filter([&] (unsigned klass)
3445
0
    { return input_class_def.intersects_class (c->glyphs, klass); }, hb_first)
3446
0
    | hb_map (hb_second)
3447
0
    | hb_apply ([&] (const ChainRuleSet &_)
3448
0
    { _.closure_lookups (c, lookup_context); })
3449
0
    ;
3450
0
  }
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::closure_lookups(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::closure_lookups(OT::hb_closure_lookups_context_t*) const
3451
3452
0
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const {}
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::collect_variation_indices(OT::hb_collect_variation_indices_context_t*) const
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::collect_variation_indices(OT::hb_collect_variation_indices_context_t*) const
3453
3454
  void collect_glyphs (hb_collect_glyphs_context_t *c) const
3455
0
  {
3456
0
    (this+coverage).collect_coverage (c->input);
3457
3458
0
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
3459
0
    const ClassDef &input_class_def = this+inputClassDef;
3460
0
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
3461
3462
0
    struct ChainContextCollectGlyphsLookupContext lookup_context = {
3463
0
      {collect_class},
3464
0
      {&backtrack_class_def,
3465
0
       &input_class_def,
3466
0
       &lookahead_class_def}
3467
0
    };
3468
3469
0
    + hb_iter (ruleSet)
3470
0
    | hb_map (hb_add (this))
3471
0
    | hb_apply ([&] (const ChainRuleSet &_) { _.collect_glyphs (c, lookup_context); })
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const::{lambda(OT::ChainRuleSet<OT::Layout::SmallTypes> const&)#1}::operator()(OT::ChainRuleSet<OT::Layout::SmallTypes> const&) const
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const::{lambda(OT::ChainRuleSet<OT::Layout::SmallTypes> const&)#1}::operator()(OT::ChainRuleSet<OT::Layout::SmallTypes> const&) const
3472
0
    ;
3473
0
  }
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::collect_glyphs(OT::hb_collect_glyphs_context_t*) const
3474
3475
  bool would_apply (hb_would_apply_context_t *c) const
3476
4
  {
3477
4
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
3478
4
    const ClassDef &input_class_def = this+inputClassDef;
3479
4
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
3480
3481
4
    unsigned int index = input_class_def.get_class (c->glyphs[0]);
3482
4
    const ChainRuleSet &rule_set = this+ruleSet[index];
3483
4
    struct ChainContextApplyLookupContext lookup_context = {
3484
4
      {{match_class, match_class, match_class}},
3485
4
      {&backtrack_class_def,
3486
4
       &input_class_def,
3487
4
       &lookahead_class_def}
3488
4
    };
3489
4
    return rule_set.would_apply (c, lookup_context);
3490
4
  }
OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::would_apply(OT::hb_would_apply_context_t*) const
Line
Count
Source
3476
4
  {
3477
4
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
3478
4
    const ClassDef &input_class_def = this+inputClassDef;
3479
4
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
3480
3481
4
    unsigned int index = input_class_def.get_class (c->glyphs[0]);
3482
4
    const ChainRuleSet &rule_set = this+ruleSet[index];
3483
4
    struct ChainContextApplyLookupContext lookup_context = {
3484
4
      {{match_class, match_class, match_class}},
3485
4
      {&backtrack_class_def,
3486
4
       &input_class_def,
3487
4
       &lookahead_class_def}
3488
4
    };
3489
4
    return rule_set.would_apply (c, lookup_context);
3490
4
  }
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::would_apply(OT::hb_would_apply_context_t*) const
3491
3492
5.31k
  const Coverage &get_coverage () const { return this+coverage; }
OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::get_coverage() const
Line
Count
Source
3492
5.26k
  const Coverage &get_coverage () const { return this+coverage; }
OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::get_coverage() const
Line
Count
Source
3492
50
  const Coverage &get_coverage () const { return this+coverage; }
3493
3494
  unsigned cache_cost () const
3495
5.31k
  {
3496
5.31k
    unsigned c = (this+lookaheadClassDef).cost () * ruleSet.len;
3497
5.31k
    return c >= 4 ? c : 0;
3498
5.31k
  }
OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::cache_cost() const
Line
Count
Source
3495
5.26k
  {
3496
5.26k
    unsigned c = (this+lookaheadClassDef).cost () * ruleSet.len;
3497
5.26k
    return c >= 4 ? c : 0;
3498
5.26k
  }
OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::cache_cost() const
Line
Count
Source
3495
50
  {
3496
50
    unsigned c = (this+lookaheadClassDef).cost () * ruleSet.len;
3497
50
    return c >= 4 ? c : 0;
3498
50
  }
3499
  bool cache_func (hb_ot_apply_context_t *c, bool enter) const
3500
94
  {
3501
94
    if (enter)
3502
47
    {
3503
47
      if (!HB_BUFFER_TRY_ALLOCATE_VAR (c->buffer, syllable))
3504
0
  return false;
3505
47
      auto &info = c->buffer->info;
3506
47
      unsigned count = c->buffer->len;
3507
196
      for (unsigned i = 0; i < count; i++)
3508
149
  info[i].syllable() = 255;
3509
47
      c->new_syllables = 255;
3510
47
      return true;
3511
47
    }
3512
47
    else
3513
47
    {
3514
47
      c->new_syllables = (unsigned) -1;
3515
47
      HB_BUFFER_DEALLOCATE_VAR (c->buffer, syllable);
3516
47
      return true;
3517
47
    }
3518
94
  }
OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::cache_func(OT::hb_ot_apply_context_t*, bool) const
Line
Count
Source
3500
94
  {
3501
94
    if (enter)
3502
47
    {
3503
47
      if (!HB_BUFFER_TRY_ALLOCATE_VAR (c->buffer, syllable))
3504
0
  return false;
3505
47
      auto &info = c->buffer->info;
3506
47
      unsigned count = c->buffer->len;
3507
196
      for (unsigned i = 0; i < count; i++)
3508
149
  info[i].syllable() = 255;
3509
47
      c->new_syllables = 255;
3510
47
      return true;
3511
47
    }
3512
47
    else
3513
47
    {
3514
47
      c->new_syllables = (unsigned) -1;
3515
47
      HB_BUFFER_DEALLOCATE_VAR (c->buffer, syllable);
3516
47
      return true;
3517
47
    }
3518
94
  }
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::cache_func(OT::hb_ot_apply_context_t*, bool) const
3519
3520
  bool apply (hb_ot_apply_context_t *c, bool cached = false) const
3521
440k
  {
3522
440k
    TRACE_APPLY (this);
3523
440k
    unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
3524
440k
    if (likely (index == NOT_COVERED)) return_trace (false);
3525
3526
440k
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
3527
440k
    const ClassDef &input_class_def = this+inputClassDef;
3528
440k
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
3529
3530
    /* For ChainContextFormat2_5 we cache the LookaheadClassDef instead of InputClassDef.
3531
     * The reason is that most heavy fonts want to identify a glyph in context and apply
3532
     * a lookup to it. In this scenario, the length of the input sequence is one, whereas
3533
     * the lookahead / backtrack are typically longer.  The one glyph in input sequence is
3534
     * looked-up below and no input glyph is looked up in individual rules, whereas the
3535
     * lookahead and backtrack glyphs are tried.  Since we match lookahead before backtrack,
3536
     * we should cache lookahead.  This decisions showed a 20% improvement in shaping of
3537
     * the Gulzar font.
3538
     */
3539
3540
440k
    struct ChainContextApplyLookupContext lookup_context = {
3541
440k
      {{cached && &backtrack_class_def == &lookahead_class_def ? match_class_cached : match_class,
3542
440k
        cached && &input_class_def == &lookahead_class_def ? match_class_cached : match_class,
3543
440k
        cached ? match_class_cached : match_class}},
3544
440k
      {&backtrack_class_def,
3545
440k
       &input_class_def,
3546
440k
       &lookahead_class_def}
3547
440k
    };
3548
3549
440k
    index = input_class_def.get_class (c->buffer->cur().codepoint);
3550
440k
    const ChainRuleSet &rule_set = this+ruleSet[index];
3551
440k
    return_trace (rule_set.apply (c, lookup_context));
3552
440k
  }
OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::apply(OT::hb_ot_apply_context_t*, bool) const
Line
Count
Source
3521
440k
  {
3522
440k
    TRACE_APPLY (this);
3523
440k
    unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
3524
440k
    if (likely (index == NOT_COVERED)) return_trace (false);
3525
3526
440k
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
3527
440k
    const ClassDef &input_class_def = this+inputClassDef;
3528
440k
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
3529
3530
    /* For ChainContextFormat2_5 we cache the LookaheadClassDef instead of InputClassDef.
3531
     * The reason is that most heavy fonts want to identify a glyph in context and apply
3532
     * a lookup to it. In this scenario, the length of the input sequence is one, whereas
3533
     * the lookahead / backtrack are typically longer.  The one glyph in input sequence is
3534
     * looked-up below and no input glyph is looked up in individual rules, whereas the
3535
     * lookahead and backtrack glyphs are tried.  Since we match lookahead before backtrack,
3536
     * we should cache lookahead.  This decisions showed a 20% improvement in shaping of
3537
     * the Gulzar font.
3538
     */
3539
3540
440k
    struct ChainContextApplyLookupContext lookup_context = {
3541
440k
      {{cached && &backtrack_class_def == &lookahead_class_def ? match_class_cached : match_class,
3542
440k
        cached && &input_class_def == &lookahead_class_def ? match_class_cached : match_class,
3543
440k
        cached ? match_class_cached : match_class}},
3544
440k
      {&backtrack_class_def,
3545
440k
       &input_class_def,
3546
440k
       &lookahead_class_def}
3547
440k
    };
3548
3549
440k
    index = input_class_def.get_class (c->buffer->cur().codepoint);
3550
440k
    const ChainRuleSet &rule_set = this+ruleSet[index];
3551
440k
    return_trace (rule_set.apply (c, lookup_context));
3552
440k
  }
OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::apply(OT::hb_ot_apply_context_t*, bool) const
Line
Count
Source
3521
100
  {
3522
100
    TRACE_APPLY (this);
3523
100
    unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
3524
100
    if (likely (index == NOT_COVERED)) return_trace (false);
3525
3526
46
    const ClassDef &backtrack_class_def = this+backtrackClassDef;
3527
46
    const ClassDef &input_class_def = this+inputClassDef;
3528
46
    const ClassDef &lookahead_class_def = this+lookaheadClassDef;
3529
3530
    /* For ChainContextFormat2_5 we cache the LookaheadClassDef instead of InputClassDef.
3531
     * The reason is that most heavy fonts want to identify a glyph in context and apply
3532
     * a lookup to it. In this scenario, the length of the input sequence is one, whereas
3533
     * the lookahead / backtrack are typically longer.  The one glyph in input sequence is
3534
     * looked-up below and no input glyph is looked up in individual rules, whereas the
3535
     * lookahead and backtrack glyphs are tried.  Since we match lookahead before backtrack,
3536
     * we should cache lookahead.  This decisions showed a 20% improvement in shaping of
3537
     * the Gulzar font.
3538
     */
3539
3540
46
    struct ChainContextApplyLookupContext lookup_context = {
3541
46
      {{cached && &backtrack_class_def == &lookahead_class_def ? match_class_cached : match_class,
3542
46
        cached && &input_class_def == &lookahead_class_def ? match_class_cached : match_class,
3543
46
        cached ? match_class_cached : match_class}},
3544
46
      {&backtrack_class_def,
3545
46
       &input_class_def,
3546
46
       &lookahead_class_def}
3547
46
    };
3548
3549
46
    index = input_class_def.get_class (c->buffer->cur().codepoint);
3550
46
    const ChainRuleSet &rule_set = this+ruleSet[index];
3551
46
    return_trace (rule_set.apply (c, lookup_context));
3552
100
  }
3553
3554
  bool subset (hb_subset_context_t *c) const
3555
0
  {
3556
0
    TRACE_SUBSET (this);
3557
0
    auto *out = c->serializer->start_embed (*this);
3558
0
    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
3559
0
    out->format = format;
3560
0
    out->coverage.serialize_subset (c, coverage, this);
3561
0
3562
0
    hb_map_t backtrack_klass_map;
3563
0
    hb_map_t input_klass_map;
3564
0
    hb_map_t lookahead_klass_map;
3565
0
3566
0
    out->backtrackClassDef.serialize_subset (c, backtrackClassDef, this, &backtrack_klass_map);
3567
0
    // TODO: subset inputClassDef based on glyphs survived in Coverage subsetting
3568
0
    out->inputClassDef.serialize_subset (c, inputClassDef, this, &input_klass_map);
3569
0
    out->lookaheadClassDef.serialize_subset (c, lookaheadClassDef, this, &lookahead_klass_map);
3570
0
3571
0
    if (unlikely (!c->serializer->propagate_error (backtrack_klass_map,
3572
0
               input_klass_map,
3573
0
               lookahead_klass_map)))
3574
0
      return_trace (false);
3575
0
3576
0
    const hb_set_t* glyphset = c->plan->glyphset_gsub ();
3577
0
    hb_set_t retained_coverage_glyphs;
3578
0
    (this+coverage).intersect_set (*glyphset, retained_coverage_glyphs);
3579
0
3580
0
    hb_set_t coverage_glyph_classes;
3581
0
    (this+inputClassDef).intersected_classes (&retained_coverage_glyphs, &coverage_glyph_classes);
3582
0
3583
0
    int non_zero_index = -1, index = 0;
3584
0
    bool ret = true;
3585
0
    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
3586
0
    auto last_non_zero = c->serializer->snapshot ();
3587
0
    for (const auto& _ : + hb_enumerate (ruleSet)
3588
0
       | hb_filter (input_klass_map, hb_first))
3589
0
    {
3590
0
      auto *o = out->ruleSet.serialize_append (c->serializer);
3591
0
      if (unlikely (!o))
3592
0
      {
3593
0
  ret = false;
3594
0
  break;
3595
0
      }
3596
0
      if (coverage_glyph_classes.has (_.first) &&
3597
0
          o->serialize_subset (c, _.second, this,
3598
0
             lookup_map,
3599
0
             &backtrack_klass_map,
3600
0
             &input_klass_map,
3601
0
             &lookahead_klass_map))
3602
0
      {
3603
0
        last_non_zero = c->serializer->snapshot ();
3604
0
  non_zero_index = index;
3605
0
      }
3606
0
3607
0
      index++;
3608
0
    }
3609
0
3610
0
    if (!ret || non_zero_index == -1) return_trace (false);
3611
0
3612
0
    // prune empty trailing ruleSets
3613
0
    if (index > non_zero_index) {
3614
0
      c->serializer->revert (last_non_zero);
3615
0
      out->ruleSet.len = non_zero_index + 1;
3616
0
    }
3617
0
3618
0
    return_trace (bool (out->ruleSet));
3619
0
  }
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::subset(hb_subset_context_t*) const
Unexecuted instantiation: OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::subset(hb_subset_context_t*) const
3620
3621
  bool sanitize (hb_sanitize_context_t *c) const
3622
8.91k
  {
3623
8.91k
    TRACE_SANITIZE (this);
3624
8.91k
    return_trace (coverage.sanitize (c, this) &&
3625
8.91k
      backtrackClassDef.sanitize (c, this) &&
3626
8.91k
      inputClassDef.sanitize (c, this) &&
3627
8.91k
      lookaheadClassDef.sanitize (c, this) &&
3628
8.91k
      ruleSet.sanitize (c, this));
3629
8.91k
  }
OT::ChainContextFormat2_5<OT::Layout::SmallTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
3622
8.68k
  {
3623
8.68k
    TRACE_SANITIZE (this);
3624
8.68k
    return_trace (coverage.sanitize (c, this) &&
3625
8.68k
      backtrackClassDef.sanitize (c, this) &&
3626
8.68k
      inputClassDef.sanitize (c, this) &&
3627
8.68k
      lookaheadClassDef.sanitize (c, this) &&
3628
8.68k
      ruleSet.sanitize (c, this));
3629
8.68k
  }
OT::ChainContextFormat2_5<OT::Layout::MediumTypes>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
3622
230
  {
3623
230
    TRACE_SANITIZE (this);
3624
230
    return_trace (coverage.sanitize (c, this) &&
3625
230
      backtrackClassDef.sanitize (c, this) &&
3626
230
      inputClassDef.sanitize (c, this) &&
3627
230
      lookaheadClassDef.sanitize (c, this) &&
3628
230
      ruleSet.sanitize (c, this));
3629
230
  }
3630
3631
  protected:
3632
  HBUINT16  format;     /* Format identifier--format = 2 */
3633
  typename Types::template OffsetTo<Coverage>
3634
    coverage;   /* Offset to Coverage table--from
3635
           * beginning of table */
3636
  typename Types::template OffsetTo<ClassDef>
3637
    backtrackClassDef;  /* Offset to glyph ClassDef table
3638
           * containing backtrack sequence
3639
           * data--from beginning of table */
3640
  typename Types::template OffsetTo<ClassDef>
3641
    inputClassDef;    /* Offset to glyph ClassDef
3642
           * table containing input sequence
3643
           * data--from beginning of table */
3644
  typename Types::template OffsetTo<ClassDef>
3645
    lookaheadClassDef;  /* Offset to glyph ClassDef table
3646
           * containing lookahead sequence
3647
           * data--from beginning of table */
3648
  Array16Of<typename Types::template OffsetTo<ChainRuleSet>>
3649
    ruleSet;    /* Array of ChainRuleSet tables
3650
           * ordered by class */
3651
  public:
3652
  DEFINE_SIZE_ARRAY (4 + 4 * Types::size, ruleSet);
3653
};
3654
3655
struct ChainContextFormat3
3656
{
3657
  using RuleSet = OT::RuleSet<SmallTypes>;
3658
3659
  bool intersects (const hb_set_t *glyphs) const
3660
0
  {
3661
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3662
0
3663
0
    if (!(this+input[0]).intersects (glyphs))
3664
0
      return false;
3665
0
3666
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3667
0
    struct ChainContextClosureLookupContext lookup_context = {
3668
0
      {intersects_coverage, nullptr},
3669
0
      ContextFormat::CoverageBasedContext,
3670
0
      {this, this, this}
3671
0
    };
3672
0
    return chain_context_intersects (glyphs,
3673
0
             backtrack.len, (const HBUINT16 *) backtrack.arrayZ,
3674
0
             input.len, (const HBUINT16 *) input.arrayZ + 1,
3675
0
             lookahead.len, (const HBUINT16 *) lookahead.arrayZ,
3676
0
             lookup_context);
3677
0
  }
3678
3679
  bool may_have_non_1to1 () const
3680
0
  { return true; }
3681
3682
  void closure (hb_closure_context_t *c) const
3683
0
  {
3684
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3685
3686
0
    if (!(this+input[0]).intersects (c->glyphs))
3687
0
      return;
3688
3689
0
    hb_set_t& cur_active_glyphs = c->push_cur_active_glyphs ();
3690
0
    get_coverage ().intersect_set (c->previous_parent_active_glyphs (),
3691
0
                                                 cur_active_glyphs);
3692
3693
3694
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3695
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3696
0
    struct ChainContextClosureLookupContext lookup_context = {
3697
0
      {intersects_coverage, intersected_coverage_glyphs},
3698
0
      ContextFormat::CoverageBasedContext,
3699
0
      {this, this, this}
3700
0
    };
3701
0
    chain_context_closure_lookup (c,
3702
0
          backtrack.len, (const HBUINT16 *) backtrack.arrayZ,
3703
0
          input.len, (const HBUINT16 *) input.arrayZ + 1,
3704
0
          lookahead.len, (const HBUINT16 *) lookahead.arrayZ,
3705
0
          lookup.len, lookup.arrayZ,
3706
0
          0, lookup_context);
3707
3708
0
    c->pop_cur_done_glyphs ();
3709
0
  }
3710
3711
  void closure_lookups (hb_closure_lookups_context_t *c) const
3712
0
  {
3713
0
    if (!intersects (c->glyphs))
3714
0
      return;
3715
0
3716
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3717
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3718
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3719
0
    recurse_lookups (c, lookup.len, lookup.arrayZ);
3720
0
  }
3721
3722
0
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const {}
3723
3724
  void collect_glyphs (hb_collect_glyphs_context_t *c) const
3725
0
  {
3726
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3727
3728
0
    (this+input[0]).collect_coverage (c->input);
3729
3730
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3731
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3732
3733
0
    struct ChainContextCollectGlyphsLookupContext lookup_context = {
3734
0
      {collect_coverage},
3735
0
      {this, this, this}
3736
0
    };
3737
0
    chain_context_collect_glyphs_lookup (c,
3738
0
           backtrack.len, (const HBUINT16 *) backtrack.arrayZ,
3739
0
           input.len, (const HBUINT16 *) input.arrayZ + 1,
3740
0
           lookahead.len, (const HBUINT16 *) lookahead.arrayZ,
3741
0
           lookup.len, lookup.arrayZ,
3742
0
           lookup_context);
3743
0
  }
3744
3745
  bool would_apply (hb_would_apply_context_t *c) const
3746
0
  {
3747
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3748
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3749
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3750
0
    struct ChainContextApplyLookupContext lookup_context = {
3751
0
      {{match_coverage, match_coverage, match_coverage}},
3752
0
      {this, this, this}
3753
0
    };
3754
0
    return chain_context_would_apply_lookup (c,
3755
0
               backtrack.len, (const HBUINT16 *) backtrack.arrayZ,
3756
0
               input.len, (const HBUINT16 *) input.arrayZ + 1,
3757
0
               lookahead.len, (const HBUINT16 *) lookahead.arrayZ,
3758
0
               lookup.len, lookup.arrayZ, lookup_context);
3759
0
  }
3760
3761
  const Coverage &get_coverage () const
3762
30.1k
  {
3763
30.1k
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3764
30.1k
    return this+input[0];
3765
30.1k
  }
3766
3767
  bool apply (hb_ot_apply_context_t *c) const
3768
157k
  {
3769
157k
    TRACE_APPLY (this);
3770
157k
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3771
3772
157k
    unsigned int index = (this+input[0]).get_coverage (c->buffer->cur().codepoint);
3773
157k
    if (likely (index == NOT_COVERED)) return_trace (false);
3774
3775
151k
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3776
151k
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3777
151k
    struct ChainContextApplyLookupContext lookup_context = {
3778
151k
      {{match_coverage, match_coverage, match_coverage}},
3779
151k
      {this, this, this}
3780
151k
    };
3781
151k
    return_trace (chain_context_apply_lookup (c,
3782
157k
                backtrack.len, (const HBUINT16 *) backtrack.arrayZ,
3783
157k
                input.len, (const HBUINT16 *) input.arrayZ + 1,
3784
157k
                lookahead.len, (const HBUINT16 *) lookahead.arrayZ,
3785
157k
                lookup.len, lookup.arrayZ, lookup_context));
3786
157k
  }
3787
3788
  template<typename Iterator,
3789
     hb_requires (hb_is_iterator (Iterator))>
3790
  bool serialize_coverage_offsets (hb_subset_context_t *c, Iterator it, const void* base) const
3791
0
  {
3792
0
    TRACE_SERIALIZE (this);
3793
0
    auto *out = c->serializer->start_embed<Array16OfOffset16To<Coverage>> ();
3794
0
3795
0
    if (unlikely (!c->serializer->allocate_size<HBUINT16> (HBUINT16::static_size)))
3796
0
      return_trace (false);
3797
0
3798
0
    for (auto& offset : it) {
3799
0
      auto *o = out->serialize_append (c->serializer);
3800
0
      if (unlikely (!o) || !o->serialize_subset (c, offset, base))
3801
0
        return_trace (false);
3802
0
    }
3803
0
3804
0
    return_trace (true);
3805
0
  }
3806
3807
  bool subset (hb_subset_context_t *c) const
3808
0
  {
3809
0
    TRACE_SUBSET (this);
3810
0
3811
0
    auto *out = c->serializer->start_embed (this);
3812
0
    if (unlikely (!out)) return_trace (false);
3813
0
    if (unlikely (!c->serializer->embed (this->format))) return_trace (false);
3814
0
3815
0
    if (!serialize_coverage_offsets (c, backtrack.iter (), this))
3816
0
      return_trace (false);
3817
0
3818
0
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3819
0
    if (!serialize_coverage_offsets (c, input.iter (), this))
3820
0
      return_trace (false);
3821
0
3822
0
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3823
0
    if (!serialize_coverage_offsets (c, lookahead.iter (), this))
3824
0
      return_trace (false);
3825
0
3826
0
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3827
0
    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
3828
0
3829
0
    HBUINT16 *lookupCount = c->serializer->copy<HBUINT16> (lookup.len);
3830
0
    if (!lookupCount) return_trace (false);
3831
0
3832
0
    unsigned count = serialize_lookuprecord_array (c->serializer, lookup.as_array (), lookup_map);
3833
0
    return_trace (c->serializer->check_assign (*lookupCount, count, HB_SERIALIZE_ERROR_INT_OVERFLOW));
3834
0
  }
3835
3836
  bool sanitize (hb_sanitize_context_t *c) const
3837
40.1k
  {
3838
40.1k
    TRACE_SANITIZE (this);
3839
40.1k
    if (!backtrack.sanitize (c, this)) return_trace (false);
3840
40.0k
    const auto &input = StructAfter<decltype (inputX)> (backtrack);
3841
40.0k
    if (!input.sanitize (c, this)) return_trace (false);
3842
39.9k
    if (!input.len) return_trace (false); /* To be consistent with Context. */
3843
39.9k
    const auto &lookahead = StructAfter<decltype (lookaheadX)> (input);
3844
39.9k
    if (!lookahead.sanitize (c, this)) return_trace (false);
3845
39.7k
    const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
3846
39.7k
    return_trace (lookup.sanitize (c));
3847
39.9k
  }
3848
3849
  protected:
3850
  HBUINT16  format;     /* Format identifier--format = 3 */
3851
  Array16OfOffset16To<Coverage>
3852
    backtrack;    /* Array of coverage tables
3853
           * in backtracking sequence, in  glyph
3854
           * sequence order */
3855
  Array16OfOffset16To<Coverage>
3856
    inputX    ; /* Array of coverage
3857
           * tables in input sequence, in glyph
3858
           * sequence order */
3859
  Array16OfOffset16To<Coverage>
3860
    lookaheadX;   /* Array of coverage tables
3861
           * in lookahead sequence, in glyph
3862
           * sequence order */
3863
  Array16Of<LookupRecord>
3864
    lookupX;    /* Array of LookupRecords--in
3865
           * design order) */
3866
  public:
3867
  DEFINE_SIZE_MIN (10);
3868
};
3869
3870
struct ChainContext
3871
{
3872
  template <typename context_t, typename ...Ts>
3873
  typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
3874
127k
  {
3875
127k
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
3876
125k
    TRACE_DISPATCH (this, u.format);
3877
125k
    switch (u.format) {
3878
7.23k
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
3879
13.9k
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
3880
70.2k
    case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
3881
0
#ifndef HB_NO_BEYOND_64K
3882
580
    case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
3883
280
    case 5: return_trace (c->dispatch (u.format5, std::forward<Ts> (ds)...));
3884
0
#endif
3885
33.2k
    default:return_trace (c->default_return_value ());
3886
125k
    }
3887
125k
  }
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::ChainContext::dispatch<OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::ChainContext::dispatch<OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::ChainContext::dispatch<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::ChainContext::dispatch<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: hb_subset_context_t::return_t OT::ChainContext::dispatch<hb_subset_context_t>(hb_subset_context_t*) const
hb_sanitize_context_t::return_t OT::ChainContext::dispatch<hb_sanitize_context_t>(hb_sanitize_context_t*) const
Line
Count
Source
3874
79.6k
  {
3875
79.6k
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
3876
78.0k
    TRACE_DISPATCH (this, u.format);
3877
78.0k
    switch (u.format) {
3878
4.92k
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
3879
8.68k
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
3880
40.1k
    case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
3881
0
#ifndef HB_NO_BEYOND_64K
3882
557
    case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
3883
230
    case 5: return_trace (c->dispatch (u.format5, std::forward<Ts> (ds)...));
3884
0
#endif
3885
23.5k
    default:return_trace (c->default_return_value ());
3886
78.0k
    }
3887
78.0k
  }
Unexecuted instantiation: OT::hb_collect_variation_indices_context_t::return_t OT::ChainContext::dispatch<OT::hb_collect_variation_indices_context_t>(OT::hb_collect_variation_indices_context_t*) const
OT::hb_accelerate_subtables_context_t::return_t OT::ChainContext::dispatch<OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Line
Count
Source
3874
47.4k
  {
3875
47.4k
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
3876
47.4k
    TRACE_DISPATCH (this, u.format);
3877
47.4k
    switch (u.format) {
3878
2.17k
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
3879
5.26k
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
3880
30.1k
    case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
3881
0
#ifndef HB_NO_BEYOND_64K
3882
23
    case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
3883
50
    case 5: return_trace (c->dispatch (u.format5, std::forward<Ts> (ds)...));
3884
0
#endif
3885
9.79k
    default:return_trace (c->default_return_value ());
3886
47.4k
    }
3887
47.4k
  }
Unexecuted instantiation: OT::hb_have_non_1to1_context_t::return_t OT::ChainContext::dispatch<OT::hb_have_non_1to1_context_t>(OT::hb_have_non_1to1_context_t*) const
Unexecuted instantiation: OT::hb_closure_context_t::return_t OT::ChainContext::dispatch<OT::hb_closure_context_t>(OT::hb_closure_context_t*) const
OT::hb_would_apply_context_t::return_t OT::ChainContext::dispatch<OT::hb_would_apply_context_t>(OT::hb_would_apply_context_t*) const
Line
Count
Source
3874
139
  {
3875
139
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
3876
139
    TRACE_DISPATCH (this, u.format);
3877
139
    switch (u.format) {
3878
129
    case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
3879
4
    case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
3880
0
    case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
3881
0
#ifndef HB_NO_BEYOND_64K
3882
0
    case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
3883
0
    case 5: return_trace (c->dispatch (u.format5, std::forward<Ts> (ds)...));
3884
0
#endif
3885
6
    default:return_trace (c->default_return_value ());
3886
139
    }
3887
139
  }
Unexecuted instantiation: hb_get_glyph_alternates_dispatch_t::return_t OT::ChainContext::dispatch<hb_get_glyph_alternates_dispatch_t, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&>(hb_get_glyph_alternates_dispatch_t*, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&) const
Unexecuted instantiation: hb_position_single_dispatch_t::return_t OT::ChainContext::dispatch<hb_position_single_dispatch_t, hb_font_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&>(hb_position_single_dispatch_t*, hb_font_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&) const
3888
3889
  protected:
3890
  union {
3891
  HBUINT16        format; /* Format identifier */
3892
  ChainContextFormat1_4<SmallTypes> format1;
3893
  ChainContextFormat2_5<SmallTypes> format2;
3894
  ChainContextFormat3     format3;
3895
#ifndef HB_NO_BEYOND_64K
3896
  ChainContextFormat1_4<MediumTypes>  format4;
3897
  ChainContextFormat2_5<MediumTypes>  format5;
3898
#endif
3899
  } u;
3900
};
3901
3902
3903
template <typename T>
3904
struct ExtensionFormat1
3905
{
3906
61.6k
  unsigned int get_type () const { return extensionLookupType; }
OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::get_type() const
Line
Count
Source
3906
19.5k
  unsigned int get_type () const { return extensionLookupType; }
OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::get_type() const
Line
Count
Source
3906
42.0k
  unsigned int get_type () const { return extensionLookupType; }
3907
3908
  template <typename X>
3909
  const X& get_subtable () const
3910
43.2k
  { return this + reinterpret_cast<const Offset32To<typename T::SubTable> &> (extensionOffset); }
OT::Layout::GPOS_impl::PosLookupSubTable const& OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::get_subtable<OT::Layout::GPOS_impl::PosLookupSubTable>() const
Line
Count
Source
3910
14.3k
  { return this + reinterpret_cast<const Offset32To<typename T::SubTable> &> (extensionOffset); }
OT::Layout::GSUB_impl::SubstLookupSubTable const& OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::get_subtable<OT::Layout::GSUB_impl::SubstLookupSubTable>() const
Line
Count
Source
3910
28.8k
  { return this + reinterpret_cast<const Offset32To<typename T::SubTable> &> (extensionOffset); }
3911
3912
  template <typename context_t, typename ...Ts>
3913
  typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
3914
43.6k
  {
3915
43.6k
    if (unlikely (!c->may_dispatch (this, this))) return c->no_dispatch_return_value ();
3916
43.2k
    TRACE_DISPATCH (this, format);
3917
43.2k
    return_trace (get_subtable<typename T::SubTable> ().dispatch (c, get_type (), std::forward<Ts> (ds)...));
3918
43.6k
  }
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
hb_sanitize_context_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<hb_sanitize_context_t>(hb_sanitize_context_t*) const
Line
Count
Source
3914
10.5k
  {
3915
10.5k
    if (unlikely (!c->may_dispatch (this, this))) return c->no_dispatch_return_value ();
3916
10.4k
    TRACE_DISPATCH (this, format);
3917
10.4k
    return_trace (get_subtable<typename T::SubTable> ().dispatch (c, get_type (), std::forward<Ts> (ds)...));
3918
10.5k
  }
Unexecuted instantiation: OT::hb_collect_variation_indices_context_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_collect_variation_indices_context_t>(OT::hb_collect_variation_indices_context_t*) const
OT::hb_accelerate_subtables_context_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Line
Count
Source
3914
3.91k
  {
3915
3.91k
    if (unlikely (!c->may_dispatch (this, this))) return c->no_dispatch_return_value ();
3916
3.91k
    TRACE_DISPATCH (this, format);
3917
3.91k
    return_trace (get_subtable<typename T::SubTable> ().dispatch (c, get_type (), std::forward<Ts> (ds)...));
3918
3.91k
  }
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
hb_sanitize_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<hb_sanitize_context_t>(hb_sanitize_context_t*) const
Line
Count
Source
3914
18.3k
  {
3915
18.3k
    if (unlikely (!c->may_dispatch (this, this))) return c->no_dispatch_return_value ();
3916
18.0k
    TRACE_DISPATCH (this, format);
3917
18.0k
    return_trace (get_subtable<typename T::SubTable> ().dispatch (c, get_type (), std::forward<Ts> (ds)...));
3918
18.3k
  }
Unexecuted instantiation: OT::hb_have_non_1to1_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_have_non_1to1_context_t>(OT::hb_have_non_1to1_context_t*) const
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_closure_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_closure_context_t>(OT::hb_closure_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_would_apply_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_would_apply_context_t>(OT::hb_would_apply_context_t*) const
OT::hb_accelerate_subtables_context_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Line
Count
Source
3914
10.8k
  {
3915
10.8k
    if (unlikely (!c->may_dispatch (this, this))) return c->no_dispatch_return_value ();
3916
10.8k
    TRACE_DISPATCH (this, format);
3917
10.8k
    return_trace (get_subtable<typename T::SubTable> ().dispatch (c, get_type (), std::forward<Ts> (ds)...));
3918
10.8k
  }
Unexecuted instantiation: hb_get_glyph_alternates_dispatch_t::return_t OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<hb_get_glyph_alternates_dispatch_t, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&>(hb_get_glyph_alternates_dispatch_t*, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&) const
Unexecuted instantiation: hb_position_single_dispatch_t::return_t OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<hb_position_single_dispatch_t, hb_font_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&>(hb_position_single_dispatch_t*, hb_font_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&) const
3919
3920
  void collect_variation_indices (hb_collect_variation_indices_context_t *c) const
3921
  { dispatch (c); }
3922
3923
  /* This is called from may_dispatch() above with hb_sanitize_context_t. */
3924
  bool sanitize (hb_sanitize_context_t *c) const
3925
28.8k
  {
3926
28.8k
    TRACE_SANITIZE (this);
3927
28.8k
    return_trace (c->check_struct (this) &&
3928
28.8k
      extensionLookupType != T::SubTable::Extension);
3929
28.8k
  }
OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
3925
10.5k
  {
3926
10.5k
    TRACE_SANITIZE (this);
3927
10.5k
    return_trace (c->check_struct (this) &&
3928
10.5k
      extensionLookupType != T::SubTable::Extension);
3929
10.5k
  }
OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::sanitize(hb_sanitize_context_t*) const
Line
Count
Source
3925
18.3k
  {
3926
18.3k
    TRACE_SANITIZE (this);
3927
18.3k
    return_trace (c->check_struct (this) &&
3928
18.3k
      extensionLookupType != T::SubTable::Extension);
3929
18.3k
  }
3930
3931
  bool subset (hb_subset_context_t *c) const
3932
0
  {
3933
0
    TRACE_SUBSET (this);
3934
0
3935
0
    auto *out = c->serializer->start_embed (this);
3936
0
    if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false);
3937
0
3938
0
    out->format = format;
3939
0
    out->extensionLookupType = extensionLookupType;
3940
0
3941
0
    const auto& src_offset =
3942
0
        reinterpret_cast<const Offset32To<typename T::SubTable> &> (extensionOffset);
3943
0
    auto& dest_offset =
3944
0
        reinterpret_cast<Offset32To<typename T::SubTable> &> (out->extensionOffset);
3945
0
3946
0
    return_trace (dest_offset.serialize_subset (c, src_offset, this, get_type ()));
3947
0
  }
Unexecuted instantiation: OT::ExtensionFormat1<OT::Layout::GPOS_impl::ExtensionPos>::subset(hb_subset_context_t*) const
Unexecuted instantiation: OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::subset(hb_subset_context_t*) const
3948
3949
  protected:
3950
  HBUINT16  format;     /* Format identifier. Set to 1. */
3951
  HBUINT16  extensionLookupType;  /* Lookup type of subtable referenced
3952
           * by ExtensionOffset (i.e. the
3953
           * extension subtable). */
3954
  Offset32  extensionOffset;  /* Offset to the extension subtable,
3955
           * of lookup type subtable. */
3956
  public:
3957
  DEFINE_SIZE_STATIC (8);
3958
};
3959
3960
template <typename T>
3961
struct Extension
3962
{
3963
  unsigned int get_type () const
3964
25.2k
  {
3965
25.2k
    switch (u.format) {
3966
18.3k
    case 1: return u.format1.get_type ();
3967
6.91k
    default:return 0;
3968
25.2k
    }
3969
25.2k
  }
OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::get_type() const
Line
Count
Source
3964
6.49k
  {
3965
6.49k
    switch (u.format) {
3966
5.18k
    case 1: return u.format1.get_type ();
3967
1.31k
    default:return 0;
3968
6.49k
    }
3969
6.49k
  }
OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::get_type() const
Line
Count
Source
3964
18.7k
  {
3965
18.7k
    switch (u.format) {
3966
13.1k
    case 1: return u.format1.get_type ();
3967
5.60k
    default:return 0;
3968
18.7k
    }
3969
18.7k
  }
3970
  template <typename X>
3971
  const X& get_subtable () const
3972
  {
3973
    switch (u.format) {
3974
    case 1: return u.format1.template get_subtable<typename T::SubTable> ();
3975
    default:return Null (typename T::SubTable);
3976
    }
3977
  }
3978
3979
  // Specialization of dispatch for subset. dispatch() normally just
3980
  // dispatches to the sub table this points too, but for subset
3981
  // we need to run subset on this subtable too.
3982
  template <typename ...Ts>
3983
  typename hb_subset_context_t::return_t dispatch (hb_subset_context_t *c, Ts&&... ds) const
3984
0
  {
3985
0
    switch (u.format) {
3986
0
    case 1: return u.format1.subset (c);
3987
0
    default: return c->default_return_value ();
3988
0
    }
3989
0
  }
Unexecuted instantiation: bool OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<>(hb_subset_context_t*) const
Unexecuted instantiation: bool OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<>(hb_subset_context_t*) const
3990
3991
  template <typename context_t, typename ...Ts>
3992
  typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
3993
84.8k
  {
3994
84.8k
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
3995
83.5k
    TRACE_DISPATCH (this, u.format);
3996
83.5k
    switch (u.format) {
3997
43.6k
    case 1: return_trace (u.format1.dispatch (c, std::forward<Ts> (ds)...));
3998
39.9k
    default:return_trace (c->default_return_value ());
3999
83.5k
    }
4000
83.5k
  }
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
hb_sanitize_context_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<hb_sanitize_context_t>(hb_sanitize_context_t*) const
Line
Count
Source
3993
30.1k
  {
3994
30.1k
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
3995
29.3k
    TRACE_DISPATCH (this, u.format);
3996
29.3k
    switch (u.format) {
3997
10.5k
    case 1: return_trace (u.format1.dispatch (c, std::forward<Ts> (ds)...));
3998
18.8k
    default:return_trace (c->default_return_value ());
3999
29.3k
    }
4000
29.3k
  }
Unexecuted instantiation: OT::hb_collect_variation_indices_context_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_collect_variation_indices_context_t>(OT::hb_collect_variation_indices_context_t*) const
OT::hb_accelerate_subtables_context_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Line
Count
Source
3993
4.82k
  {
3994
4.82k
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
3995
4.82k
    TRACE_DISPATCH (this, u.format);
3996
4.82k
    switch (u.format) {
3997
3.91k
    case 1: return_trace (u.format1.dispatch (c, std::forward<Ts> (ds)...));
3998
908
    default:return_trace (c->default_return_value ());
3999
4.82k
    }
4000
4.82k
  }
Unexecuted instantiation: OT::hb_intersects_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_intersects_context_t>(OT::hb_intersects_context_t*) const
hb_sanitize_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<hb_sanitize_context_t>(hb_sanitize_context_t*) const
Line
Count
Source
3993
35.9k
  {
3994
35.9k
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
3995
35.5k
    TRACE_DISPATCH (this, u.format);
3996
35.5k
    switch (u.format) {
3997
18.3k
    case 1: return_trace (u.format1.dispatch (c, std::forward<Ts> (ds)...));
3998
17.1k
    default:return_trace (c->default_return_value ());
3999
35.5k
    }
4000
35.5k
  }
Unexecuted instantiation: OT::hb_have_non_1to1_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_have_non_1to1_context_t>(OT::hb_have_non_1to1_context_t*) const
Unexecuted instantiation: OT::hb_ot_apply_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_ot_apply_context_t>(OT::hb_ot_apply_context_t*) const
Unexecuted instantiation: OT::hb_closure_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_closure_context_t>(OT::hb_closure_context_t*) const
Unexecuted instantiation: OT::hb_closure_lookups_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_closure_lookups_context_t>(OT::hb_closure_lookups_context_t*) const
Unexecuted instantiation: OT::hb_collect_glyphs_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_collect_glyphs_context_t>(OT::hb_collect_glyphs_context_t*) const
Unexecuted instantiation: OT::hb_would_apply_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_would_apply_context_t>(OT::hb_would_apply_context_t*) const
OT::hb_accelerate_subtables_context_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<OT::hb_accelerate_subtables_context_t>(OT::hb_accelerate_subtables_context_t*) const
Line
Count
Source
3993
13.8k
  {
3994
13.8k
    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
3995
13.8k
    TRACE_DISPATCH (this, u.format);
3996
13.8k
    switch (u.format) {
3997
10.8k
    case 1: return_trace (u.format1.dispatch (c, std::forward<Ts> (ds)...));
3998
3.06k
    default:return_trace (c->default_return_value ());
3999
13.8k
    }
4000
13.8k
  }
Unexecuted instantiation: hb_get_glyph_alternates_dispatch_t::return_t OT::Extension<OT::Layout::GSUB_impl::ExtensionSubst>::dispatch<hb_get_glyph_alternates_dispatch_t, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&>(hb_get_glyph_alternates_dispatch_t*, unsigned int&, unsigned int&, unsigned int*&, unsigned int*&) const
Unexecuted instantiation: hb_position_single_dispatch_t::return_t OT::Extension<OT::Layout::GPOS_impl::ExtensionPos>::dispatch<hb_position_single_dispatch_t, hb_font_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&>(hb_position_single_dispatch_t*, hb_font_t*&, hb_direction_t&, unsigned int&, hb_glyph_position_t&) const
4001
4002
  protected:
4003
  union {
4004
  HBUINT16    format;   /* Format identifier */
4005
  ExtensionFormat1<T> format1;
4006
  } u;
4007
};
4008
4009
4010
/*
4011
 * GSUB/GPOS Common
4012
 */
4013
4014
struct hb_ot_layout_lookup_accelerator_t
4015
{
4016
  template <typename TLookup>
4017
  void init (const TLookup &lookup)
4018
166k
  {
4019
166k
    subtables.init ();
4020
166k
    subtables.alloc (lookup.get_subtable_count (), true);
4021
166k
    hb_accelerate_subtables_context_t c_accelerate_subtables (subtables);
4022
166k
    lookup.dispatch (&c_accelerate_subtables);
4023
4024
166k
    digest.init ();
4025
166k
    for (auto& subtable : subtables)
4026
161k
      digest.add (subtable.digest);
4027
4028
166k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4029
166k
    cache_user_idx = c_accelerate_subtables.cache_user_idx;
4030
327k
    for (unsigned i = 0; i < subtables.length; i++)
4031
161k
      if (i != cache_user_idx)
4032
157k
  subtables[i].apply_cached_func = subtables[i].apply_func;
4033
166k
#endif
4034
166k
  }
void OT::hb_ot_layout_lookup_accelerator_t::init<OT::Layout::GPOS_impl::PosLookup>(OT::Layout::GPOS_impl::PosLookup const&)
Line
Count
Source
4018
53.1k
  {
4019
53.1k
    subtables.init ();
4020
53.1k
    subtables.alloc (lookup.get_subtable_count (), true);
4021
53.1k
    hb_accelerate_subtables_context_t c_accelerate_subtables (subtables);
4022
53.1k
    lookup.dispatch (&c_accelerate_subtables);
4023
4024
53.1k
    digest.init ();
4025
53.1k
    for (auto& subtable : subtables)
4026
55.2k
      digest.add (subtable.digest);
4027
4028
53.1k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4029
53.1k
    cache_user_idx = c_accelerate_subtables.cache_user_idx;
4030
108k
    for (unsigned i = 0; i < subtables.length; i++)
4031
55.2k
      if (i != cache_user_idx)
4032
54.2k
  subtables[i].apply_cached_func = subtables[i].apply_func;
4033
53.1k
#endif
4034
53.1k
  }
void OT::hb_ot_layout_lookup_accelerator_t::init<OT::Layout::GSUB_impl::SubstLookup>(OT::Layout::GSUB_impl::SubstLookup const&)
Line
Count
Source
4018
113k
  {
4019
113k
    subtables.init ();
4020
113k
    subtables.alloc (lookup.get_subtable_count (), true);
4021
113k
    hb_accelerate_subtables_context_t c_accelerate_subtables (subtables);
4022
113k
    lookup.dispatch (&c_accelerate_subtables);
4023
4024
113k
    digest.init ();
4025
113k
    for (auto& subtable : subtables)
4026
105k
      digest.add (subtable.digest);
4027
4028
113k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4029
113k
    cache_user_idx = c_accelerate_subtables.cache_user_idx;
4030
219k
    for (unsigned i = 0; i < subtables.length; i++)
4031
105k
      if (i != cache_user_idx)
4032
102k
  subtables[i].apply_cached_func = subtables[i].apply_func;
4033
113k
#endif
4034
113k
  }
4035
166k
  void fini () { subtables.fini (); }
4036
4037
  bool may_have (hb_codepoint_t g) const
4038
8.99k
  { return digest.may_have (g); }
4039
4040
  bool apply (hb_ot_apply_context_t *c, bool use_cache) const
4041
5.23M
  {
4042
5.23M
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4043
5.23M
    if (use_cache)
4044
206
    {
4045
206
      return
4046
206
      + hb_iter (subtables)
4047
206
      | hb_map ([&c] (const hb_accelerate_subtables_context_t::hb_applicable_t &_) { return _.apply_cached (c); })
4048
206
      | hb_any
4049
206
      ;
4050
206
    }
4051
5.23M
    else
4052
5.23M
#endif
4053
5.23M
    {
4054
5.23M
      return
4055
5.23M
      + hb_iter (subtables)
4056
6.17M
      | hb_map ([&c] (const hb_accelerate_subtables_context_t::hb_applicable_t &_) { return _.apply (c); })
4057
5.23M
      | hb_any
4058
5.23M
      ;
4059
5.23M
    }
4060
0
    return false;
4061
5.23M
  }
4062
4063
  bool cache_enter (hb_ot_apply_context_t *c) const
4064
54.3k
  {
4065
54.3k
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4066
54.3k
    return cache_user_idx != (unsigned) -1 &&
4067
54.3k
     subtables[cache_user_idx].cache_enter (c);
4068
#else
4069
    return false;
4070
#endif
4071
54.3k
  }
4072
  void cache_leave (hb_ot_apply_context_t *c) const
4073
89
  {
4074
89
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4075
89
    subtables[cache_user_idx].cache_leave (c);
4076
89
#endif
4077
89
  }
4078
4079
4080
  hb_set_digest_t digest;
4081
  private:
4082
  hb_accelerate_subtables_context_t::array_t subtables;
4083
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4084
  unsigned cache_user_idx = (unsigned) -1;
4085
#endif
4086
};
4087
4088
template <typename Types>
4089
struct GSUBGPOSVersion1_2
4090
{
4091
  friend struct GSUBGPOS;
4092
4093
  protected:
4094
  FixedVersion<>version;  /* Version of the GSUB/GPOS table--initially set
4095
         * to 0x00010000u */
4096
  typename Types:: template OffsetTo<ScriptList>
4097
    scriptList; /* ScriptList table */
4098
  typename Types::template OffsetTo<FeatureList>
4099
    featureList;  /* FeatureList table */
4100
  typename Types::template OffsetTo<LookupList<Types>>
4101
    lookupList; /* LookupList table */
4102
  Offset32To<FeatureVariations>
4103
    featureVars;  /* Offset to Feature Variations
4104
           table--from beginning of table
4105
         * (may be NULL).  Introduced
4106
         * in version 0x00010001. */
4107
  public:
4108
  DEFINE_SIZE_MIN (4 + 3 * Types::size);
4109
4110
  unsigned int get_size () const
4111
0
  {
4112
0
    return min_size +
4113
0
     (version.to_int () >= 0x00010001u ? featureVars.static_size : 0);
4114
0
  }
Unexecuted instantiation: OT::GSUBGPOSVersion1_2<OT::Layout::SmallTypes>::get_size() const
Unexecuted instantiation: OT::GSUBGPOSVersion1_2<OT::Layout::MediumTypes>::get_size() const
4115
4116
  const typename Types::template OffsetTo<LookupList<Types>>* get_lookup_list_offset () const
4117
  {
4118
    return &lookupList;
4119
  }
4120
4121
  template <typename TLookup>
4122
  bool sanitize (hb_sanitize_context_t *c) const
4123
41.2k
  {
4124
41.2k
    TRACE_SANITIZE (this);
4125
41.2k
    typedef List16OfOffsetTo<TLookup, typename Types::HBUINT> TLookupList;
4126
41.2k
    if (unlikely (!(scriptList.sanitize (c, this) &&
4127
41.2k
        featureList.sanitize (c, this) &&
4128
41.2k
        reinterpret_cast<const typename Types::template OffsetTo<TLookupList> &> (lookupList).sanitize (c, this))))
4129
12.2k
      return_trace (false);
4130
4131
29.0k
#ifndef HB_NO_VAR
4132
29.0k
    if (unlikely (!(version.to_int () < 0x00010001u || featureVars.sanitize (c, this))))
4133
273
      return_trace (false);
4134
28.8k
#endif
4135
4136
29.0k
    return_trace (true);
4137
29.0k
  }
bool OT::GSUBGPOSVersion1_2<OT::Layout::SmallTypes>::sanitize<OT::Layout::GPOS_impl::PosLookup>(hb_sanitize_context_t*) const
Line
Count
Source
4123
16.9k
  {
4124
16.9k
    TRACE_SANITIZE (this);
4125
16.9k
    typedef List16OfOffsetTo<TLookup, typename Types::HBUINT> TLookupList;
4126
16.9k
    if (unlikely (!(scriptList.sanitize (c, this) &&
4127
16.9k
        featureList.sanitize (c, this) &&
4128
16.9k
        reinterpret_cast<const typename Types::template OffsetTo<TLookupList> &> (lookupList).sanitize (c, this))))
4129
4.59k
      return_trace (false);
4130
4131
12.4k
#ifndef HB_NO_VAR
4132
12.4k
    if (unlikely (!(version.to_int () < 0x00010001u || featureVars.sanitize (c, this))))
4133
50
      return_trace (false);
4134
12.3k
#endif
4135
4136
12.3k
    return_trace (true);
4137
12.4k
  }
bool OT::GSUBGPOSVersion1_2<OT::Layout::MediumTypes>::sanitize<OT::Layout::GPOS_impl::PosLookup>(hb_sanitize_context_t*) const
Line
Count
Source
4123
537
  {
4124
537
    TRACE_SANITIZE (this);
4125
537
    typedef List16OfOffsetTo<TLookup, typename Types::HBUINT> TLookupList;
4126
537
    if (unlikely (!(scriptList.sanitize (c, this) &&
4127
537
        featureList.sanitize (c, this) &&
4128
537
        reinterpret_cast<const typename Types::template OffsetTo<TLookupList> &> (lookupList).sanitize (c, this))))
4129
237
      return_trace (false);
4130
4131
300
#ifndef HB_NO_VAR
4132
300
    if (unlikely (!(version.to_int () < 0x00010001u || featureVars.sanitize (c, this))))
4133
10
      return_trace (false);
4134
290
#endif
4135
4136
290
    return_trace (true);
4137
300
  }
bool OT::GSUBGPOSVersion1_2<OT::Layout::SmallTypes>::sanitize<OT::Layout::GSUB_impl::SubstLookup>(hb_sanitize_context_t*) const
Line
Count
Source
4123
23.2k
  {
4124
23.2k
    TRACE_SANITIZE (this);
4125
23.2k
    typedef List16OfOffsetTo<TLookup, typename Types::HBUINT> TLookupList;
4126
23.2k
    if (unlikely (!(scriptList.sanitize (c, this) &&
4127
23.2k
        featureList.sanitize (c, this) &&
4128
23.2k
        reinterpret_cast<const typename Types::template OffsetTo<TLookupList> &> (lookupList).sanitize (c, this))))
4129
7.16k
      return_trace (false);
4130
4131
16.1k
#ifndef HB_NO_VAR
4132
16.1k
    if (unlikely (!(version.to_int () < 0x00010001u || featureVars.sanitize (c, this))))
4133
206
      return_trace (false);
4134
15.9k
#endif
4135
4136
15.9k
    return_trace (true);
4137
16.1k
  }
bool OT::GSUBGPOSVersion1_2<OT::Layout::MediumTypes>::sanitize<OT::Layout::GSUB_impl::SubstLookup>(hb_sanitize_context_t*) const
Line
Count
Source
4123
491
  {
4124
491
    TRACE_SANITIZE (this);
4125
491
    typedef List16OfOffsetTo<TLookup, typename Types::HBUINT> TLookupList;
4126
491
    if (unlikely (!(scriptList.sanitize (c, this) &&
4127
491
        featureList.sanitize (c, this) &&
4128
491
        reinterpret_cast<const typename Types::template OffsetTo<TLookupList> &> (lookupList).sanitize (c, this))))
4129
222
      return_trace (false);
4130
4131
269
#ifndef HB_NO_VAR
4132
269
    if (unlikely (!(version.to_int () < 0x00010001u || featureVars.sanitize (c, this))))
4133
7
      return_trace (false);
4134
262
#endif
4135
4136
262
    return_trace (true);
4137
269
  }
4138
4139
  template <typename TLookup>
4140
  bool subset (hb_subset_layout_context_t *c) const
4141
0
  {
4142
0
    TRACE_SUBSET (this);
4143
0
4144
0
    auto *out = c->subset_context->serializer->start_embed (this);
4145
0
    if (unlikely (!c->subset_context->serializer->extend_min (out))) return_trace (false);
4146
0
4147
0
    out->version = version;
4148
0
4149
0
    typedef LookupOffsetList<TLookup, typename Types::HBUINT> TLookupList;
4150
0
    reinterpret_cast<typename Types::template OffsetTo<TLookupList> &> (out->lookupList)
4151
0
  .serialize_subset (c->subset_context,
4152
0
         reinterpret_cast<const typename Types::template OffsetTo<TLookupList> &> (lookupList),
4153
0
         this,
4154
0
         c);
4155
0
4156
0
    reinterpret_cast<typename Types::template OffsetTo<RecordListOfFeature> &> (out->featureList)
4157
0
  .serialize_subset (c->subset_context,
4158
0
         reinterpret_cast<const typename Types::template OffsetTo<RecordListOfFeature> &> (featureList),
4159
0
         this,
4160
0
         c);
4161
0
4162
0
    out->scriptList.serialize_subset (c->subset_context,
4163
0
              scriptList,
4164
0
              this,
4165
0
              c);
4166
0
4167
0
#ifndef HB_NO_VAR
4168
0
    if (version.to_int () >= 0x00010001u)
4169
0
    {
4170
0
      auto snapshot = c->subset_context->serializer->snapshot ();
4171
0
      if (!c->subset_context->serializer->extend_min (&out->featureVars))
4172
0
        return_trace (false);
4173
0
4174
0
      // TODO(qxliu76): the current implementation doesn't correctly handle feature variations
4175
0
      //                that are dropped by instancing when the associated conditions don't trigger.
4176
0
      //                Since partial instancing isn't yet supported this isn't an issue yet but will
4177
0
      //                need to be fixed for partial instancing.
4178
0
4179
0
4180
0
4181
0
      // if all axes are pinned all feature vars are dropped.
4182
0
      bool ret = !c->subset_context->plan->all_axes_pinned
4183
0
                 && out->featureVars.serialize_subset (c->subset_context, featureVars, this, c);
4184
0
      if (!ret && version.major == 1)
4185
0
      {
4186
0
        c->subset_context->serializer->revert (snapshot);
4187
0
  out->version.major = 1;
4188
0
  out->version.minor = 0;
4189
0
      }
4190
0
    }
4191
0
#endif
4192
0
4193
0
    return_trace (true);
4194
0
  }
Unexecuted instantiation: bool OT::GSUBGPOSVersion1_2<OT::Layout::SmallTypes>::subset<OT::Layout::GPOS_impl::PosLookup>(OT::hb_subset_layout_context_t*) const
Unexecuted instantiation: bool OT::GSUBGPOSVersion1_2<OT::Layout::MediumTypes>::subset<OT::Layout::GPOS_impl::PosLookup>(OT::hb_subset_layout_context_t*) const
Unexecuted instantiation: bool OT::GSUBGPOSVersion1_2<OT::Layout::SmallTypes>::subset<OT::Layout::GSUB_impl::SubstLookup>(OT::hb_subset_layout_context_t*) const
Unexecuted instantiation: bool OT::GSUBGPOSVersion1_2<OT::Layout::MediumTypes>::subset<OT::Layout::GSUB_impl::SubstLookup>(OT::hb_subset_layout_context_t*) const
4195
};
4196
4197
struct GSUBGPOS
4198
{
4199
  unsigned int get_size () const
4200
0
  {
4201
0
    switch (u.version.major) {
4202
0
    case 1: return u.version1.get_size ();
4203
0
#ifndef HB_NO_BEYOND_64K
4204
0
    case 2: return u.version2.get_size ();
4205
0
#endif
4206
0
    default: return u.version.static_size;
4207
0
    }
4208
0
  }
4209
4210
  template <typename TLookup>
4211
  bool sanitize (hb_sanitize_context_t *c) const
4212
45.0k
  {
4213
45.0k
    TRACE_SANITIZE (this);
4214
45.0k
    if (unlikely (!u.version.sanitize (c))) return_trace (false);
4215
44.7k
    switch (u.version.major) {
4216
40.2k
    case 1: return_trace (u.version1.sanitize<TLookup> (c));
4217
0
#ifndef HB_NO_BEYOND_64K
4218
1.02k
    case 2: return_trace (u.version2.sanitize<TLookup> (c));
4219
0
#endif
4220
3.45k
    default: return_trace (true);
4221
44.7k
    }
4222
44.7k
  }
bool OT::GSUBGPOS::sanitize<OT::Layout::GPOS_impl::PosLookup>(hb_sanitize_context_t*) const
Line
Count
Source
4212
19.7k
  {
4213
19.7k
    TRACE_SANITIZE (this);
4214
19.7k
    if (unlikely (!u.version.sanitize (c))) return_trace (false);
4215
19.6k
    switch (u.version.major) {
4216
16.9k
    case 1: return_trace (u.version1.sanitize<TLookup> (c));
4217
0
#ifndef HB_NO_BEYOND_64K
4218
537
    case 2: return_trace (u.version2.sanitize<TLookup> (c));
4219
0
#endif
4220
2.11k
    default: return_trace (true);
4221
19.6k
    }
4222
19.6k
  }
bool OT::GSUBGPOS::sanitize<OT::Layout::GSUB_impl::SubstLookup>(hb_sanitize_context_t*) const
Line
Count
Source
4212
25.3k
  {
4213
25.3k
    TRACE_SANITIZE (this);
4214
25.3k
    if (unlikely (!u.version.sanitize (c))) return_trace (false);
4215
25.1k
    switch (u.version.major) {
4216
23.2k
    case 1: return_trace (u.version1.sanitize<TLookup> (c));
4217
0
#ifndef HB_NO_BEYOND_64K
4218
491
    case 2: return_trace (u.version2.sanitize<TLookup> (c));
4219
0
#endif
4220
1.34k
    default: return_trace (true);
4221
25.1k
    }
4222
25.1k
  }
4223
4224
  template <typename TLookup>
4225
  bool subset (hb_subset_layout_context_t *c) const
4226
0
  {
4227
0
    switch (u.version.major) {
4228
0
    case 1: return u.version1.subset<TLookup> (c);
4229
0
#ifndef HB_NO_BEYOND_64K
4230
0
    case 2: return u.version2.subset<TLookup> (c);
4231
0
#endif
4232
0
    default: return false;
4233
0
    }
4234
0
  }
Unexecuted instantiation: bool OT::GSUBGPOS::subset<OT::Layout::GPOS_impl::PosLookup>(OT::hb_subset_layout_context_t*) const
Unexecuted instantiation: bool OT::GSUBGPOS::subset<OT::Layout::GSUB_impl::SubstLookup>(OT::hb_subset_layout_context_t*) const
4235
4236
  const ScriptList &get_script_list () const
4237
3.80M
  {
4238
3.80M
    switch (u.version.major) {
4239
895k
    case 1: return this+u.version1.scriptList;
4240
0
#ifndef HB_NO_BEYOND_64K
4241
13.8k
    case 2: return this+u.version2.scriptList;
4242
0
#endif
4243
2.89M
    default: return Null (ScriptList);
4244
3.80M
    }
4245
3.80M
  }
4246
  const FeatureList &get_feature_list () const
4247
9.83M
  {
4248
9.83M
    switch (u.version.major) {
4249
9.54M
    case 1: return this+u.version1.featureList;
4250
0
#ifndef HB_NO_BEYOND_64K
4251
2.15k
    case 2: return this+u.version2.featureList;
4252
0
#endif
4253
287k
    default: return Null (FeatureList);
4254
9.83M
    }
4255
9.83M
  }
4256
  unsigned int get_lookup_count () const
4257
354k
  {
4258
354k
    switch (u.version.major) {
4259
101k
    case 1: return (this+u.version1.lookupList).len;
4260
0
#ifndef HB_NO_BEYOND_64K
4261
1.17k
    case 2: return (this+u.version2.lookupList).len;
4262
0
#endif
4263
252k
    default: return 0;
4264
354k
    }
4265
354k
  }
4266
  const Lookup& get_lookup (unsigned int i) const
4267
6.95M
  {
4268
6.95M
    switch (u.version.major) {
4269
6.95M
    case 1: return (this+u.version1.lookupList)[i];
4270
0
#ifndef HB_NO_BEYOND_64K
4271
1.16k
    case 2: return (this+u.version2.lookupList)[i];
4272
0
#endif
4273
0
    default: return Null (Lookup);
4274
6.95M
    }
4275
6.95M
  }
4276
  const FeatureVariations &get_feature_variations () const
4277
1.95M
  {
4278
1.95M
    switch (u.version.major) {
4279
444k
    case 1: return (u.version.to_int () >= 0x00010001u ? this+u.version1.featureVars : Null (FeatureVariations));
4280
0
#ifndef HB_NO_BEYOND_64K
4281
6.00k
    case 2: return this+u.version2.featureVars;
4282
0
#endif
4283
1.50M
    default: return Null (FeatureVariations);
4284
1.95M
    }
4285
1.95M
  }
4286
4287
204k
  bool has_data () const { return u.version.to_int (); }
4288
  unsigned int get_script_count () const
4289
0
  { return get_script_list ().len; }
4290
  const Tag& get_script_tag (unsigned int i) const
4291
0
  { return get_script_list ().get_tag (i); }
4292
  unsigned int get_script_tags (unsigned int start_offset,
4293
        unsigned int *script_count /* IN/OUT */,
4294
        hb_tag_t     *script_tags /* OUT */) const
4295
0
  { return get_script_list ().get_tags (start_offset, script_count, script_tags); }
4296
  const Script& get_script (unsigned int i) const
4297
3.38M
  { return get_script_list ()[i]; }
4298
  bool find_script_index (hb_tag_t tag, unsigned int *index) const
4299
414k
  { return get_script_list ().find_index (tag, index); }
4300
4301
  unsigned int get_feature_count () const
4302
45.7k
  { return get_feature_list ().len; }
4303
  hb_tag_t get_feature_tag (unsigned int i) const
4304
9.70M
  { return i == Index::NOT_FOUND_INDEX ? HB_TAG_NONE : get_feature_list ().get_tag (i); }
4305
  unsigned int get_feature_tags (unsigned int start_offset,
4306
         unsigned int *feature_count /* IN/OUT */,
4307
         hb_tag_t     *feature_tags /* OUT */) const
4308
0
  { return get_feature_list ().get_tags (start_offset, feature_count, feature_tags); }
4309
  const Feature& get_feature (unsigned int i) const
4310
375k
  { return get_feature_list ()[i]; }
4311
  bool find_feature_index (hb_tag_t tag, unsigned int *index) const
4312
0
  { return get_feature_list ().find_index (tag, index); }
4313
4314
  bool find_variations_index (const int *coords, unsigned int num_coords,
4315
            unsigned int *index) const
4316
1.94M
  {
4317
#ifdef HB_NO_VAR
4318
    *index = FeatureVariations::NOT_FOUND_INDEX;
4319
    return false;
4320
#endif
4321
1.94M
    return get_feature_variations ().find_index (coords, num_coords, index);
4322
1.94M
  }
4323
  const Feature& get_feature_variation (unsigned int feature_index,
4324
          unsigned int variations_index) const
4325
283k
  {
4326
283k
#ifndef HB_NO_VAR
4327
283k
    if (FeatureVariations::NOT_FOUND_INDEX != variations_index &&
4328
283k
  u.version.to_int () >= 0x00010001u)
4329
2.23k
    {
4330
2.23k
      const Feature *feature = get_feature_variations ().find_substitute (variations_index,
4331
2.23k
                    feature_index);
4332
2.23k
      if (feature)
4333
878
  return *feature;
4334
2.23k
    }
4335
282k
#endif
4336
282k
    return get_feature (feature_index);
4337
283k
  }
4338
4339
  void feature_variation_collect_lookups (const hb_set_t *feature_indexes,
4340
            const hb_hashmap_t<unsigned, const Feature*> *feature_substitutes_map,
4341
            hb_set_t       *lookup_indexes /* OUT */) const
4342
0
  {
4343
0
#ifndef HB_NO_VAR
4344
0
    get_feature_variations ().collect_lookups (feature_indexes, feature_substitutes_map, lookup_indexes);
4345
0
#endif
4346
0
  }
4347
4348
#ifndef HB_NO_VAR
4349
  void collect_feature_substitutes_with_variations (hb_collect_feature_substitutes_with_var_context_t *c) const
4350
0
  { get_feature_variations ().collect_feature_substitutes_with_variations (c); }
4351
#endif
4352
4353
  template <typename TLookup>
4354
  void closure_lookups (hb_face_t      *face,
4355
      const hb_set_t *glyphs,
4356
      hb_set_t       *lookup_indexes /* IN/OUT */) const
4357
0
  {
4358
0
    hb_set_t visited_lookups, inactive_lookups;
4359
0
    hb_closure_lookups_context_t c (face, glyphs, &visited_lookups, &inactive_lookups);
4360
0
4361
0
    c.set_recurse_func (TLookup::template dispatch_recurse_func<hb_closure_lookups_context_t>);
4362
0
4363
0
    for (unsigned lookup_index : *lookup_indexes)
4364
0
      reinterpret_cast<const TLookup &> (get_lookup (lookup_index)).closure_lookups (&c, lookup_index);
4365
0
4366
0
    hb_set_union (lookup_indexes, &visited_lookups);
4367
0
    hb_set_subtract (lookup_indexes, &inactive_lookups);
4368
0
  }
Unexecuted instantiation: void OT::GSUBGPOS::closure_lookups<OT::Layout::GPOS_impl::PosLookup>(hb_face_t*, hb_set_t const*, hb_set_t*) const
Unexecuted instantiation: void OT::GSUBGPOS::closure_lookups<OT::Layout::GSUB_impl::SubstLookup>(hb_face_t*, hb_set_t const*, hb_set_t*) const
4369
4370
  void prune_langsys (const hb_map_t *duplicate_feature_map,
4371
                      const hb_set_t *layout_scripts,
4372
                      hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *script_langsys_map,
4373
                      hb_set_t       *new_feature_indexes /* OUT */) const
4374
0
  {
4375
0
    hb_prune_langsys_context_t c (this, script_langsys_map, duplicate_feature_map, new_feature_indexes);
4376
0
4377
0
    unsigned count = get_script_count ();
4378
0
    for (unsigned script_index = 0; script_index < count; script_index++)
4379
0
    {
4380
0
      const Tag& tag = get_script_tag (script_index);
4381
0
      if (!layout_scripts->has (tag)) continue;
4382
0
      const Script& s = get_script (script_index);
4383
0
      s.prune_langsys (&c, script_index);
4384
0
    }
4385
0
  }
4386
4387
  void prune_features (const hb_map_t *lookup_indices, /* IN */
4388
           const hb_hashmap_t<unsigned, hb::shared_ptr<hb_set_t>> *feature_record_cond_idx_map, /* IN */
4389
           const hb_hashmap_t<unsigned, const Feature*> *feature_substitutes_map, /* IN */
4390
           hb_set_t       *feature_indices /* IN/OUT */) const
4391
0
  {
4392
0
#ifndef HB_NO_VAR
4393
0
    // This is the set of feature indices which have alternate versions defined
4394
0
    // if the FeatureVariation's table and the alternate version(s) intersect the
4395
0
    // set of lookup indices.
4396
0
    hb_set_t alternate_feature_indices;
4397
0
    get_feature_variations ().closure_features (lookup_indices, feature_record_cond_idx_map, &alternate_feature_indices);
4398
0
    if (unlikely (alternate_feature_indices.in_error()))
4399
0
    {
4400
0
      feature_indices->err ();
4401
0
      return;
4402
0
    }
4403
0
#endif
4404
0
4405
0
    for (unsigned i : hb_iter (feature_indices))
4406
0
    {
4407
0
      hb_tag_t tag =  get_feature_tag (i);
4408
0
      if (tag == HB_TAG ('p', 'r', 'e', 'f'))
4409
0
        // Note: Never ever drop feature 'pref', even if it's empty.
4410
0
        // HarfBuzz chooses shaper for Khmer based on presence of this
4411
0
        // feature. See thread at:
4412
0
  // http://lists.freedesktop.org/archives/harfbuzz/2012-November/002660.html
4413
0
        continue;
4414
0
4415
0
4416
0
      const Feature *f = &(get_feature (i));
4417
0
      const Feature** p = nullptr;
4418
0
      if (feature_substitutes_map->has (i, &p))
4419
0
        f = *p;
4420
0
4421
0
      if (!f->featureParams.is_null () &&
4422
0
          tag == HB_TAG ('s', 'i', 'z', 'e'))
4423
0
        continue;
4424
0
4425
0
      if (!f->intersects_lookup_indexes (lookup_indices)
4426
0
#ifndef HB_NO_VAR
4427
0
          && !alternate_feature_indices.has (i)
4428
0
#endif
4429
0
    )
4430
0
  feature_indices->del (i);
4431
0
    }
4432
0
  }
4433
4434
  template <typename T>
4435
  struct accelerator_t
4436
  {
4437
    accelerator_t (hb_face_t *face)
4438
90.9k
    {
4439
90.9k
      this->table = hb_sanitize_context_t ().reference_table<T> (face);
4440
90.9k
      if (unlikely (this->table->is_blocklisted (this->table.get_blob (), face)))
4441
0
      {
4442
0
  hb_blob_destroy (this->table.get_blob ());
4443
0
  this->table = hb_blob_get_empty ();
4444
0
      }
4445
4446
90.9k
      this->lookup_count = table->get_lookup_count ();
4447
4448
90.9k
      this->accels = (hb_ot_layout_lookup_accelerator_t *) hb_calloc (this->lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t));
4449
90.9k
      if (unlikely (!this->accels))
4450
273
      {
4451
273
  this->lookup_count = 0;
4452
273
  this->table.destroy ();
4453
273
  this->table = hb_blob_get_empty ();
4454
273
      }
4455
4456
256k
      for (unsigned int i = 0; i < this->lookup_count; i++)
4457
165k
  this->accels[i].init (table->get_lookup (i));
4458
90.9k
    }
OT::GSUBGPOS::accelerator_t<OT::Layout::GSUB>::accelerator_t(hb_face_t*)
Line
Count
Source
4438
45.4k
    {
4439
45.4k
      this->table = hb_sanitize_context_t ().reference_table<T> (face);
4440
45.4k
      if (unlikely (this->table->is_blocklisted (this->table.get_blob (), face)))
4441
0
      {
4442
0
  hb_blob_destroy (this->table.get_blob ());
4443
0
  this->table = hb_blob_get_empty ();
4444
0
      }
4445
4446
45.4k
      this->lookup_count = table->get_lookup_count ();
4447
4448
45.4k
      this->accels = (hb_ot_layout_lookup_accelerator_t *) hb_calloc (this->lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t));
4449
45.4k
      if (unlikely (!this->accels))
4450
141
      {
4451
141
  this->lookup_count = 0;
4452
141
  this->table.destroy ();
4453
141
  this->table = hb_blob_get_empty ();
4454
141
      }
4455
4456
157k
      for (unsigned int i = 0; i < this->lookup_count; i++)
4457
112k
  this->accels[i].init (table->get_lookup (i));
4458
45.4k
    }
OT::GSUBGPOS::accelerator_t<OT::Layout::GPOS>::accelerator_t(hb_face_t*)
Line
Count
Source
4438
45.4k
    {
4439
45.4k
      this->table = hb_sanitize_context_t ().reference_table<T> (face);
4440
45.4k
      if (unlikely (this->table->is_blocklisted (this->table.get_blob (), face)))
4441
0
      {
4442
0
  hb_blob_destroy (this->table.get_blob ());
4443
0
  this->table = hb_blob_get_empty ();
4444
0
      }
4445
4446
45.4k
      this->lookup_count = table->get_lookup_count ();
4447
4448
45.4k
      this->accels = (hb_ot_layout_lookup_accelerator_t *) hb_calloc (this->lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t));
4449
45.4k
      if (unlikely (!this->accels))
4450
132
      {
4451
132
  this->lookup_count = 0;
4452
132
  this->table.destroy ();
4453
132
  this->table = hb_blob_get_empty ();
4454
132
      }
4455
4456
98.5k
      for (unsigned int i = 0; i < this->lookup_count; i++)
4457
53.1k
  this->accels[i].init (table->get_lookup (i));
4458
45.4k
    }
4459
    ~accelerator_t ()
4460
90.9k
    {
4461
256k
      for (unsigned int i = 0; i < this->lookup_count; i++)
4462
165k
  this->accels[i].fini ();
4463
90.9k
      hb_free (this->accels);
4464
90.9k
      this->table.destroy ();
4465
90.9k
    }
OT::GSUBGPOS::accelerator_t<OT::Layout::GSUB>::~accelerator_t()
Line
Count
Source
4460
45.4k
    {
4461
157k
      for (unsigned int i = 0; i < this->lookup_count; i++)
4462
112k
  this->accels[i].fini ();
4463
45.4k
      hb_free (this->accels);
4464
45.4k
      this->table.destroy ();
4465
45.4k
    }
OT::GSUBGPOS::accelerator_t<OT::Layout::GPOS>::~accelerator_t()
Line
Count
Source
4460
45.4k
    {
4461
98.5k
      for (unsigned int i = 0; i < this->lookup_count; i++)
4462
53.1k
  this->accels[i].fini ();
4463
45.4k
      hb_free (this->accels);
4464
45.4k
      this->table.destroy ();
4465
45.4k
    }
4466
4467
    hb_blob_ptr_t<T> table;
4468
    unsigned int lookup_count;
4469
    hb_ot_layout_lookup_accelerator_t *accels;
4470
  };
4471
4472
  protected:
4473
  union {
4474
  FixedVersion<>      version;  /* Version identifier */
4475
  GSUBGPOSVersion1_2<SmallTypes>  version1;
4476
#ifndef HB_NO_BEYOND_64K
4477
  GSUBGPOSVersion1_2<MediumTypes> version2;
4478
#endif
4479
  } u;
4480
  public:
4481
  DEFINE_SIZE_MIN (4);
4482
};
4483
4484
4485
} /* namespace OT */
4486
4487
4488
#endif /* HB_OT_LAYOUT_GSUBGPOS_HH */