Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/work/workdir/UnpackedTarball/harfbuzz/src/hb-subset-table.hh
Line
Count
Source
1
/*
2
 * Copyright © 2018  Google, Inc.
3
 *
4
 *  This is part of HarfBuzz, a text shaping library.
5
 *
6
 * Permission is hereby granted, without written agreement and without
7
 * license or royalty fees, to use, copy, modify, and distribute this
8
 * software and its documentation for any purpose, provided that the
9
 * above copyright notice and the following two paragraphs appear in
10
 * all copies of this software.
11
 *
12
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16
 * DAMAGE.
17
 *
18
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
21
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23
 *
24
 * Google Author(s): Garret Rieger, Roderick Sheeter
25
 */
26
27
#ifndef HB_SUBSET_TABLE_HH
28
#define HB_SUBSET_TABLE_HH
29
30
31
#include "hb.hh"
32
33
#include "hb-subset.hh"
34
#include "hb-repacker.hh"
35
36
37
template<typename TableType>
38
static bool
39
_hb_subset_table_try (const TableType *table,
40
          hb_vector_t<char>* buf,
41
          hb_subset_context_t* c /* OUT */)
42
39.4k
{
43
39.4k
  c->serializer->start_serialize ();
44
39.4k
  if (c->serializer->in_error ()) return false;
45
46
39.4k
  bool needed = table->subset (c);
47
39.4k
  if (!c->serializer->ran_out_of_room ())
48
39.4k
  {
49
39.4k
    c->serializer->end_serialize ();
50
39.4k
    return needed;
51
39.4k
  }
52
53
0
  unsigned buf_size = buf->allocated;
54
0
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
0
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
0
             HB_UNTAG (c->table_tag), buf_size);
61
62
0
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
0
    !buf->alloc_exact (buf_size)))
64
0
  {
65
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
0
               HB_UNTAG (c->table_tag), buf_size);
67
0
    return needed;
68
0
  }
69
70
0
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
0
  return _hb_subset_table_try (table, buf, c);
72
0
}
Unexecuted instantiation: hb-subset.cc:bool _hb_subset_table_try<OT::head>(OT::head const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _hb_subset_table_try<OT::STAT>(OT::STAT const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-layout.cc:bool _hb_subset_table_try<OT::GDEF>(OT::GDEF const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-layout.cc:bool _hb_subset_table_try<OT::Layout::GSUB>(OT::Layout::GSUB const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-layout.cc:bool _hb_subset_table_try<OT::Layout::GPOS>(OT::Layout::GPOS const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-layout.cc:bool _hb_subset_table_try<OT::BASE>(OT::BASE const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-layout.cc:bool _hb_subset_table_try<OT::MATH>(OT::MATH const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-var.cc:bool _hb_subset_table_try<OT::HVAR>(OT::HVAR const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-var.cc:bool _hb_subset_table_try<OT::VVAR>(OT::VVAR const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-var.cc:bool _hb_subset_table_try<OT::gvar_GVAR<OT::NumType<true, unsigned short, 2u>, 1735811442u> >(OT::gvar_GVAR<OT::NumType<true, unsigned short, 2u>, 1735811442u> const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-var.cc:bool _hb_subset_table_try<OT::fvar>(OT::fvar const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-var.cc:bool _hb_subset_table_try<OT::avar>(OT::avar const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-var.cc:bool _hb_subset_table_try<OT::cvar>(OT::cvar const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-var.cc:bool _hb_subset_table_try<OT::MVAR>(OT::MVAR const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-cff.cc:bool _hb_subset_table_try<OT::cff1_subset_accelerator_t>(OT::cff1_subset_accelerator_t const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-cff.cc:bool _hb_subset_table_try<OT::cff2_subset_accelerator_t>(OT::cff2_subset_accelerator_t const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-cff.cc:bool _hb_subset_table_try<OT::VORG>(OT::VORG const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-color.cc:bool _hb_subset_table_try<OT::sbix>(OT::sbix const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-color.cc:bool _hb_subset_table_try<OT::COLR>(OT::COLR const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-color.cc:bool _hb_subset_table_try<OT::CPAL>(OT::CPAL const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Unexecuted instantiation: hb-subset-table-color.cc:bool _hb_subset_table_try<OT::CBLC>(OT::CBLC const*, hb_vector_t<char, false>*, hb_subset_context_t*)
hb-subset-table-other.cc:bool _hb_subset_table_try<OT::glyf>(OT::glyf const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
6.57k
{
43
6.57k
  c->serializer->start_serialize ();
44
6.57k
  if (c->serializer->in_error ()) return false;
45
46
6.57k
  bool needed = table->subset (c);
47
6.57k
  if (!c->serializer->ran_out_of_room ())
48
6.57k
  {
49
6.57k
    c->serializer->end_serialize ();
50
6.57k
    return needed;
51
6.57k
  }
52
53
0
  unsigned buf_size = buf->allocated;
54
0
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
0
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
0
             HB_UNTAG (c->table_tag), buf_size);
61
62
0
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
0
    !buf->alloc_exact (buf_size)))
64
0
  {
65
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
0
               HB_UNTAG (c->table_tag), buf_size);
67
0
    return needed;
68
0
  }
69
70
0
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
0
  return _hb_subset_table_try (table, buf, c);
72
0
}
Unexecuted instantiation: hb-subset-table-other.cc:bool _hb_subset_table_try<OT::hdmx>(OT::hdmx const*, hb_vector_t<char, false>*, hb_subset_context_t*)
hb-subset-table-other.cc:bool _hb_subset_table_try<OT::name>(OT::name const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
6.57k
{
43
6.57k
  c->serializer->start_serialize ();
44
6.57k
  if (c->serializer->in_error ()) return false;
45
46
6.57k
  bool needed = table->subset (c);
47
6.57k
  if (!c->serializer->ran_out_of_room ())
48
6.57k
  {
49
6.57k
    c->serializer->end_serialize ();
50
6.57k
    return needed;
51
6.57k
  }
52
53
0
  unsigned buf_size = buf->allocated;
54
0
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
0
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
0
             HB_UNTAG (c->table_tag), buf_size);
61
62
0
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
0
    !buf->alloc_exact (buf_size)))
64
0
  {
65
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
0
               HB_UNTAG (c->table_tag), buf_size);
67
0
    return needed;
68
0
  }
69
70
0
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
0
  return _hb_subset_table_try (table, buf, c);
72
0
}
hb-subset-table-other.cc:bool _hb_subset_table_try<OT::hmtx>(OT::hmtx const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
6.57k
{
43
6.57k
  c->serializer->start_serialize ();
44
6.57k
  if (c->serializer->in_error ()) return false;
45
46
6.57k
  bool needed = table->subset (c);
47
6.57k
  if (!c->serializer->ran_out_of_room ())
48
6.57k
  {
49
6.57k
    c->serializer->end_serialize ();
50
6.57k
    return needed;
51
6.57k
  }
52
53
0
  unsigned buf_size = buf->allocated;
54
0
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
0
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
0
             HB_UNTAG (c->table_tag), buf_size);
61
62
0
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
0
    !buf->alloc_exact (buf_size)))
64
0
  {
65
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
0
               HB_UNTAG (c->table_tag), buf_size);
67
0
    return needed;
68
0
  }
69
70
0
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
0
  return _hb_subset_table_try (table, buf, c);
72
0
}
Unexecuted instantiation: hb-subset-table-other.cc:bool _hb_subset_table_try<OT::vmtx>(OT::vmtx const*, hb_vector_t<char, false>*, hb_subset_context_t*)
hb-subset-table-other.cc:bool _hb_subset_table_try<OT::maxp>(OT::maxp const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
6.57k
{
43
6.57k
  c->serializer->start_serialize ();
44
6.57k
  if (c->serializer->in_error ()) return false;
45
46
6.57k
  bool needed = table->subset (c);
47
6.57k
  if (!c->serializer->ran_out_of_room ())
48
6.57k
  {
49
6.57k
    c->serializer->end_serialize ();
50
6.57k
    return needed;
51
6.57k
  }
52
53
0
  unsigned buf_size = buf->allocated;
54
0
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
0
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
0
             HB_UNTAG (c->table_tag), buf_size);
61
62
0
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
0
    !buf->alloc_exact (buf_size)))
64
0
  {
65
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
0
               HB_UNTAG (c->table_tag), buf_size);
67
0
    return needed;
68
0
  }
69
70
0
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
0
  return _hb_subset_table_try (table, buf, c);
72
0
}
Unexecuted instantiation: hb-subset-table-other.cc:bool _hb_subset_table_try<OT::cmap>(OT::cmap const*, hb_vector_t<char, false>*, hb_subset_context_t*)
hb-subset-table-other.cc:bool _hb_subset_table_try<OT::OS2>(OT::OS2 const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
6.57k
{
43
6.57k
  c->serializer->start_serialize ();
44
6.57k
  if (c->serializer->in_error ()) return false;
45
46
6.57k
  bool needed = table->subset (c);
47
6.57k
  if (!c->serializer->ran_out_of_room ())
48
6.57k
  {
49
6.57k
    c->serializer->end_serialize ();
50
6.57k
    return needed;
51
6.57k
  }
52
53
0
  unsigned buf_size = buf->allocated;
54
0
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
0
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
0
             HB_UNTAG (c->table_tag), buf_size);
61
62
0
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
0
    !buf->alloc_exact (buf_size)))
64
0
  {
65
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
0
               HB_UNTAG (c->table_tag), buf_size);
67
0
    return needed;
68
0
  }
69
70
0
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
0
  return _hb_subset_table_try (table, buf, c);
72
0
}
hb-subset-table-other.cc:bool _hb_subset_table_try<OT::post>(OT::post const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
6.57k
{
43
6.57k
  c->serializer->start_serialize ();
44
6.57k
  if (c->serializer->in_error ()) return false;
45
46
6.57k
  bool needed = table->subset (c);
47
6.57k
  if (!c->serializer->ran_out_of_room ())
48
6.57k
  {
49
6.57k
    c->serializer->end_serialize ();
50
6.57k
    return needed;
51
6.57k
  }
52
53
0
  unsigned buf_size = buf->allocated;
54
0
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
0
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
0
             HB_UNTAG (c->table_tag), buf_size);
61
62
0
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
0
    !buf->alloc_exact (buf_size)))
64
0
  {
65
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
0
               HB_UNTAG (c->table_tag), buf_size);
67
0
    return needed;
68
0
  }
69
70
0
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
0
  return _hb_subset_table_try (table, buf, c);
72
0
}
73
74
static HB_UNUSED unsigned
75
_hb_subset_estimate_table_size (hb_subset_plan_t *plan,
76
        unsigned table_len,
77
        hb_tag_t table_tag)
78
39.4k
{
79
39.4k
  unsigned src_glyphs = plan->source->get_num_glyphs ();
80
39.4k
  unsigned dst_glyphs = plan->glyphset ()->get_population ();
81
82
39.4k
  unsigned bulk = 8192;
83
  /* Tables that we want to allocate same space as the source table. For GSUB/GPOS it's
84
   * because those are expensive to subset, so giving them more room is fine. */
85
39.4k
  bool same_size = table_tag == HB_TAG('G','S','U','B') ||
86
39.4k
       table_tag == HB_TAG('G','P','O','S') ||
87
39.4k
       table_tag == HB_TAG('G','D','E','F') ||
88
39.4k
       table_tag == HB_TAG('n','a','m','e');
89
90
39.4k
  if (plan->flags & HB_SUBSET_FLAGS_RETAIN_GIDS)
91
0
  {
92
0
    if (table_tag == HB_TAG('C','F','F',' '))
93
0
    {
94
      /* Add some extra room for the CFF charset. */
95
0
      bulk += src_glyphs * 16;
96
0
    }
97
0
    else if (table_tag == HB_TAG('C','F','F','2'))
98
0
    {
99
      /* Just extra CharString offsets. */
100
0
      bulk += src_glyphs * 4;
101
0
    }
102
0
  }
103
104
39.4k
  if (unlikely (!src_glyphs) || same_size)
105
6.57k
    return bulk + table_len;
106
107
32.8k
  return bulk + (unsigned) (table_len * sqrt ((double) dst_glyphs / src_glyphs));
108
39.4k
}
Unexecuted instantiation: hb-subset.cc:_hb_subset_estimate_table_size(hb_subset_plan_t*, unsigned int, unsigned int)
Unexecuted instantiation: hb-subset-table-layout.cc:_hb_subset_estimate_table_size(hb_subset_plan_t*, unsigned int, unsigned int)
Unexecuted instantiation: hb-subset-table-var.cc:_hb_subset_estimate_table_size(hb_subset_plan_t*, unsigned int, unsigned int)
Unexecuted instantiation: hb-subset-table-cff.cc:_hb_subset_estimate_table_size(hb_subset_plan_t*, unsigned int, unsigned int)
Unexecuted instantiation: hb-subset-table-color.cc:_hb_subset_estimate_table_size(hb_subset_plan_t*, unsigned int, unsigned int)
hb-subset-table-other.cc:_hb_subset_estimate_table_size(hb_subset_plan_t*, unsigned int, unsigned int)
Line
Count
Source
78
39.4k
{
79
39.4k
  unsigned src_glyphs = plan->source->get_num_glyphs ();
80
39.4k
  unsigned dst_glyphs = plan->glyphset ()->get_population ();
81
82
39.4k
  unsigned bulk = 8192;
83
  /* Tables that we want to allocate same space as the source table. For GSUB/GPOS it's
84
   * because those are expensive to subset, so giving them more room is fine. */
85
39.4k
  bool same_size = table_tag == HB_TAG('G','S','U','B') ||
86
39.4k
       table_tag == HB_TAG('G','P','O','S') ||
87
39.4k
       table_tag == HB_TAG('G','D','E','F') ||
88
39.4k
       table_tag == HB_TAG('n','a','m','e');
89
90
39.4k
  if (plan->flags & HB_SUBSET_FLAGS_RETAIN_GIDS)
91
0
  {
92
0
    if (table_tag == HB_TAG('C','F','F',' '))
93
0
    {
94
      /* Add some extra room for the CFF charset. */
95
0
      bulk += src_glyphs * 16;
96
0
    }
97
0
    else if (table_tag == HB_TAG('C','F','F','2'))
98
0
    {
99
      /* Just extra CharString offsets. */
100
0
      bulk += src_glyphs * 4;
101
0
    }
102
0
  }
103
104
39.4k
  if (unlikely (!src_glyphs) || same_size)
105
6.57k
    return bulk + table_len;
106
107
32.8k
  return bulk + (unsigned) (table_len * sqrt ((double) dst_glyphs / src_glyphs));
108
39.4k
}
109
110
/*
111
 * Repack the serialization buffer if any offset overflows exist.
112
 */
113
static HB_UNUSED hb_blob_t*
114
_hb_subset_repack (hb_tag_t tag, const hb_serialize_context_t& c)
115
39.4k
{
116
39.4k
  if (!c.offset_overflow ())
117
39.4k
    return c.copy_blob ();
118
119
0
  hb_blob_t* result = hb_resolve_overflows (c.object_graph (), tag);
120
121
0
  if (unlikely (!result))
122
0
  {
123
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c offset overflow resolution failed.",
124
0
               HB_UNTAG (tag));
125
0
    return nullptr;
126
0
  }
127
128
0
  return result;
129
0
}
Unexecuted instantiation: hb-subset.cc:_hb_subset_repack(unsigned int, hb_serialize_context_t const&)
Unexecuted instantiation: hb-subset-table-layout.cc:_hb_subset_repack(unsigned int, hb_serialize_context_t const&)
Unexecuted instantiation: hb-subset-table-var.cc:_hb_subset_repack(unsigned int, hb_serialize_context_t const&)
Unexecuted instantiation: hb-subset-table-cff.cc:_hb_subset_repack(unsigned int, hb_serialize_context_t const&)
Unexecuted instantiation: hb-subset-table-color.cc:_hb_subset_repack(unsigned int, hb_serialize_context_t const&)
hb-subset-table-other.cc:_hb_subset_repack(unsigned int, hb_serialize_context_t const&)
Line
Count
Source
115
39.4k
{
116
39.4k
  if (!c.offset_overflow ())
117
39.4k
    return c.copy_blob ();
118
119
0
  hb_blob_t* result = hb_resolve_overflows (c.object_graph (), tag);
120
121
0
  if (unlikely (!result))
122
0
  {
123
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c offset overflow resolution failed.",
124
0
               HB_UNTAG (tag));
125
0
    return nullptr;
126
0
  }
127
128
0
  return result;
129
0
}
130
131
template <typename T>
132
static HB_UNUSED auto _hb_do_destroy (T &t, hb_priority<1>) HB_RETURN (void, t.destroy ())
133
134
template <typename T>
135
0
static HB_UNUSED void _hb_do_destroy (T &t, hb_priority<0>) {}
Unexecuted instantiation: hb-subset-table-cff.cc:void _hb_do_destroy<hb_face_lazy_loader_t<OT::cff1_subset_accelerator_t, 1u> >(hb_face_lazy_loader_t<OT::cff1_subset_accelerator_t, 1u>&, hb_priority<0u>)
Unexecuted instantiation: hb-subset-table-cff.cc:void _hb_do_destroy<hb_face_lazy_loader_t<OT::cff2_subset_accelerator_t, 2u> >(hb_face_lazy_loader_t<OT::cff2_subset_accelerator_t, 2u>&, hb_priority<0u>)
136
137
template<typename TableType>
138
static bool
139
_hb_subset_table (hb_subset_plan_t *plan, hb_vector_t<char> &buf)
140
39.4k
{
141
39.4k
  auto &&source_blob = plan->source_table<TableType> ();
142
39.4k
  auto *table = source_blob.get ();
143
144
39.4k
  hb_tag_t tag = TableType::tableTag;
145
39.4k
  hb_blob_t *blob = source_blob.get_blob();
146
39.4k
  if (unlikely (!blob || !blob->data))
147
0
  {
148
0
    DEBUG_MSG (SUBSET, nullptr,
149
0
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
150
0
    _hb_do_destroy (source_blob, hb_prioritize);
151
0
    return false;
152
0
  }
153
154
39.4k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
155
39.4k
  DEBUG_MSG (SUBSET, nullptr,
156
39.4k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
157
39.4k
  if (unlikely (!buf.alloc (buf_size)))
158
0
  {
159
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
160
0
    _hb_do_destroy (source_blob, hb_prioritize);
161
0
    return false;
162
0
  }
163
164
39.4k
  bool needed = false;
165
39.4k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
166
39.4k
  {
167
39.4k
    hb_subset_context_t c (blob, plan, &serializer, tag);
168
39.4k
    needed = _hb_subset_table_try (table, &buf, &c);
169
39.4k
  }
170
39.4k
  _hb_do_destroy (source_blob, hb_prioritize);
171
172
39.4k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
173
0
  {
174
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
175
0
    return false;
176
0
  }
177
178
39.4k
  if (!needed)
179
0
  {
180
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
181
0
    return true;
182
0
  }
183
184
39.4k
  bool result = false;
185
39.4k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
186
39.4k
  if (dest_blob)
187
39.4k
  {
188
39.4k
    DEBUG_MSG (SUBSET, nullptr,
189
39.4k
               "OT::%c%c%c%c final subset table size: %u bytes.",
190
39.4k
               HB_UNTAG (tag), dest_blob->length);
191
39.4k
    result = plan->add_table (tag, dest_blob);
192
39.4k
    hb_blob_destroy (dest_blob);
193
39.4k
  }
194
195
39.4k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
196
39.4k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
197
39.4k
  return result;
198
39.4k
}
Unexecuted instantiation: hb-subset.cc:bool _hb_subset_table<OT::head const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset.cc:bool _hb_subset_table<OT::STAT const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-layout.cc:bool _hb_subset_table<OT::GDEF const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-layout.cc:bool _hb_subset_table<OT::Layout::GSUB const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-layout.cc:bool _hb_subset_table<OT::Layout::GPOS const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-layout.cc:bool _hb_subset_table<OT::BASE const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-layout.cc:bool _hb_subset_table<OT::MATH const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-var.cc:bool _hb_subset_table<OT::HVAR const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-var.cc:bool _hb_subset_table<OT::VVAR const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-var.cc:bool _hb_subset_table<OT::gvar_GVAR<OT::NumType<true, unsigned short, 2u>, 1735811442u> const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-var.cc:bool _hb_subset_table<OT::fvar const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-var.cc:bool _hb_subset_table<OT::avar const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-var.cc:bool _hb_subset_table<OT::cvar const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-var.cc:bool _hb_subset_table<OT::MVAR const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-cff.cc:bool _hb_subset_table<OT::cff1 const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-cff.cc:bool _hb_subset_table<OT::cff2 const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-cff.cc:bool _hb_subset_table<OT::VORG const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-color.cc:bool _hb_subset_table<OT::sbix const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-color.cc:bool _hb_subset_table<OT::COLR const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-color.cc:bool _hb_subset_table<OT::CPAL const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Unexecuted instantiation: hb-subset-table-color.cc:bool _hb_subset_table<OT::CBLC const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
hb-subset-table-other.cc:bool _hb_subset_table<OT::glyf const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
140
6.57k
{
141
6.57k
  auto &&source_blob = plan->source_table<TableType> ();
142
6.57k
  auto *table = source_blob.get ();
143
144
6.57k
  hb_tag_t tag = TableType::tableTag;
145
6.57k
  hb_blob_t *blob = source_blob.get_blob();
146
6.57k
  if (unlikely (!blob || !blob->data))
147
0
  {
148
0
    DEBUG_MSG (SUBSET, nullptr,
149
0
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
150
0
    _hb_do_destroy (source_blob, hb_prioritize);
151
0
    return false;
152
0
  }
153
154
6.57k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
155
6.57k
  DEBUG_MSG (SUBSET, nullptr,
156
6.57k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
157
6.57k
  if (unlikely (!buf.alloc (buf_size)))
158
0
  {
159
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
160
0
    _hb_do_destroy (source_blob, hb_prioritize);
161
0
    return false;
162
0
  }
163
164
6.57k
  bool needed = false;
165
6.57k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
166
6.57k
  {
167
6.57k
    hb_subset_context_t c (blob, plan, &serializer, tag);
168
6.57k
    needed = _hb_subset_table_try (table, &buf, &c);
169
6.57k
  }
170
6.57k
  _hb_do_destroy (source_blob, hb_prioritize);
171
172
6.57k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
173
0
  {
174
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
175
0
    return false;
176
0
  }
177
178
6.57k
  if (!needed)
179
0
  {
180
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
181
0
    return true;
182
0
  }
183
184
6.57k
  bool result = false;
185
6.57k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
186
6.57k
  if (dest_blob)
187
6.57k
  {
188
6.57k
    DEBUG_MSG (SUBSET, nullptr,
189
6.57k
               "OT::%c%c%c%c final subset table size: %u bytes.",
190
6.57k
               HB_UNTAG (tag), dest_blob->length);
191
6.57k
    result = plan->add_table (tag, dest_blob);
192
6.57k
    hb_blob_destroy (dest_blob);
193
6.57k
  }
194
195
6.57k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
196
6.57k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
197
6.57k
  return result;
198
6.57k
}
Unexecuted instantiation: hb-subset-table-other.cc:bool _hb_subset_table<OT::hdmx const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
hb-subset-table-other.cc:bool _hb_subset_table<OT::name const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
140
6.57k
{
141
6.57k
  auto &&source_blob = plan->source_table<TableType> ();
142
6.57k
  auto *table = source_blob.get ();
143
144
6.57k
  hb_tag_t tag = TableType::tableTag;
145
6.57k
  hb_blob_t *blob = source_blob.get_blob();
146
6.57k
  if (unlikely (!blob || !blob->data))
147
0
  {
148
0
    DEBUG_MSG (SUBSET, nullptr,
149
0
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
150
0
    _hb_do_destroy (source_blob, hb_prioritize);
151
0
    return false;
152
0
  }
153
154
6.57k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
155
6.57k
  DEBUG_MSG (SUBSET, nullptr,
156
6.57k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
157
6.57k
  if (unlikely (!buf.alloc (buf_size)))
158
0
  {
159
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
160
0
    _hb_do_destroy (source_blob, hb_prioritize);
161
0
    return false;
162
0
  }
163
164
6.57k
  bool needed = false;
165
6.57k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
166
6.57k
  {
167
6.57k
    hb_subset_context_t c (blob, plan, &serializer, tag);
168
6.57k
    needed = _hb_subset_table_try (table, &buf, &c);
169
6.57k
  }
170
6.57k
  _hb_do_destroy (source_blob, hb_prioritize);
171
172
6.57k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
173
0
  {
174
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
175
0
    return false;
176
0
  }
177
178
6.57k
  if (!needed)
179
0
  {
180
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
181
0
    return true;
182
0
  }
183
184
6.57k
  bool result = false;
185
6.57k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
186
6.57k
  if (dest_blob)
187
6.57k
  {
188
6.57k
    DEBUG_MSG (SUBSET, nullptr,
189
6.57k
               "OT::%c%c%c%c final subset table size: %u bytes.",
190
6.57k
               HB_UNTAG (tag), dest_blob->length);
191
6.57k
    result = plan->add_table (tag, dest_blob);
192
6.57k
    hb_blob_destroy (dest_blob);
193
6.57k
  }
194
195
6.57k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
196
6.57k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
197
6.57k
  return result;
198
6.57k
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::hmtx const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
140
6.57k
{
141
6.57k
  auto &&source_blob = plan->source_table<TableType> ();
142
6.57k
  auto *table = source_blob.get ();
143
144
6.57k
  hb_tag_t tag = TableType::tableTag;
145
6.57k
  hb_blob_t *blob = source_blob.get_blob();
146
6.57k
  if (unlikely (!blob || !blob->data))
147
0
  {
148
0
    DEBUG_MSG (SUBSET, nullptr,
149
0
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
150
0
    _hb_do_destroy (source_blob, hb_prioritize);
151
0
    return false;
152
0
  }
153
154
6.57k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
155
6.57k
  DEBUG_MSG (SUBSET, nullptr,
156
6.57k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
157
6.57k
  if (unlikely (!buf.alloc (buf_size)))
158
0
  {
159
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
160
0
    _hb_do_destroy (source_blob, hb_prioritize);
161
0
    return false;
162
0
  }
163
164
6.57k
  bool needed = false;
165
6.57k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
166
6.57k
  {
167
6.57k
    hb_subset_context_t c (blob, plan, &serializer, tag);
168
6.57k
    needed = _hb_subset_table_try (table, &buf, &c);
169
6.57k
  }
170
6.57k
  _hb_do_destroy (source_blob, hb_prioritize);
171
172
6.57k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
173
0
  {
174
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
175
0
    return false;
176
0
  }
177
178
6.57k
  if (!needed)
179
0
  {
180
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
181
0
    return true;
182
0
  }
183
184
6.57k
  bool result = false;
185
6.57k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
186
6.57k
  if (dest_blob)
187
6.57k
  {
188
6.57k
    DEBUG_MSG (SUBSET, nullptr,
189
6.57k
               "OT::%c%c%c%c final subset table size: %u bytes.",
190
6.57k
               HB_UNTAG (tag), dest_blob->length);
191
6.57k
    result = plan->add_table (tag, dest_blob);
192
6.57k
    hb_blob_destroy (dest_blob);
193
6.57k
  }
194
195
6.57k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
196
6.57k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
197
6.57k
  return result;
198
6.57k
}
Unexecuted instantiation: hb-subset-table-other.cc:bool _hb_subset_table<OT::vmtx const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
hb-subset-table-other.cc:bool _hb_subset_table<OT::maxp const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
140
6.57k
{
141
6.57k
  auto &&source_blob = plan->source_table<TableType> ();
142
6.57k
  auto *table = source_blob.get ();
143
144
6.57k
  hb_tag_t tag = TableType::tableTag;
145
6.57k
  hb_blob_t *blob = source_blob.get_blob();
146
6.57k
  if (unlikely (!blob || !blob->data))
147
0
  {
148
0
    DEBUG_MSG (SUBSET, nullptr,
149
0
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
150
0
    _hb_do_destroy (source_blob, hb_prioritize);
151
0
    return false;
152
0
  }
153
154
6.57k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
155
6.57k
  DEBUG_MSG (SUBSET, nullptr,
156
6.57k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
157
6.57k
  if (unlikely (!buf.alloc (buf_size)))
158
0
  {
159
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
160
0
    _hb_do_destroy (source_blob, hb_prioritize);
161
0
    return false;
162
0
  }
163
164
6.57k
  bool needed = false;
165
6.57k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
166
6.57k
  {
167
6.57k
    hb_subset_context_t c (blob, plan, &serializer, tag);
168
6.57k
    needed = _hb_subset_table_try (table, &buf, &c);
169
6.57k
  }
170
6.57k
  _hb_do_destroy (source_blob, hb_prioritize);
171
172
6.57k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
173
0
  {
174
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
175
0
    return false;
176
0
  }
177
178
6.57k
  if (!needed)
179
0
  {
180
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
181
0
    return true;
182
0
  }
183
184
6.57k
  bool result = false;
185
6.57k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
186
6.57k
  if (dest_blob)
187
6.57k
  {
188
6.57k
    DEBUG_MSG (SUBSET, nullptr,
189
6.57k
               "OT::%c%c%c%c final subset table size: %u bytes.",
190
6.57k
               HB_UNTAG (tag), dest_blob->length);
191
6.57k
    result = plan->add_table (tag, dest_blob);
192
6.57k
    hb_blob_destroy (dest_blob);
193
6.57k
  }
194
195
6.57k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
196
6.57k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
197
6.57k
  return result;
198
6.57k
}
Unexecuted instantiation: hb-subset-table-other.cc:bool _hb_subset_table<OT::cmap const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
hb-subset-table-other.cc:bool _hb_subset_table<OT::OS2 const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
140
6.57k
{
141
6.57k
  auto &&source_blob = plan->source_table<TableType> ();
142
6.57k
  auto *table = source_blob.get ();
143
144
6.57k
  hb_tag_t tag = TableType::tableTag;
145
6.57k
  hb_blob_t *blob = source_blob.get_blob();
146
6.57k
  if (unlikely (!blob || !blob->data))
147
0
  {
148
0
    DEBUG_MSG (SUBSET, nullptr,
149
0
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
150
0
    _hb_do_destroy (source_blob, hb_prioritize);
151
0
    return false;
152
0
  }
153
154
6.57k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
155
6.57k
  DEBUG_MSG (SUBSET, nullptr,
156
6.57k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
157
6.57k
  if (unlikely (!buf.alloc (buf_size)))
158
0
  {
159
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
160
0
    _hb_do_destroy (source_blob, hb_prioritize);
161
0
    return false;
162
0
  }
163
164
6.57k
  bool needed = false;
165
6.57k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
166
6.57k
  {
167
6.57k
    hb_subset_context_t c (blob, plan, &serializer, tag);
168
6.57k
    needed = _hb_subset_table_try (table, &buf, &c);
169
6.57k
  }
170
6.57k
  _hb_do_destroy (source_blob, hb_prioritize);
171
172
6.57k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
173
0
  {
174
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
175
0
    return false;
176
0
  }
177
178
6.57k
  if (!needed)
179
0
  {
180
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
181
0
    return true;
182
0
  }
183
184
6.57k
  bool result = false;
185
6.57k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
186
6.57k
  if (dest_blob)
187
6.57k
  {
188
6.57k
    DEBUG_MSG (SUBSET, nullptr,
189
6.57k
               "OT::%c%c%c%c final subset table size: %u bytes.",
190
6.57k
               HB_UNTAG (tag), dest_blob->length);
191
6.57k
    result = plan->add_table (tag, dest_blob);
192
6.57k
    hb_blob_destroy (dest_blob);
193
6.57k
  }
194
195
6.57k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
196
6.57k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
197
6.57k
  return result;
198
6.57k
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::post const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
140
6.57k
{
141
6.57k
  auto &&source_blob = plan->source_table<TableType> ();
142
6.57k
  auto *table = source_blob.get ();
143
144
6.57k
  hb_tag_t tag = TableType::tableTag;
145
6.57k
  hb_blob_t *blob = source_blob.get_blob();
146
6.57k
  if (unlikely (!blob || !blob->data))
147
0
  {
148
0
    DEBUG_MSG (SUBSET, nullptr,
149
0
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
150
0
    _hb_do_destroy (source_blob, hb_prioritize);
151
0
    return false;
152
0
  }
153
154
6.57k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
155
6.57k
  DEBUG_MSG (SUBSET, nullptr,
156
6.57k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
157
6.57k
  if (unlikely (!buf.alloc (buf_size)))
158
0
  {
159
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
160
0
    _hb_do_destroy (source_blob, hb_prioritize);
161
0
    return false;
162
0
  }
163
164
6.57k
  bool needed = false;
165
6.57k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
166
6.57k
  {
167
6.57k
    hb_subset_context_t c (blob, plan, &serializer, tag);
168
6.57k
    needed = _hb_subset_table_try (table, &buf, &c);
169
6.57k
  }
170
6.57k
  _hb_do_destroy (source_blob, hb_prioritize);
171
172
6.57k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
173
0
  {
174
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
175
0
    return false;
176
0
  }
177
178
6.57k
  if (!needed)
179
0
  {
180
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
181
0
    return true;
182
0
  }
183
184
6.57k
  bool result = false;
185
6.57k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
186
6.57k
  if (dest_blob)
187
6.57k
  {
188
6.57k
    DEBUG_MSG (SUBSET, nullptr,
189
6.57k
               "OT::%c%c%c%c final subset table size: %u bytes.",
190
6.57k
               HB_UNTAG (tag), dest_blob->length);
191
6.57k
    result = plan->add_table (tag, dest_blob);
192
6.57k
    hb_blob_destroy (dest_blob);
193
6.57k
  }
194
195
6.57k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
196
6.57k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
197
6.57k
  return result;
198
6.57k
}
199
200
static HB_UNUSED bool
201
_hb_subset_table_passthrough (hb_subset_plan_t *plan, hb_tag_t tag)
202
19.7k
{
203
19.7k
  hb_blob_t *source_table = hb_face_reference_table (plan->source, tag);
204
19.7k
  bool result = plan->add_table (tag, source_table);
205
19.7k
  hb_blob_destroy (source_table);
206
19.7k
  return result;
207
19.7k
}
hb-subset.cc:_hb_subset_table_passthrough(hb_subset_plan_t*, unsigned int)
Line
Count
Source
202
19.7k
{
203
19.7k
  hb_blob_t *source_table = hb_face_reference_table (plan->source, tag);
204
19.7k
  bool result = plan->add_table (tag, source_table);
205
19.7k
  hb_blob_destroy (source_table);
206
19.7k
  return result;
207
19.7k
}
Unexecuted instantiation: hb-subset-table-layout.cc:_hb_subset_table_passthrough(hb_subset_plan_t*, unsigned int)
Unexecuted instantiation: hb-subset-table-var.cc:_hb_subset_table_passthrough(hb_subset_plan_t*, unsigned int)
Unexecuted instantiation: hb-subset-table-cff.cc:_hb_subset_table_passthrough(hb_subset_plan_t*, unsigned int)
Unexecuted instantiation: hb-subset-table-color.cc:_hb_subset_table_passthrough(hb_subset_plan_t*, unsigned int)
Unexecuted instantiation: hb-subset-table-other.cc:_hb_subset_table_passthrough(hb_subset_plan_t*, unsigned int)
208
209
210
HB_INTERNAL bool _hb_subset_table_layout  (hb_subset_plan_t *plan, hb_vector_t<char> &buf, hb_tag_t tag, bool *success);
211
HB_INTERNAL bool _hb_subset_table_var   (hb_subset_plan_t *plan, hb_vector_t<char> &buf, hb_tag_t tag, bool *success);
212
HB_INTERNAL bool _hb_subset_table_cff   (hb_subset_plan_t *plan, hb_vector_t<char> &buf, hb_tag_t tag, bool *success);
213
HB_INTERNAL bool _hb_subset_table_color   (hb_subset_plan_t *plan, hb_vector_t<char> &buf, hb_tag_t tag, bool *success);
214
HB_INTERNAL bool _hb_subset_table_other   (hb_subset_plan_t *plan, hb_vector_t<char> &buf, hb_tag_t tag, bool *success);
215
216
217
#endif /* HB_SUBSET_TABLE_HH */