Coverage Report

Created: 2026-11-12 06:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/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
103k
{
43
103k
  c->serializer->start_serialize ();
44
103k
  if (c->serializer->in_error ()) return false;
45
46
103k
  bool needed = table->subset (c);
47
103k
  if (!c->serializer->ran_out_of_room ())
48
92.1k
  {
49
92.1k
    c->serializer->end_serialize ();
50
92.1k
    return needed;
51
92.1k
  }
52
53
10.9k
  unsigned buf_size = buf->allocated;
54
10.9k
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
10.9k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
10.9k
             HB_UNTAG (c->table_tag), buf_size);
61
62
10.9k
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
10.9k
    !buf->alloc_exact (buf_size)))
64
1.10k
  {
65
1.10k
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
1.10k
               HB_UNTAG (c->table_tag), buf_size);
67
1.10k
    return needed;
68
1.10k
  }
69
70
9.82k
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
9.82k
  return _hb_subset_table_try (table, buf, c);
72
10.9k
}
hb-subset.cc:bool _hb_subset_table_try<OT::head>(OT::head const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
1.34k
{
43
1.34k
  c->serializer->start_serialize ();
44
1.34k
  if (c->serializer->in_error ()) return false;
45
46
1.34k
  bool needed = table->subset (c);
47
1.34k
  if (!c->serializer->ran_out_of_room ())
48
1.34k
  {
49
1.34k
    c->serializer->end_serialize ();
50
1.34k
    return needed;
51
1.34k
  }
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.cc:bool _hb_subset_table_try<OT::STAT>(OT::STAT const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
418
{
43
418
  c->serializer->start_serialize ();
44
418
  if (c->serializer->in_error ()) return false;
45
46
418
  bool needed = table->subset (c);
47
418
  if (!c->serializer->ran_out_of_room ())
48
418
  {
49
418
    c->serializer->end_serialize ();
50
418
    return needed;
51
418
  }
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-layout.cc:bool _hb_subset_table_try<OT::GDEF>(OT::GDEF const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
7.98k
{
43
7.98k
  c->serializer->start_serialize ();
44
7.98k
  if (c->serializer->in_error ()) return false;
45
46
7.97k
  bool needed = table->subset (c);
47
7.97k
  if (!c->serializer->ran_out_of_room ())
48
7.51k
  {
49
7.51k
    c->serializer->end_serialize ();
50
7.51k
    return needed;
51
7.51k
  }
52
53
460
  unsigned buf_size = buf->allocated;
54
460
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
460
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
460
             HB_UNTAG (c->table_tag), buf_size);
61
62
460
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
460
    !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
460
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
460
  return _hb_subset_table_try (table, buf, c);
72
460
}
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*)
Line
Count
Source
42
13.3k
{
43
13.3k
  c->serializer->start_serialize ();
44
13.3k
  if (c->serializer->in_error ()) return false;
45
46
13.3k
  bool needed = table->subset (c);
47
13.3k
  if (!c->serializer->ran_out_of_room ())
48
11.6k
  {
49
11.6k
    c->serializer->end_serialize ();
50
11.6k
    return needed;
51
11.6k
  }
52
53
1.69k
  unsigned buf_size = buf->allocated;
54
1.69k
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
1.69k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
1.69k
             HB_UNTAG (c->table_tag), buf_size);
61
62
1.69k
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
1.69k
    !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
1.69k
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
1.69k
  return _hb_subset_table_try (table, buf, c);
72
1.69k
}
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*)
Line
Count
Source
42
7.59k
{
43
7.59k
  c->serializer->start_serialize ();
44
7.59k
  if (c->serializer->in_error ()) return false;
45
46
7.59k
  bool needed = table->subset (c);
47
7.59k
  if (!c->serializer->ran_out_of_room ())
48
6.79k
  {
49
6.79k
    c->serializer->end_serialize ();
50
6.79k
    return needed;
51
6.79k
  }
52
53
799
  unsigned buf_size = buf->allocated;
54
799
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
799
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
799
             HB_UNTAG (c->table_tag), buf_size);
61
62
799
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
799
    !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
799
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
799
  return _hb_subset_table_try (table, buf, c);
72
799
}
hb-subset-table-layout.cc:bool _hb_subset_table_try<OT::BASE>(OT::BASE const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
740
{
43
740
  c->serializer->start_serialize ();
44
740
  if (c->serializer->in_error ()) return false;
45
46
739
  bool needed = table->subset (c);
47
739
  if (!c->serializer->ran_out_of_room ())
48
658
  {
49
658
    c->serializer->end_serialize ();
50
658
    return needed;
51
658
  }
52
53
81
  unsigned buf_size = buf->allocated;
54
81
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
81
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
81
             HB_UNTAG (c->table_tag), buf_size);
61
62
81
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
81
    !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
81
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
81
  return _hb_subset_table_try (table, buf, c);
72
81
}
hb-subset-table-layout.cc:bool _hb_subset_table_try<OT::MATH>(OT::MATH const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
1.31k
{
43
1.31k
  c->serializer->start_serialize ();
44
1.31k
  if (c->serializer->in_error ()) return false;
45
46
1.31k
  bool needed = table->subset (c);
47
1.31k
  if (!c->serializer->ran_out_of_room ())
48
904
  {
49
904
    c->serializer->end_serialize ();
50
904
    return needed;
51
904
  }
52
53
407
  unsigned buf_size = buf->allocated;
54
407
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
407
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
407
             HB_UNTAG (c->table_tag), buf_size);
61
62
407
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
407
    !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
407
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
407
  return _hb_subset_table_try (table, buf, c);
72
407
}
hb-subset-table-var.cc:bool _hb_subset_table_try<OT::HVAR>(OT::HVAR const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
2.10k
{
43
2.10k
  c->serializer->start_serialize ();
44
2.10k
  if (c->serializer->in_error ()) return false;
45
46
2.10k
  bool needed = table->subset (c);
47
2.10k
  if (!c->serializer->ran_out_of_room ())
48
1.74k
  {
49
1.74k
    c->serializer->end_serialize ();
50
1.74k
    return needed;
51
1.74k
  }
52
53
358
  unsigned buf_size = buf->allocated;
54
358
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
358
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
358
             HB_UNTAG (c->table_tag), buf_size);
61
62
358
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
358
    !buf->alloc_exact (buf_size)))
64
22
  {
65
22
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
22
               HB_UNTAG (c->table_tag), buf_size);
67
22
    return needed;
68
22
  }
69
70
336
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
336
  return _hb_subset_table_try (table, buf, c);
72
358
}
hb-subset-table-var.cc:bool _hb_subset_table_try<OT::VVAR>(OT::VVAR const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
266
{
43
266
  c->serializer->start_serialize ();
44
266
  if (c->serializer->in_error ()) return false;
45
46
265
  bool needed = table->subset (c);
47
265
  if (!c->serializer->ran_out_of_room ())
48
109
  {
49
109
    c->serializer->end_serialize ();
50
109
    return needed;
51
109
  }
52
53
156
  unsigned buf_size = buf->allocated;
54
156
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
156
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
156
             HB_UNTAG (c->table_tag), buf_size);
61
62
156
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
156
    !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
156
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
156
  return _hb_subset_table_try (table, buf, c);
72
156
}
hb-subset-table-var.cc:bool _hb_subset_table_try<OT::gvar>(OT::gvar const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
938
{
43
938
  c->serializer->start_serialize ();
44
938
  if (c->serializer->in_error ()) return false;
45
46
938
  bool needed = table->subset (c);
47
938
  if (!c->serializer->ran_out_of_room ())
48
858
  {
49
858
    c->serializer->end_serialize ();
50
858
    return needed;
51
858
  }
52
53
80
  unsigned buf_size = buf->allocated;
54
80
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
80
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
80
             HB_UNTAG (c->table_tag), buf_size);
61
62
80
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
80
    !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
80
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
80
  return _hb_subset_table_try (table, buf, c);
72
80
}
hb-subset-table-var.cc:bool _hb_subset_table_try<OT::GVAR>(OT::GVAR const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
671
{
43
671
  c->serializer->start_serialize ();
44
671
  if (c->serializer->in_error ()) return false;
45
46
670
  bool needed = table->subset (c);
47
670
  if (!c->serializer->ran_out_of_room ())
48
581
  {
49
581
    c->serializer->end_serialize ();
50
581
    return needed;
51
581
  }
52
53
89
  unsigned buf_size = buf->allocated;
54
89
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
89
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
89
             HB_UNTAG (c->table_tag), buf_size);
61
62
89
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
89
    !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
89
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
89
  return _hb_subset_table_try (table, buf, c);
72
89
}
hb-subset-table-var.cc:bool _hb_subset_table_try<OT::VARC>(OT::VARC const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
423
{
43
423
  c->serializer->start_serialize ();
44
423
  if (c->serializer->in_error ()) return false;
45
46
423
  bool needed = table->subset (c);
47
423
  if (!c->serializer->ran_out_of_room ())
48
423
  {
49
423
    c->serializer->end_serialize ();
50
423
    return needed;
51
423
  }
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-var.cc:bool _hb_subset_table_try<OT::fvar>(OT::fvar const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
1.67k
{
43
1.67k
  c->serializer->start_serialize ();
44
1.67k
  if (c->serializer->in_error ()) return false;
45
46
1.67k
  bool needed = table->subset (c);
47
1.67k
  if (!c->serializer->ran_out_of_room ())
48
1.67k
  {
49
1.67k
    c->serializer->end_serialize ();
50
1.67k
    return needed;
51
1.67k
  }
52
53
1
  unsigned buf_size = buf->allocated;
54
1
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
1
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
1
             HB_UNTAG (c->table_tag), buf_size);
61
62
1
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
1
    !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
1
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
1
  return _hb_subset_table_try (table, buf, c);
72
1
}
hb-subset-table-var.cc:bool _hb_subset_table_try<OT::avar>(OT::avar const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
334
{
43
334
  c->serializer->start_serialize ();
44
334
  if (c->serializer->in_error ()) return false;
45
46
334
  bool needed = table->subset (c);
47
334
  if (!c->serializer->ran_out_of_room ())
48
334
  {
49
334
    c->serializer->end_serialize ();
50
334
    return needed;
51
334
  }
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-var.cc:bool _hb_subset_table_try<OT::cvar>(OT::cvar const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
355
{
43
355
  c->serializer->start_serialize ();
44
355
  if (c->serializer->in_error ()) return false;
45
46
355
  bool needed = table->subset (c);
47
355
  if (!c->serializer->ran_out_of_room ())
48
355
  {
49
355
    c->serializer->end_serialize ();
50
355
    return needed;
51
355
  }
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-var.cc:bool _hb_subset_table_try<OT::MVAR>(OT::MVAR const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
553
{
43
553
  c->serializer->start_serialize ();
44
553
  if (c->serializer->in_error ()) return false;
45
46
553
  bool needed = table->subset (c);
47
553
  if (!c->serializer->ran_out_of_room ())
48
553
  {
49
553
    c->serializer->end_serialize ();
50
553
    return needed;
51
553
  }
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-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*)
Line
Count
Source
42
5.84k
{
43
5.84k
  c->serializer->start_serialize ();
44
5.84k
  if (c->serializer->in_error ()) return false;
45
46
5.84k
  bool needed = table->subset (c);
47
5.84k
  if (!c->serializer->ran_out_of_room ())
48
2.14k
  {
49
2.14k
    c->serializer->end_serialize ();
50
2.14k
    return needed;
51
2.14k
  }
52
53
3.69k
  unsigned buf_size = buf->allocated;
54
3.69k
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
3.69k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
3.69k
             HB_UNTAG (c->table_tag), buf_size);
61
62
3.69k
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
3.69k
    !buf->alloc_exact (buf_size)))
64
663
  {
65
663
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
663
               HB_UNTAG (c->table_tag), buf_size);
67
663
    return needed;
68
663
  }
69
70
3.03k
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
3.03k
  return _hb_subset_table_try (table, buf, c);
72
3.69k
}
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*)
Line
Count
Source
42
3.38k
{
43
3.38k
  c->serializer->start_serialize ();
44
3.38k
  if (c->serializer->in_error ()) return false;
45
46
3.38k
  bool needed = table->subset (c);
47
3.38k
  if (!c->serializer->ran_out_of_room ())
48
3.29k
  {
49
3.29k
    c->serializer->end_serialize ();
50
3.29k
    return needed;
51
3.29k
  }
52
53
93
  unsigned buf_size = buf->allocated;
54
93
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
93
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
93
             HB_UNTAG (c->table_tag), buf_size);
61
62
93
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
93
    !buf->alloc_exact (buf_size)))
64
12
  {
65
12
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
12
               HB_UNTAG (c->table_tag), buf_size);
67
12
    return needed;
68
12
  }
69
70
81
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
81
  return _hb_subset_table_try (table, buf, c);
72
93
}
hb-subset-table-cff.cc:bool _hb_subset_table_try<OT::VORG>(OT::VORG const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
189
{
43
189
  c->serializer->start_serialize ();
44
189
  if (c->serializer->in_error ()) return false;
45
46
188
  bool needed = table->subset (c);
47
188
  if (!c->serializer->ran_out_of_room ())
48
188
  {
49
188
    c->serializer->end_serialize ();
50
188
    return needed;
51
188
  }
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-color.cc:bool _hb_subset_table_try<OT::sbix>(OT::sbix const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
238
{
43
238
  c->serializer->start_serialize ();
44
238
  if (c->serializer->in_error ()) return false;
45
46
238
  bool needed = table->subset (c);
47
238
  if (!c->serializer->ran_out_of_room ())
48
188
  {
49
188
    c->serializer->end_serialize ();
50
188
    return needed;
51
188
  }
52
53
50
  unsigned buf_size = buf->allocated;
54
50
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
50
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
50
             HB_UNTAG (c->table_tag), buf_size);
61
62
50
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
50
    !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
50
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
50
  return _hb_subset_table_try (table, buf, c);
72
50
}
hb-subset-table-color.cc:bool _hb_subset_table_try<OT::COLR>(OT::COLR const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
6.16k
{
43
6.16k
  c->serializer->start_serialize ();
44
6.16k
  if (c->serializer->in_error ()) return false;
45
46
6.15k
  bool needed = table->subset (c);
47
6.15k
  if (!c->serializer->ran_out_of_room ())
48
5.69k
  {
49
5.69k
    c->serializer->end_serialize ();
50
5.69k
    return needed;
51
5.69k
  }
52
53
461
  unsigned buf_size = buf->allocated;
54
461
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
461
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
461
             HB_UNTAG (c->table_tag), buf_size);
61
62
461
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
461
    !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
461
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
461
  return _hb_subset_table_try (table, buf, c);
72
461
}
hb-subset-table-color.cc:bool _hb_subset_table_try<OT::CPAL>(OT::CPAL const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
1.49k
{
43
1.49k
  c->serializer->start_serialize ();
44
1.49k
  if (c->serializer->in_error ()) return false;
45
46
1.49k
  bool needed = table->subset (c);
47
1.49k
  if (!c->serializer->ran_out_of_room ())
48
1.40k
  {
49
1.40k
    c->serializer->end_serialize ();
50
1.40k
    return needed;
51
1.40k
  }
52
53
87
  unsigned buf_size = buf->allocated;
54
87
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
87
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
87
             HB_UNTAG (c->table_tag), buf_size);
61
62
87
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
87
    !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
87
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
87
  return _hb_subset_table_try (table, buf, c);
72
87
}
hb-subset-table-color.cc:bool _hb_subset_table_try<OT::CBLC>(OT::CBLC const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
257
{
43
257
  c->serializer->start_serialize ();
44
257
  if (c->serializer->in_error ()) return false;
45
46
256
  bool needed = table->subset (c);
47
256
  if (!c->serializer->ran_out_of_room ())
48
256
  {
49
256
    c->serializer->end_serialize ();
50
256
    return needed;
51
256
  }
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::glyf>(OT::glyf const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
5.75k
{
43
5.75k
  c->serializer->start_serialize ();
44
5.75k
  if (c->serializer->in_error ()) return false;
45
46
5.75k
  bool needed = table->subset (c);
47
5.75k
  if (!c->serializer->ran_out_of_room ())
48
5.02k
  {
49
5.02k
    c->serializer->end_serialize ();
50
5.02k
    return needed;
51
5.02k
  }
52
53
730
  unsigned buf_size = buf->allocated;
54
730
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
730
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
730
             HB_UNTAG (c->table_tag), buf_size);
61
62
730
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
730
    !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
730
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
730
  return _hb_subset_table_try (table, buf, c);
72
730
}
hb-subset-table-other.cc:bool _hb_subset_table_try<OT::hdmx>(OT::hdmx const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
140
{
43
140
  c->serializer->start_serialize ();
44
140
  if (c->serializer->in_error ()) return false;
45
46
139
  bool needed = table->subset (c);
47
139
  if (!c->serializer->ran_out_of_room ())
48
69
  {
49
69
    c->serializer->end_serialize ();
50
69
    return needed;
51
69
  }
52
53
70
  unsigned buf_size = buf->allocated;
54
70
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
70
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
70
             HB_UNTAG (c->table_tag), buf_size);
61
62
70
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
70
    !buf->alloc_exact (buf_size)))
64
17
  {
65
17
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
17
               HB_UNTAG (c->table_tag), buf_size);
67
17
    return needed;
68
17
  }
69
70
53
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
53
  return _hb_subset_table_try (table, buf, c);
72
70
}
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
2.58k
{
43
2.58k
  c->serializer->start_serialize ();
44
2.58k
  if (c->serializer->in_error ()) return false;
45
46
2.58k
  bool needed = table->subset (c);
47
2.58k
  if (!c->serializer->ran_out_of_room ())
48
2.58k
  {
49
2.58k
    c->serializer->end_serialize ();
50
2.58k
    return needed;
51
2.58k
  }
52
53
1
  unsigned buf_size = buf->allocated;
54
1
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
1
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
1
             HB_UNTAG (c->table_tag), buf_size);
61
62
1
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
1
    !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
1
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
1
  return _hb_subset_table_try (table, buf, c);
72
1
}
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
5.19k
{
43
5.19k
  c->serializer->start_serialize ();
44
5.19k
  if (c->serializer->in_error ()) return false;
45
46
5.18k
  bool needed = table->subset (c);
47
5.18k
  if (!c->serializer->ran_out_of_room ())
48
4.51k
  {
49
4.51k
    c->serializer->end_serialize ();
50
4.51k
    return needed;
51
4.51k
  }
52
53
676
  unsigned buf_size = buf->allocated;
54
676
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
676
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
676
             HB_UNTAG (c->table_tag), buf_size);
61
62
676
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
676
    !buf->alloc_exact (buf_size)))
64
299
  {
65
299
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
299
               HB_UNTAG (c->table_tag), buf_size);
67
299
    return needed;
68
299
  }
69
70
377
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
377
  return _hb_subset_table_try (table, buf, c);
72
676
}
hb-subset-table-other.cc:bool _hb_subset_table_try<OT::vmtx>(OT::vmtx const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
1.07k
{
43
1.07k
  c->serializer->start_serialize ();
44
1.07k
  if (c->serializer->in_error ()) return false;
45
46
1.07k
  bool needed = table->subset (c);
47
1.07k
  if (!c->serializer->ran_out_of_room ())
48
613
  {
49
613
    c->serializer->end_serialize ();
50
613
    return needed;
51
613
  }
52
53
463
  unsigned buf_size = buf->allocated;
54
463
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
463
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
463
             HB_UNTAG (c->table_tag), buf_size);
61
62
463
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
463
    !buf->alloc_exact (buf_size)))
64
53
  {
65
53
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
53
               HB_UNTAG (c->table_tag), buf_size);
67
53
    return needed;
68
53
  }
69
70
410
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
410
  return _hb_subset_table_try (table, buf, c);
72
463
}
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
15.3k
{
43
15.3k
  c->serializer->start_serialize ();
44
15.3k
  if (c->serializer->in_error ()) return false;
45
46
15.3k
  bool needed = table->subset (c);
47
15.3k
  if (!c->serializer->ran_out_of_room ())
48
15.3k
  {
49
15.3k
    c->serializer->end_serialize ();
50
15.3k
    return needed;
51
15.3k
  }
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::GLYF>(OT::GLYF const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
18
{
43
18
  c->serializer->start_serialize ();
44
18
  if (c->serializer->in_error ()) return false;
45
46
18
  bool needed = table->subset (c);
47
18
  if (!c->serializer->ran_out_of_room ())
48
18
  {
49
18
    c->serializer->end_serialize ();
50
18
    return needed;
51
18
  }
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
186
{
43
186
  c->serializer->start_serialize ();
44
186
  if (c->serializer->in_error ()) return false;
45
46
185
  bool needed = table->subset (c);
47
185
  if (!c->serializer->ran_out_of_room ())
48
95
  {
49
95
    c->serializer->end_serialize ();
50
95
    return needed;
51
95
  }
52
53
90
  unsigned buf_size = buf->allocated;
54
90
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
90
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
90
             HB_UNTAG (c->table_tag), buf_size);
61
62
90
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
90
    !buf->alloc_exact (buf_size)))
64
15
  {
65
15
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
15
               HB_UNTAG (c->table_tag), buf_size);
67
15
    return needed;
68
15
  }
69
70
75
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
75
  return _hb_subset_table_try (table, buf, c);
72
90
}
hb-subset-table-other.cc:bool _hb_subset_table_try<OT::VMTX>(OT::VMTX const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
298
{
43
298
  c->serializer->start_serialize ();
44
298
  if (c->serializer->in_error ()) return false;
45
46
297
  bool needed = table->subset (c);
47
297
  if (!c->serializer->ran_out_of_room ())
48
116
  {
49
116
    c->serializer->end_serialize ();
50
116
    return needed;
51
116
  }
52
53
181
  unsigned buf_size = buf->allocated;
54
181
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
181
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
181
             HB_UNTAG (c->table_tag), buf_size);
61
62
181
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
181
    !buf->alloc_exact (buf_size)))
64
19
  {
65
19
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
19
               HB_UNTAG (c->table_tag), buf_size);
67
19
    return needed;
68
19
  }
69
70
162
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
162
  return _hb_subset_table_try (table, buf, c);
72
181
}
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
49
{
43
49
  c->serializer->start_serialize ();
44
49
  if (c->serializer->in_error ()) return false;
45
46
48
  bool needed = table->subset (c);
47
48
  if (!c->serializer->ran_out_of_room ())
48
48
  {
49
48
    c->serializer->end_serialize ();
50
48
    return needed;
51
48
  }
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::cmap>(OT::cmap const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
7.58k
{
43
7.58k
  c->serializer->start_serialize ();
44
7.58k
  if (c->serializer->in_error ()) return false;
45
46
7.57k
  bool needed = table->subset (c);
47
7.57k
  if (!c->serializer->ran_out_of_room ())
48
7.53k
  {
49
7.53k
    c->serializer->end_serialize ();
50
7.53k
    return needed;
51
7.53k
  }
52
53
46
  unsigned buf_size = buf->allocated;
54
46
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
46
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
46
             HB_UNTAG (c->table_tag), buf_size);
61
62
46
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
46
    !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
46
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
46
  return _hb_subset_table_try (table, buf, c);
72
46
}
hb-subset-table-other.cc:bool _hb_subset_table_try<OT::DMAP>(OT::DMAP const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
263
{
43
263
  c->serializer->start_serialize ();
44
263
  if (c->serializer->in_error ()) return false;
45
46
263
  bool needed = table->subset (c);
47
263
  if (!c->serializer->ran_out_of_room ())
48
263
  {
49
263
    c->serializer->end_serialize ();
50
263
    return needed;
51
263
  }
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::OS2>(OT::OS2 const*, hb_vector_t<char, false>*, hb_subset_context_t*)
Line
Count
Source
42
4.63k
{
43
4.63k
  c->serializer->start_serialize ();
44
4.63k
  if (c->serializer->in_error ()) return false;
45
46
4.63k
  bool needed = table->subset (c);
47
4.63k
  if (!c->serializer->ran_out_of_room ())
48
4.63k
  {
49
4.63k
    c->serializer->end_serialize ();
50
4.63k
    return needed;
51
4.63k
  }
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
2.44k
{
43
2.44k
  c->serializer->start_serialize ();
44
2.44k
  if (c->serializer->in_error ()) return false;
45
46
2.44k
  bool needed = table->subset (c);
47
2.44k
  if (!c->serializer->ran_out_of_room ())
48
2.29k
  {
49
2.29k
    c->serializer->end_serialize ();
50
2.29k
    return needed;
51
2.29k
  }
52
53
153
  unsigned buf_size = buf->allocated;
54
153
  buf_size = buf_size * 2 + 16;
55
56
57
58
59
153
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
60
153
             HB_UNTAG (c->table_tag), buf_size);
61
62
153
  if (unlikely (buf_size > c->source_blob->length * 256 ||
63
153
    !buf->alloc_exact (buf_size)))
64
7
  {
65
7
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
66
7
               HB_UNTAG (c->table_tag), buf_size);
67
7
    return needed;
68
7
  }
69
70
146
  c->serializer->reset (buf->arrayZ, buf->allocated);
71
146
  return _hb_subset_table_try (table, buf, c);
72
153
}
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
93.3k
{
79
93.3k
  unsigned src_glyphs = plan->source->get_num_glyphs ();
80
93.3k
  unsigned dst_glyphs = plan->glyphset ()->get_population ();
81
82
93.3k
  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
93.3k
  bool same_size = table_tag == HB_TAG('G','S','U','B') ||
86
81.7k
       table_tag == HB_TAG('G','P','O','S') ||
87
74.9k
       table_tag == HB_TAG('G','D','E','F') ||
88
67.4k
       table_tag == HB_TAG('n','a','m','e');
89
90
93.3k
  if (plan->flags & HB_SUBSET_FLAGS_RETAIN_GIDS)
91
13.2k
  {
92
13.2k
    if (table_tag == HB_TAG('C','F','F',' '))
93
650
    {
94
      /* Add some extra room for the CFF charset. */
95
650
      bulk += src_glyphs * 16;
96
650
    }
97
12.6k
    else if (table_tag == HB_TAG('C','F','F','2'))
98
512
    {
99
      /* Just extra CharString offsets. */
100
512
      bulk += src_glyphs * 4;
101
512
    }
102
13.2k
  }
103
104
93.3k
  if (unlikely (!src_glyphs) || same_size)
105
28.5k
    return bulk + table_len;
106
107
64.8k
  return bulk + (unsigned) (table_len * sqrt ((double) dst_glyphs / src_glyphs));
108
93.3k
}
hb-subset.cc:_hb_subset_estimate_table_size(hb_subset_plan_t*, unsigned int, unsigned int)
Line
Count
Source
78
1.76k
{
79
1.76k
  unsigned src_glyphs = plan->source->get_num_glyphs ();
80
1.76k
  unsigned dst_glyphs = plan->glyphset ()->get_population ();
81
82
1.76k
  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
1.76k
  bool same_size = table_tag == HB_TAG('G','S','U','B') ||
86
1.76k
       table_tag == HB_TAG('G','P','O','S') ||
87
1.76k
       table_tag == HB_TAG('G','D','E','F') ||
88
1.76k
       table_tag == HB_TAG('n','a','m','e');
89
90
1.76k
  if (plan->flags & HB_SUBSET_FLAGS_RETAIN_GIDS)
91
260
  {
92
260
    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
260
    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
260
  }
103
104
1.76k
  if (unlikely (!src_glyphs) || same_size)
105
0
    return bulk + table_len;
106
107
1.76k
  return bulk + (unsigned) (table_len * sqrt ((double) dst_glyphs / src_glyphs));
108
1.76k
}
hb-subset-table-layout.cc:_hb_subset_estimate_table_size(hb_subset_plan_t*, unsigned int, unsigned int)
Line
Count
Source
78
27.5k
{
79
27.5k
  unsigned src_glyphs = plan->source->get_num_glyphs ();
80
27.5k
  unsigned dst_glyphs = plan->glyphset ()->get_population ();
81
82
27.5k
  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
27.5k
  bool same_size = table_tag == HB_TAG('G','S','U','B') ||
86
15.8k
       table_tag == HB_TAG('G','P','O','S') ||
87
9.08k
       table_tag == HB_TAG('G','D','E','F') ||
88
1.56k
       table_tag == HB_TAG('n','a','m','e');
89
90
27.5k
  if (plan->flags & HB_SUBSET_FLAGS_RETAIN_GIDS)
91
3.09k
  {
92
3.09k
    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
3.09k
    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
3.09k
  }
103
104
27.5k
  if (unlikely (!src_glyphs) || same_size)
105
25.9k
    return bulk + table_len;
106
107
1.56k
  return bulk + (unsigned) (table_len * sqrt ((double) dst_glyphs / src_glyphs));
108
27.5k
}
hb-subset-table-var.cc:_hb_subset_estimate_table_size(hb_subset_plan_t*, unsigned int, unsigned int)
Line
Count
Source
78
6.65k
{
79
6.65k
  unsigned src_glyphs = plan->source->get_num_glyphs ();
80
6.65k
  unsigned dst_glyphs = plan->glyphset ()->get_population ();
81
82
6.65k
  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
6.65k
  bool same_size = table_tag == HB_TAG('G','S','U','B') ||
86
6.65k
       table_tag == HB_TAG('G','P','O','S') ||
87
6.65k
       table_tag == HB_TAG('G','D','E','F') ||
88
6.65k
       table_tag == HB_TAG('n','a','m','e');
89
90
6.65k
  if (plan->flags & HB_SUBSET_FLAGS_RETAIN_GIDS)
91
1.11k
  {
92
1.11k
    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
1.11k
    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
1.11k
  }
103
104
6.65k
  if (unlikely (!src_glyphs) || same_size)
105
0
    return bulk + table_len;
106
107
6.65k
  return bulk + (unsigned) (table_len * sqrt ((double) dst_glyphs / src_glyphs));
108
6.65k
}
hb-subset-table-cff.cc:_hb_subset_estimate_table_size(hb_subset_plan_t*, unsigned int, unsigned int)
Line
Count
Source
78
6.31k
{
79
6.31k
  unsigned src_glyphs = plan->source->get_num_glyphs ();
80
6.31k
  unsigned dst_glyphs = plan->glyphset ()->get_population ();
81
82
6.31k
  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
6.31k
  bool same_size = table_tag == HB_TAG('G','S','U','B') ||
86
6.31k
       table_tag == HB_TAG('G','P','O','S') ||
87
6.31k
       table_tag == HB_TAG('G','D','E','F') ||
88
6.31k
       table_tag == HB_TAG('n','a','m','e');
89
90
6.31k
  if (plan->flags & HB_SUBSET_FLAGS_RETAIN_GIDS)
91
1.20k
  {
92
1.20k
    if (table_tag == HB_TAG('C','F','F',' '))
93
650
    {
94
      /* Add some extra room for the CFF charset. */
95
650
      bulk += src_glyphs * 16;
96
650
    }
97
552
    else if (table_tag == HB_TAG('C','F','F','2'))
98
512
    {
99
      /* Just extra CharString offsets. */
100
512
      bulk += src_glyphs * 4;
101
512
    }
102
1.20k
  }
103
104
6.31k
  if (unlikely (!src_glyphs) || same_size)
105
0
    return bulk + table_len;
106
107
6.31k
  return bulk + (unsigned) (table_len * sqrt ((double) dst_glyphs / src_glyphs));
108
6.31k
}
hb-subset-table-color.cc:_hb_subset_estimate_table_size(hb_subset_plan_t*, unsigned int, unsigned int)
Line
Count
Source
78
7.55k
{
79
7.55k
  unsigned src_glyphs = plan->source->get_num_glyphs ();
80
7.55k
  unsigned dst_glyphs = plan->glyphset ()->get_population ();
81
82
7.55k
  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
7.55k
  bool same_size = table_tag == HB_TAG('G','S','U','B') ||
86
7.55k
       table_tag == HB_TAG('G','P','O','S') ||
87
7.55k
       table_tag == HB_TAG('G','D','E','F') ||
88
7.55k
       table_tag == HB_TAG('n','a','m','e');
89
90
7.55k
  if (plan->flags & HB_SUBSET_FLAGS_RETAIN_GIDS)
91
1.20k
  {
92
1.20k
    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
1.20k
    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
1.20k
  }
103
104
7.55k
  if (unlikely (!src_glyphs) || same_size)
105
0
    return bulk + table_len;
106
107
7.55k
  return bulk + (unsigned) (table_len * sqrt ((double) dst_glyphs / src_glyphs));
108
7.55k
}
hb-subset-table-other.cc:_hb_subset_estimate_table_size(hb_subset_plan_t*, unsigned int, unsigned int)
Line
Count
Source
78
43.5k
{
79
43.5k
  unsigned src_glyphs = plan->source->get_num_glyphs ();
80
43.5k
  unsigned dst_glyphs = plan->glyphset ()->get_population ();
81
82
43.5k
  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
43.5k
  bool same_size = table_tag == HB_TAG('G','S','U','B') ||
86
43.5k
       table_tag == HB_TAG('G','P','O','S') ||
87
43.5k
       table_tag == HB_TAG('G','D','E','F') ||
88
43.5k
       table_tag == HB_TAG('n','a','m','e');
89
90
43.5k
  if (plan->flags & HB_SUBSET_FLAGS_RETAIN_GIDS)
91
6.38k
  {
92
6.38k
    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
6.38k
    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
6.38k
  }
103
104
43.5k
  if (unlikely (!src_glyphs) || same_size)
105
2.58k
    return bulk + table_len;
106
107
40.9k
  return bulk + (unsigned) (table_len * sqrt ((double) dst_glyphs / src_glyphs));
108
43.5k
}
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
74.4k
{
116
74.4k
  if (!c.offset_overflow ())
117
72.6k
    return c.copy_blob ();
118
119
1.76k
  hb_blob_t* result = hb_resolve_overflows (c.object_graph (), tag);
120
121
1.76k
  if (unlikely (!result))
122
1.15k
  {
123
1.15k
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c offset overflow resolution failed.",
124
1.15k
               HB_UNTAG (tag));
125
1.15k
    return nullptr;
126
1.15k
  }
127
128
612
  return result;
129
1.76k
}
hb-subset.cc:_hb_subset_repack(unsigned int, hb_serialize_context_t const&)
Line
Count
Source
115
1.75k
{
116
1.75k
  if (!c.offset_overflow ())
117
1.75k
    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
}
hb-subset-table-layout.cc:_hb_subset_repack(unsigned int, hb_serialize_context_t const&)
Line
Count
Source
115
23.1k
{
116
23.1k
  if (!c.offset_overflow ())
117
21.3k
    return c.copy_blob ();
118
119
1.76k
  hb_blob_t* result = hb_resolve_overflows (c.object_graph (), tag);
120
121
1.76k
  if (unlikely (!result))
122
1.15k
  {
123
1.15k
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c offset overflow resolution failed.",
124
1.15k
               HB_UNTAG (tag));
125
1.15k
    return nullptr;
126
1.15k
  }
127
128
612
  return result;
129
1.76k
}
hb-subset-table-var.cc:_hb_subset_repack(unsigned int, hb_serialize_context_t const&)
Line
Count
Source
115
4.48k
{
116
4.48k
  if (!c.offset_overflow ())
117
4.48k
    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
}
hb-subset-table-cff.cc:_hb_subset_repack(unsigned int, hb_serialize_context_t const&)
Line
Count
Source
115
3.33k
{
116
3.33k
  if (!c.offset_overflow ())
117
3.33k
    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
}
hb-subset-table-color.cc:_hb_subset_repack(unsigned int, hb_serialize_context_t const&)
Line
Count
Source
115
3.48k
{
116
3.48k
  if (!c.offset_overflow ())
117
3.48k
    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
}
hb-subset-table-other.cc:_hb_subset_repack(unsigned int, hb_serialize_context_t const&)
Line
Count
Source
115
38.2k
{
116
38.2k
  if (!c.offset_overflow ())
117
38.2k
    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 TableType>
132
static bool
133
_hb_subset_table (hb_subset_plan_t *plan, hb_vector_t<char> &buf)
134
118k
{
135
118k
  auto &&source_blob = plan->source_table<TableType> ();
136
118k
  auto *table = source_blob.get ();
137
138
118k
  hb_tag_t tag = TableType::tableTag;
139
118k
  hb_blob_t *blob = source_blob.get_blob();
140
118k
  if (unlikely (!blob || !blob->data))
141
24.8k
  {
142
24.8k
    DEBUG_MSG (SUBSET, nullptr,
143
24.8k
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
24.8k
    return false;
145
24.8k
  }
146
147
93.3k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
93.3k
  DEBUG_MSG (SUBSET, nullptr,
149
93.3k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
93.3k
  if (unlikely (!buf.alloc (buf_size)))
151
28
  {
152
28
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
28
    return false;
154
28
  }
155
156
93.3k
  bool needed = false;
157
93.3k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
93.3k
  {
159
93.3k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
93.3k
    needed = _hb_subset_table_try (table, &buf, &c);
161
93.3k
  }
162
163
93.3k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
5.32k
  {
165
5.32k
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
5.32k
    return false;
167
5.32k
  }
168
169
87.9k
  if (!needed)
170
13.5k
  {
171
13.5k
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
13.5k
    return true;
173
13.5k
  }
174
175
74.4k
  bool result = false;
176
74.4k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
74.4k
  if (dest_blob)
178
73.2k
  {
179
73.2k
    DEBUG_MSG (SUBSET, nullptr,
180
73.2k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
73.2k
               HB_UNTAG (tag), dest_blob->length);
182
73.2k
    result = plan->add_table (tag, dest_blob);
183
73.2k
    hb_blob_destroy (dest_blob);
184
73.2k
  }
185
186
74.4k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
74.4k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
74.4k
  return result;
189
87.9k
}
hb-subset.cc:bool _hb_subset_table<OT::head const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
4.79k
{
135
4.79k
  auto &&source_blob = plan->source_table<TableType> ();
136
4.79k
  auto *table = source_blob.get ();
137
138
4.79k
  hb_tag_t tag = TableType::tableTag;
139
4.79k
  hb_blob_t *blob = source_blob.get_blob();
140
4.79k
  if (unlikely (!blob || !blob->data))
141
3.44k
  {
142
3.44k
    DEBUG_MSG (SUBSET, nullptr,
143
3.44k
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
3.44k
    return false;
145
3.44k
  }
146
147
1.34k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
1.34k
  DEBUG_MSG (SUBSET, nullptr,
149
1.34k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
1.34k
  if (unlikely (!buf.alloc (buf_size)))
151
1
  {
152
1
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
1
    return false;
154
1
  }
155
156
1.34k
  bool needed = false;
157
1.34k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
1.34k
  {
159
1.34k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
1.34k
    needed = _hb_subset_table_try (table, &buf, &c);
161
1.34k
  }
162
163
1.34k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
9
  {
165
9
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
9
    return false;
167
9
  }
168
169
1.33k
  if (!needed)
170
0
  {
171
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
0
    return true;
173
0
  }
174
175
1.33k
  bool result = false;
176
1.33k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
1.33k
  if (dest_blob)
178
1.33k
  {
179
1.33k
    DEBUG_MSG (SUBSET, nullptr,
180
1.33k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
1.33k
               HB_UNTAG (tag), dest_blob->length);
182
1.33k
    result = plan->add_table (tag, dest_blob);
183
1.33k
    hb_blob_destroy (dest_blob);
184
1.33k
  }
185
186
1.33k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
1.33k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
1.33k
  return result;
189
1.33k
}
hb-subset.cc:bool _hb_subset_table<OT::STAT const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
492
{
135
492
  auto &&source_blob = plan->source_table<TableType> ();
136
492
  auto *table = source_blob.get ();
137
138
492
  hb_tag_t tag = TableType::tableTag;
139
492
  hb_blob_t *blob = source_blob.get_blob();
140
492
  if (unlikely (!blob || !blob->data))
141
74
  {
142
74
    DEBUG_MSG (SUBSET, nullptr,
143
74
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
74
    return false;
145
74
  }
146
147
418
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
418
  DEBUG_MSG (SUBSET, nullptr,
149
418
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
418
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
418
  bool needed = false;
157
418
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
418
  {
159
418
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
418
    needed = _hb_subset_table_try (table, &buf, &c);
161
418
  }
162
163
418
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
0
  {
165
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
0
    return false;
167
0
  }
168
169
418
  if (!needed)
170
0
  {
171
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
0
    return true;
173
0
  }
174
175
418
  bool result = false;
176
418
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
418
  if (dest_blob)
178
418
  {
179
418
    DEBUG_MSG (SUBSET, nullptr,
180
418
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
418
               HB_UNTAG (tag), dest_blob->length);
182
418
    result = plan->add_table (tag, dest_blob);
183
418
    hb_blob_destroy (dest_blob);
184
418
  }
185
186
418
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
418
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
418
  return result;
189
418
}
hb-subset-table-layout.cc:bool _hb_subset_table<OT::GDEF const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
9.75k
{
135
9.75k
  auto &&source_blob = plan->source_table<TableType> ();
136
9.75k
  auto *table = source_blob.get ();
137
138
9.75k
  hb_tag_t tag = TableType::tableTag;
139
9.75k
  hb_blob_t *blob = source_blob.get_blob();
140
9.75k
  if (unlikely (!blob || !blob->data))
141
2.22k
  {
142
2.22k
    DEBUG_MSG (SUBSET, nullptr,
143
2.22k
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
2.22k
    return false;
145
2.22k
  }
146
147
7.52k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
7.52k
  DEBUG_MSG (SUBSET, nullptr,
149
7.52k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
7.52k
  if (unlikely (!buf.alloc (buf_size)))
151
2
  {
152
2
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
2
    return false;
154
2
  }
155
156
7.52k
  bool needed = false;
157
7.52k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
7.52k
  {
159
7.52k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
7.52k
    needed = _hb_subset_table_try (table, &buf, &c);
161
7.52k
  }
162
163
7.52k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
54
  {
165
54
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
54
    return false;
167
54
  }
168
169
7.46k
  if (!needed)
170
3.88k
  {
171
3.88k
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
3.88k
    return true;
173
3.88k
  }
174
175
3.58k
  bool result = false;
176
3.58k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
3.58k
  if (dest_blob)
178
3.33k
  {
179
3.33k
    DEBUG_MSG (SUBSET, nullptr,
180
3.33k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
3.33k
               HB_UNTAG (tag), dest_blob->length);
182
3.33k
    result = plan->add_table (tag, dest_blob);
183
3.33k
    hb_blob_destroy (dest_blob);
184
3.33k
  }
185
186
3.58k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
3.58k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
3.58k
  return result;
189
7.46k
}
hb-subset-table-layout.cc:bool _hb_subset_table<OT::Layout::GSUB const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
14.3k
{
135
14.3k
  auto &&source_blob = plan->source_table<TableType> ();
136
14.3k
  auto *table = source_blob.get ();
137
138
14.3k
  hb_tag_t tag = TableType::tableTag;
139
14.3k
  hb_blob_t *blob = source_blob.get_blob();
140
14.3k
  if (unlikely (!blob || !blob->data))
141
2.72k
  {
142
2.72k
    DEBUG_MSG (SUBSET, nullptr,
143
2.72k
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
2.72k
    return false;
145
2.72k
  }
146
147
11.6k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
11.6k
  DEBUG_MSG (SUBSET, nullptr,
149
11.6k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
11.6k
  if (unlikely (!buf.alloc (buf_size)))
151
8
  {
152
8
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
8
    return false;
154
8
  }
155
156
11.6k
  bool needed = false;
157
11.6k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
11.6k
  {
159
11.6k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
11.6k
    needed = _hb_subset_table_try (table, &buf, &c);
161
11.6k
  }
162
163
11.6k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
85
  {
165
85
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
85
    return false;
167
85
  }
168
169
11.5k
  if (!needed)
170
0
  {
171
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
0
    return true;
173
0
  }
174
175
11.5k
  bool result = false;
176
11.5k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
11.5k
  if (dest_blob)
178
10.7k
  {
179
10.7k
    DEBUG_MSG (SUBSET, nullptr,
180
10.7k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
10.7k
               HB_UNTAG (tag), dest_blob->length);
182
10.7k
    result = plan->add_table (tag, dest_blob);
183
10.7k
    hb_blob_destroy (dest_blob);
184
10.7k
  }
185
186
11.5k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
11.5k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
11.5k
  return result;
189
11.5k
}
hb-subset-table-layout.cc:bool _hb_subset_table<OT::Layout::GPOS const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
10.9k
{
135
10.9k
  auto &&source_blob = plan->source_table<TableType> ();
136
10.9k
  auto *table = source_blob.get ();
137
138
10.9k
  hb_tag_t tag = TableType::tableTag;
139
10.9k
  hb_blob_t *blob = source_blob.get_blob();
140
10.9k
  if (unlikely (!blob || !blob->data))
141
4.15k
  {
142
4.15k
    DEBUG_MSG (SUBSET, nullptr,
143
4.15k
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
4.15k
    return false;
145
4.15k
  }
146
147
6.79k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
6.79k
  DEBUG_MSG (SUBSET, nullptr,
149
6.79k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
6.79k
  if (unlikely (!buf.alloc (buf_size)))
151
1
  {
152
1
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
1
    return false;
154
1
  }
155
156
6.79k
  bool needed = false;
157
6.79k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
6.79k
  {
159
6.79k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
6.79k
    needed = _hb_subset_table_try (table, &buf, &c);
161
6.79k
  }
162
163
6.79k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
27
  {
165
27
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
27
    return false;
167
27
  }
168
169
6.77k
  if (!needed)
170
0
  {
171
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
0
    return true;
173
0
  }
174
175
6.77k
  bool result = false;
176
6.77k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
6.77k
  if (dest_blob)
178
6.72k
  {
179
6.72k
    DEBUG_MSG (SUBSET, nullptr,
180
6.72k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
6.72k
               HB_UNTAG (tag), dest_blob->length);
182
6.72k
    result = plan->add_table (tag, dest_blob);
183
6.72k
    hb_blob_destroy (dest_blob);
184
6.72k
  }
185
186
6.77k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
6.77k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
6.77k
  return result;
189
6.77k
}
hb-subset-table-layout.cc:bool _hb_subset_table<OT::BASE const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
1.28k
{
135
1.28k
  auto &&source_blob = plan->source_table<TableType> ();
136
1.28k
  auto *table = source_blob.get ();
137
138
1.28k
  hb_tag_t tag = TableType::tableTag;
139
1.28k
  hb_blob_t *blob = source_blob.get_blob();
140
1.28k
  if (unlikely (!blob || !blob->data))
141
622
  {
142
622
    DEBUG_MSG (SUBSET, nullptr,
143
622
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
622
    return false;
145
622
  }
146
147
659
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
659
  DEBUG_MSG (SUBSET, nullptr,
149
659
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
659
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
659
  bool needed = false;
157
659
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
659
  {
159
659
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
659
    needed = _hb_subset_table_try (table, &buf, &c);
161
659
  }
162
163
659
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
23
  {
165
23
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
23
    return false;
167
23
  }
168
169
636
  if (!needed)
170
96
  {
171
96
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
96
    return true;
173
96
  }
174
175
540
  bool result = false;
176
540
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
540
  if (dest_blob)
178
536
  {
179
536
    DEBUG_MSG (SUBSET, nullptr,
180
536
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
536
               HB_UNTAG (tag), dest_blob->length);
182
536
    result = plan->add_table (tag, dest_blob);
183
536
    hb_blob_destroy (dest_blob);
184
536
  }
185
186
540
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
540
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
540
  return result;
189
636
}
hb-subset-table-layout.cc:bool _hb_subset_table<OT::MATH const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
1.14k
{
135
1.14k
  auto &&source_blob = plan->source_table<TableType> ();
136
1.14k
  auto *table = source_blob.get ();
137
138
1.14k
  hb_tag_t tag = TableType::tableTag;
139
1.14k
  hb_blob_t *blob = source_blob.get_blob();
140
1.14k
  if (unlikely (!blob || !blob->data))
141
241
  {
142
241
    DEBUG_MSG (SUBSET, nullptr,
143
241
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
241
    return false;
145
241
  }
146
147
906
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
906
  DEBUG_MSG (SUBSET, nullptr,
149
906
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
906
  if (unlikely (!buf.alloc (buf_size)))
151
1
  {
152
1
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
1
    return false;
154
1
  }
155
156
905
  bool needed = false;
157
905
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
905
  {
159
905
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
905
    needed = _hb_subset_table_try (table, &buf, &c);
161
905
  }
162
163
905
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
199
  {
165
199
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
199
    return false;
167
199
  }
168
169
706
  if (!needed)
170
0
  {
171
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
0
    return true;
173
0
  }
174
175
706
  bool result = false;
176
706
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
706
  if (dest_blob)
178
635
  {
179
635
    DEBUG_MSG (SUBSET, nullptr,
180
635
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
635
               HB_UNTAG (tag), dest_blob->length);
182
635
    result = plan->add_table (tag, dest_blob);
183
635
    hb_blob_destroy (dest_blob);
184
635
  }
185
186
706
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
706
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
706
  return result;
189
706
}
hb-subset-table-var.cc:bool _hb_subset_table<OT::HVAR const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
3.38k
{
135
3.38k
  auto &&source_blob = plan->source_table<TableType> ();
136
3.38k
  auto *table = source_blob.get ();
137
138
3.38k
  hb_tag_t tag = TableType::tableTag;
139
3.38k
  hb_blob_t *blob = source_blob.get_blob();
140
3.38k
  if (unlikely (!blob || !blob->data))
141
1.61k
  {
142
1.61k
    DEBUG_MSG (SUBSET, nullptr,
143
1.61k
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
1.61k
    return false;
145
1.61k
  }
146
147
1.76k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
1.76k
  DEBUG_MSG (SUBSET, nullptr,
149
1.76k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
1.76k
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
1.76k
  bool needed = false;
157
1.76k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
1.76k
  {
159
1.76k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
1.76k
    needed = _hb_subset_table_try (table, &buf, &c);
161
1.76k
  }
162
163
1.76k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
24
  {
165
24
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
24
    return false;
167
24
  }
168
169
1.74k
  if (!needed)
170
369
  {
171
369
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
369
    return true;
173
369
  }
174
175
1.37k
  bool result = false;
176
1.37k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
1.37k
  if (dest_blob)
178
1.37k
  {
179
1.37k
    DEBUG_MSG (SUBSET, nullptr,
180
1.37k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
1.37k
               HB_UNTAG (tag), dest_blob->length);
182
1.37k
    result = plan->add_table (tag, dest_blob);
183
1.37k
    hb_blob_destroy (dest_blob);
184
1.37k
  }
185
186
1.37k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
1.37k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
1.37k
  return result;
189
1.74k
}
hb-subset-table-var.cc:bool _hb_subset_table<OT::VVAR const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
231
{
135
231
  auto &&source_blob = plan->source_table<TableType> ();
136
231
  auto *table = source_blob.get ();
137
138
231
  hb_tag_t tag = TableType::tableTag;
139
231
  hb_blob_t *blob = source_blob.get_blob();
140
231
  if (unlikely (!blob || !blob->data))
141
119
  {
142
119
    DEBUG_MSG (SUBSET, nullptr,
143
119
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
119
    return false;
145
119
  }
146
147
112
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
112
  DEBUG_MSG (SUBSET, nullptr,
149
112
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
112
  if (unlikely (!buf.alloc (buf_size)))
151
2
  {
152
2
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
2
    return false;
154
2
  }
155
156
110
  bool needed = false;
157
110
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
110
  {
159
110
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
110
    needed = _hb_subset_table_try (table, &buf, &c);
161
110
  }
162
163
110
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
2
  {
165
2
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
2
    return false;
167
2
  }
168
169
108
  if (!needed)
170
15
  {
171
15
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
15
    return true;
173
15
  }
174
175
93
  bool result = false;
176
93
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
93
  if (dest_blob)
178
93
  {
179
93
    DEBUG_MSG (SUBSET, nullptr,
180
93
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
93
               HB_UNTAG (tag), dest_blob->length);
182
93
    result = plan->add_table (tag, dest_blob);
183
93
    hb_blob_destroy (dest_blob);
184
93
  }
185
186
93
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
93
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
93
  return result;
189
108
}
hb-subset-table-var.cc:bool _hb_subset_table<OT::gvar const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
1.60k
{
135
1.60k
  auto &&source_blob = plan->source_table<TableType> ();
136
1.60k
  auto *table = source_blob.get ();
137
138
1.60k
  hb_tag_t tag = TableType::tableTag;
139
1.60k
  hb_blob_t *blob = source_blob.get_blob();
140
1.60k
  if (unlikely (!blob || !blob->data))
141
743
  {
142
743
    DEBUG_MSG (SUBSET, nullptr,
143
743
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
743
    return false;
145
743
  }
146
147
858
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
858
  DEBUG_MSG (SUBSET, nullptr,
149
858
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
858
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
858
  bool needed = false;
157
858
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
858
  {
159
858
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
858
    needed = _hb_subset_table_try (table, &buf, &c);
161
858
  }
162
163
858
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
0
  {
165
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
0
    return false;
167
0
  }
168
169
858
  if (!needed)
170
377
  {
171
377
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
377
    return true;
173
377
  }
174
175
481
  bool result = false;
176
481
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
481
  if (dest_blob)
178
481
  {
179
481
    DEBUG_MSG (SUBSET, nullptr,
180
481
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
481
               HB_UNTAG (tag), dest_blob->length);
182
481
    result = plan->add_table (tag, dest_blob);
183
481
    hb_blob_destroy (dest_blob);
184
481
  }
185
186
481
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
481
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
481
  return result;
189
858
}
hb-subset-table-var.cc:bool _hb_subset_table<OT::GVAR const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
643
{
135
643
  auto &&source_blob = plan->source_table<TableType> ();
136
643
  auto *table = source_blob.get ();
137
138
643
  hb_tag_t tag = TableType::tableTag;
139
643
  hb_blob_t *blob = source_blob.get_blob();
140
643
  if (unlikely (!blob || !blob->data))
141
61
  {
142
61
    DEBUG_MSG (SUBSET, nullptr,
143
61
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
61
    return false;
145
61
  }
146
147
582
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
582
  DEBUG_MSG (SUBSET, nullptr,
149
582
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
582
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
582
  bool needed = false;
157
582
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
582
  {
159
582
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
582
    needed = _hb_subset_table_try (table, &buf, &c);
161
582
  }
162
163
582
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
47
  {
165
47
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
47
    return false;
167
47
  }
168
169
535
  if (!needed)
170
276
  {
171
276
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
276
    return true;
173
276
  }
174
175
259
  bool result = false;
176
259
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
259
  if (dest_blob)
178
259
  {
179
259
    DEBUG_MSG (SUBSET, nullptr,
180
259
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
259
               HB_UNTAG (tag), dest_blob->length);
182
259
    result = plan->add_table (tag, dest_blob);
183
259
    hb_blob_destroy (dest_blob);
184
259
  }
185
186
259
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
259
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
259
  return result;
189
535
}
hb-subset-table-var.cc:bool _hb_subset_table<OT::VARC const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
569
{
135
569
  auto &&source_blob = plan->source_table<TableType> ();
136
569
  auto *table = source_blob.get ();
137
138
569
  hb_tag_t tag = TableType::tableTag;
139
569
  hb_blob_t *blob = source_blob.get_blob();
140
569
  if (unlikely (!blob || !blob->data))
141
146
  {
142
146
    DEBUG_MSG (SUBSET, nullptr,
143
146
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
146
    return false;
145
146
  }
146
147
423
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
423
  DEBUG_MSG (SUBSET, nullptr,
149
423
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
423
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
423
  bool needed = false;
157
423
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
423
  {
159
423
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
423
    needed = _hb_subset_table_try (table, &buf, &c);
161
423
  }
162
163
423
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
139
  {
165
139
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
139
    return false;
167
139
  }
168
169
284
  if (!needed)
170
164
  {
171
164
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
164
    return true;
173
164
  }
174
175
120
  bool result = false;
176
120
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
120
  if (dest_blob)
178
120
  {
179
120
    DEBUG_MSG (SUBSET, nullptr,
180
120
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
120
               HB_UNTAG (tag), dest_blob->length);
182
120
    result = plan->add_table (tag, dest_blob);
183
120
    hb_blob_destroy (dest_blob);
184
120
  }
185
186
120
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
120
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
120
  return result;
189
284
}
hb-subset-table-var.cc:bool _hb_subset_table<OT::fvar const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
1.67k
{
135
1.67k
  auto &&source_blob = plan->source_table<TableType> ();
136
1.67k
  auto *table = source_blob.get ();
137
138
1.67k
  hb_tag_t tag = TableType::tableTag;
139
1.67k
  hb_blob_t *blob = source_blob.get_blob();
140
1.67k
  if (unlikely (!blob || !blob->data))
141
0
  {
142
0
    DEBUG_MSG (SUBSET, nullptr,
143
0
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
0
    return false;
145
0
  }
146
147
1.67k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
1.67k
  DEBUG_MSG (SUBSET, nullptr,
149
1.67k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
1.67k
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
1.67k
  bool needed = false;
157
1.67k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
1.67k
  {
159
1.67k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
1.67k
    needed = _hb_subset_table_try (table, &buf, &c);
161
1.67k
  }
162
163
1.67k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
0
  {
165
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
0
    return false;
167
0
  }
168
169
1.67k
  if (!needed)
170
0
  {
171
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
0
    return true;
173
0
  }
174
175
1.67k
  bool result = false;
176
1.67k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
1.67k
  if (dest_blob)
178
1.67k
  {
179
1.67k
    DEBUG_MSG (SUBSET, nullptr,
180
1.67k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
1.67k
               HB_UNTAG (tag), dest_blob->length);
182
1.67k
    result = plan->add_table (tag, dest_blob);
183
1.67k
    hb_blob_destroy (dest_blob);
184
1.67k
  }
185
186
1.67k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
1.67k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
1.67k
  return result;
189
1.67k
}
hb-subset-table-var.cc:bool _hb_subset_table<OT::avar const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
374
{
135
374
  auto &&source_blob = plan->source_table<TableType> ();
136
374
  auto *table = source_blob.get ();
137
138
374
  hb_tag_t tag = TableType::tableTag;
139
374
  hb_blob_t *blob = source_blob.get_blob();
140
374
  if (unlikely (!blob || !blob->data))
141
40
  {
142
40
    DEBUG_MSG (SUBSET, nullptr,
143
40
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
40
    return false;
145
40
  }
146
147
334
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
334
  DEBUG_MSG (SUBSET, nullptr,
149
334
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
334
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
334
  bool needed = false;
157
334
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
334
  {
159
334
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
334
    needed = _hb_subset_table_try (table, &buf, &c);
161
334
  }
162
163
334
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
0
  {
165
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
0
    return false;
167
0
  }
168
169
334
  if (!needed)
170
180
  {
171
180
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
180
    return true;
173
180
  }
174
175
154
  bool result = false;
176
154
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
154
  if (dest_blob)
178
154
  {
179
154
    DEBUG_MSG (SUBSET, nullptr,
180
154
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
154
               HB_UNTAG (tag), dest_blob->length);
182
154
    result = plan->add_table (tag, dest_blob);
183
154
    hb_blob_destroy (dest_blob);
184
154
  }
185
186
154
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
154
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
154
  return result;
189
334
}
hb-subset-table-var.cc:bool _hb_subset_table<OT::cvar const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
358
{
135
358
  auto &&source_blob = plan->source_table<TableType> ();
136
358
  auto *table = source_blob.get ();
137
138
358
  hb_tag_t tag = TableType::tableTag;
139
358
  hb_blob_t *blob = source_blob.get_blob();
140
358
  if (unlikely (!blob || !blob->data))
141
3
  {
142
3
    DEBUG_MSG (SUBSET, nullptr,
143
3
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
3
    return false;
145
3
  }
146
147
355
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
355
  DEBUG_MSG (SUBSET, nullptr,
149
355
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
355
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
355
  bool needed = false;
157
355
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
355
  {
159
355
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
355
    needed = _hb_subset_table_try (table, &buf, &c);
161
355
  }
162
163
355
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
0
  {
165
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
0
    return false;
167
0
  }
168
169
355
  if (!needed)
170
182
  {
171
182
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
182
    return true;
173
182
  }
174
175
173
  bool result = false;
176
173
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
173
  if (dest_blob)
178
173
  {
179
173
    DEBUG_MSG (SUBSET, nullptr,
180
173
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
173
               HB_UNTAG (tag), dest_blob->length);
182
173
    result = plan->add_table (tag, dest_blob);
183
173
    hb_blob_destroy (dest_blob);
184
173
  }
185
186
173
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
173
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
173
  return result;
189
355
}
hb-subset-table-var.cc:bool _hb_subset_table<OT::MVAR const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
608
{
135
608
  auto &&source_blob = plan->source_table<TableType> ();
136
608
  auto *table = source_blob.get ();
137
138
608
  hb_tag_t tag = TableType::tableTag;
139
608
  hb_blob_t *blob = source_blob.get_blob();
140
608
  if (unlikely (!blob || !blob->data))
141
55
  {
142
55
    DEBUG_MSG (SUBSET, nullptr,
143
55
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
55
    return false;
145
55
  }
146
147
553
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
553
  DEBUG_MSG (SUBSET, nullptr,
149
553
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
553
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
553
  bool needed = false;
157
553
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
553
  {
159
553
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
553
    needed = _hb_subset_table_try (table, &buf, &c);
161
553
  }
162
163
553
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
0
  {
165
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
0
    return false;
167
0
  }
168
169
553
  if (!needed)
170
399
  {
171
399
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
399
    return true;
173
399
  }
174
175
154
  bool result = false;
176
154
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
154
  if (dest_blob)
178
154
  {
179
154
    DEBUG_MSG (SUBSET, nullptr,
180
154
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
154
               HB_UNTAG (tag), dest_blob->length);
182
154
    result = plan->add_table (tag, dest_blob);
183
154
    hb_blob_destroy (dest_blob);
184
154
  }
185
186
154
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
154
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
154
  return result;
189
553
}
hb-subset-table-cff.cc:bool _hb_subset_table<OT::cff1 const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
3.67k
{
135
3.67k
  auto &&source_blob = plan->source_table<TableType> ();
136
3.67k
  auto *table = source_blob.get ();
137
138
3.67k
  hb_tag_t tag = TableType::tableTag;
139
3.67k
  hb_blob_t *blob = source_blob.get_blob();
140
3.67k
  if (unlikely (!blob || !blob->data))
141
862
  {
142
862
    DEBUG_MSG (SUBSET, nullptr,
143
862
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
862
    return false;
145
862
  }
146
147
2.81k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
2.81k
  DEBUG_MSG (SUBSET, nullptr,
149
2.81k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
2.81k
  if (unlikely (!buf.alloc (buf_size)))
151
4
  {
152
4
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
4
    return false;
154
4
  }
155
156
2.81k
  bool needed = false;
157
2.81k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
2.81k
  {
159
2.81k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
2.81k
    needed = _hb_subset_table_try (table, &buf, &c);
161
2.81k
  }
162
163
2.81k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
1.56k
  {
165
1.56k
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
1.56k
    return false;
167
1.56k
  }
168
169
1.25k
  if (!needed)
170
3
  {
171
3
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
3
    return true;
173
3
  }
174
175
1.24k
  bool result = false;
176
1.24k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
1.24k
  if (dest_blob)
178
1.24k
  {
179
1.24k
    DEBUG_MSG (SUBSET, nullptr,
180
1.24k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
1.24k
               HB_UNTAG (tag), dest_blob->length);
182
1.24k
    result = plan->add_table (tag, dest_blob);
183
1.24k
    hb_blob_destroy (dest_blob);
184
1.24k
  }
185
186
1.24k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
1.24k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
1.24k
  return result;
189
1.25k
}
hb-subset-table-cff.cc:bool _hb_subset_table<OT::cff2 const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
4.31k
{
135
4.31k
  auto &&source_blob = plan->source_table<TableType> ();
136
4.31k
  auto *table = source_blob.get ();
137
138
4.31k
  hb_tag_t tag = TableType::tableTag;
139
4.31k
  hb_blob_t *blob = source_blob.get_blob();
140
4.31k
  if (unlikely (!blob || !blob->data))
141
1.00k
  {
142
1.00k
    DEBUG_MSG (SUBSET, nullptr,
143
1.00k
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
1.00k
    return false;
145
1.00k
  }
146
147
3.30k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
3.30k
  DEBUG_MSG (SUBSET, nullptr,
149
3.30k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
3.30k
  if (unlikely (!buf.alloc (buf_size)))
151
2
  {
152
2
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
2
    return false;
154
2
  }
155
156
3.30k
  bool needed = false;
157
3.30k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
3.30k
  {
159
3.30k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
3.30k
    needed = _hb_subset_table_try (table, &buf, &c);
161
3.30k
  }
162
163
3.30k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
1.06k
  {
165
1.06k
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
1.06k
    return false;
167
1.06k
  }
168
169
2.23k
  if (!needed)
170
336
  {
171
336
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
336
    return true;
173
336
  }
174
175
1.90k
  bool result = false;
176
1.90k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
1.90k
  if (dest_blob)
178
1.90k
  {
179
1.90k
    DEBUG_MSG (SUBSET, nullptr,
180
1.90k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
1.90k
               HB_UNTAG (tag), dest_blob->length);
182
1.90k
    result = plan->add_table (tag, dest_blob);
183
1.90k
    hb_blob_destroy (dest_blob);
184
1.90k
  }
185
186
1.90k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
1.90k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
1.90k
  return result;
189
2.23k
}
hb-subset-table-cff.cc:bool _hb_subset_table<OT::VORG const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
235
{
135
235
  auto &&source_blob = plan->source_table<TableType> ();
136
235
  auto *table = source_blob.get ();
137
138
235
  hb_tag_t tag = TableType::tableTag;
139
235
  hb_blob_t *blob = source_blob.get_blob();
140
235
  if (unlikely (!blob || !blob->data))
141
46
  {
142
46
    DEBUG_MSG (SUBSET, nullptr,
143
46
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
46
    return false;
145
46
  }
146
147
189
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
189
  DEBUG_MSG (SUBSET, nullptr,
149
189
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
189
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
189
  bool needed = false;
157
189
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
189
  {
159
189
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
189
    needed = _hb_subset_table_try (table, &buf, &c);
161
189
  }
162
163
189
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
1
  {
165
1
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
1
    return false;
167
1
  }
168
169
188
  if (!needed)
170
0
  {
171
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
0
    return true;
173
0
  }
174
175
188
  bool result = false;
176
188
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
188
  if (dest_blob)
178
188
  {
179
188
    DEBUG_MSG (SUBSET, nullptr,
180
188
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
188
               HB_UNTAG (tag), dest_blob->length);
182
188
    result = plan->add_table (tag, dest_blob);
183
188
    hb_blob_destroy (dest_blob);
184
188
  }
185
186
188
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
188
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
188
  return result;
189
188
}
hb-subset-table-color.cc:bool _hb_subset_table<OT::sbix const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
232
{
135
232
  auto &&source_blob = plan->source_table<TableType> ();
136
232
  auto *table = source_blob.get ();
137
138
232
  hb_tag_t tag = TableType::tableTag;
139
232
  hb_blob_t *blob = source_blob.get_blob();
140
232
  if (unlikely (!blob || !blob->data))
141
44
  {
142
44
    DEBUG_MSG (SUBSET, nullptr,
143
44
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
44
    return false;
145
44
  }
146
147
188
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
188
  DEBUG_MSG (SUBSET, nullptr,
149
188
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
188
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
188
  bool needed = false;
157
188
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
188
  {
159
188
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
188
    needed = _hb_subset_table_try (table, &buf, &c);
161
188
  }
162
163
188
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
0
  {
165
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
0
    return false;
167
0
  }
168
169
188
  if (!needed)
170
0
  {
171
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
0
    return true;
173
0
  }
174
175
188
  bool result = false;
176
188
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
188
  if (dest_blob)
178
188
  {
179
188
    DEBUG_MSG (SUBSET, nullptr,
180
188
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
188
               HB_UNTAG (tag), dest_blob->length);
182
188
    result = plan->add_table (tag, dest_blob);
183
188
    hb_blob_destroy (dest_blob);
184
188
  }
185
186
188
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
188
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
188
  return result;
189
188
}
hb-subset-table-color.cc:bool _hb_subset_table<OT::COLR const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
6.34k
{
135
6.34k
  auto &&source_blob = plan->source_table<TableType> ();
136
6.34k
  auto *table = source_blob.get ();
137
138
6.34k
  hb_tag_t tag = TableType::tableTag;
139
6.34k
  hb_blob_t *blob = source_blob.get_blob();
140
6.34k
  if (unlikely (!blob || !blob->data))
141
644
  {
142
644
    DEBUG_MSG (SUBSET, nullptr,
143
644
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
644
    return false;
145
644
  }
146
147
5.70k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
5.70k
  DEBUG_MSG (SUBSET, nullptr,
149
5.70k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
5.70k
  if (unlikely (!buf.alloc (buf_size)))
151
3
  {
152
3
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
3
    return false;
154
3
  }
155
156
5.70k
  bool needed = false;
157
5.70k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
5.70k
  {
159
5.70k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
5.70k
    needed = _hb_subset_table_try (table, &buf, &c);
161
5.70k
  }
162
163
5.70k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
555
  {
165
555
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
555
    return false;
167
555
  }
168
169
5.14k
  if (!needed)
170
3.24k
  {
171
3.24k
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
3.24k
    return true;
173
3.24k
  }
174
175
1.90k
  bool result = false;
176
1.90k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
1.90k
  if (dest_blob)
178
1.90k
  {
179
1.90k
    DEBUG_MSG (SUBSET, nullptr,
180
1.90k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
1.90k
               HB_UNTAG (tag), dest_blob->length);
182
1.90k
    result = plan->add_table (tag, dest_blob);
183
1.90k
    hb_blob_destroy (dest_blob);
184
1.90k
  }
185
186
1.90k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
1.90k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
1.90k
  return result;
189
5.14k
}
hb-subset-table-color.cc:bool _hb_subset_table<OT::CPAL const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
1.70k
{
135
1.70k
  auto &&source_blob = plan->source_table<TableType> ();
136
1.70k
  auto *table = source_blob.get ();
137
138
1.70k
  hb_tag_t tag = TableType::tableTag;
139
1.70k
  hb_blob_t *blob = source_blob.get_blob();
140
1.70k
  if (unlikely (!blob || !blob->data))
141
293
  {
142
293
    DEBUG_MSG (SUBSET, nullptr,
143
293
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
293
    return false;
145
293
  }
146
147
1.41k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
1.41k
  DEBUG_MSG (SUBSET, nullptr,
149
1.41k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
1.41k
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
1.41k
  bool needed = false;
157
1.41k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
1.41k
  {
159
1.41k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
1.41k
    needed = _hb_subset_table_try (table, &buf, &c);
161
1.41k
  }
162
163
1.41k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
15
  {
165
15
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
15
    return false;
167
15
  }
168
169
1.39k
  if (!needed)
170
225
  {
171
225
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
225
    return true;
173
225
  }
174
175
1.17k
  bool result = false;
176
1.17k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
1.17k
  if (dest_blob)
178
1.17k
  {
179
1.17k
    DEBUG_MSG (SUBSET, nullptr,
180
1.17k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
1.17k
               HB_UNTAG (tag), dest_blob->length);
182
1.17k
    result = plan->add_table (tag, dest_blob);
183
1.17k
    hb_blob_destroy (dest_blob);
184
1.17k
  }
185
186
1.17k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
1.17k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
1.17k
  return result;
189
1.39k
}
hb-subset-table-color.cc:bool _hb_subset_table<OT::CBLC const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
404
{
135
404
  auto &&source_blob = plan->source_table<TableType> ();
136
404
  auto *table = source_blob.get ();
137
138
404
  hb_tag_t tag = TableType::tableTag;
139
404
  hb_blob_t *blob = source_blob.get_blob();
140
404
  if (unlikely (!blob || !blob->data))
141
147
  {
142
147
    DEBUG_MSG (SUBSET, nullptr,
143
147
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
147
    return false;
145
147
  }
146
147
257
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
257
  DEBUG_MSG (SUBSET, nullptr,
149
257
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
257
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
257
  bool needed = false;
157
257
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
257
  {
159
257
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
257
    needed = _hb_subset_table_try (table, &buf, &c);
161
257
  }
162
163
257
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
2
  {
165
2
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
2
    return false;
167
2
  }
168
169
255
  if (!needed)
170
31
  {
171
31
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
31
    return true;
173
31
  }
174
175
224
  bool result = false;
176
224
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
224
  if (dest_blob)
178
224
  {
179
224
    DEBUG_MSG (SUBSET, nullptr,
180
224
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
224
               HB_UNTAG (tag), dest_blob->length);
182
224
    result = plan->add_table (tag, dest_blob);
183
224
    hb_blob_destroy (dest_blob);
184
224
  }
185
186
224
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
224
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
224
  return result;
189
255
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::glyf const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
5.36k
{
135
5.36k
  auto &&source_blob = plan->source_table<TableType> ();
136
5.36k
  auto *table = source_blob.get ();
137
138
5.36k
  hb_tag_t tag = TableType::tableTag;
139
5.36k
  hb_blob_t *blob = source_blob.get_blob();
140
5.36k
  if (unlikely (!blob || !blob->data))
141
340
  {
142
340
    DEBUG_MSG (SUBSET, nullptr,
143
340
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
340
    return false;
145
340
  }
146
147
5.02k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
5.02k
  DEBUG_MSG (SUBSET, nullptr,
149
5.02k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
5.02k
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
5.02k
  bool needed = false;
157
5.02k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
5.02k
  {
159
5.02k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
5.02k
    needed = _hb_subset_table_try (table, &buf, &c);
161
5.02k
  }
162
163
5.02k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
1.06k
  {
165
1.06k
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
1.06k
    return false;
167
1.06k
  }
168
169
3.96k
  if (!needed)
170
597
  {
171
597
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
597
    return true;
173
597
  }
174
175
3.37k
  bool result = false;
176
3.37k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
3.37k
  if (dest_blob)
178
3.37k
  {
179
3.37k
    DEBUG_MSG (SUBSET, nullptr,
180
3.37k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
3.37k
               HB_UNTAG (tag), dest_blob->length);
182
3.37k
    result = plan->add_table (tag, dest_blob);
183
3.37k
    hb_blob_destroy (dest_blob);
184
3.37k
  }
185
186
3.37k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
3.37k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
3.37k
  return result;
189
3.96k
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::hdmx const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
117
{
135
117
  auto &&source_blob = plan->source_table<TableType> ();
136
117
  auto *table = source_blob.get ();
137
138
117
  hb_tag_t tag = TableType::tableTag;
139
117
  hb_blob_t *blob = source_blob.get_blob();
140
117
  if (unlikely (!blob || !blob->data))
141
30
  {
142
30
    DEBUG_MSG (SUBSET, nullptr,
143
30
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
30
    return false;
145
30
  }
146
147
87
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
87
  DEBUG_MSG (SUBSET, nullptr,
149
87
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
87
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
87
  bool needed = false;
157
87
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
87
  {
159
87
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
87
    needed = _hb_subset_table_try (table, &buf, &c);
161
87
  }
162
163
87
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
19
  {
165
19
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
19
    return false;
167
19
  }
168
169
68
  if (!needed)
170
0
  {
171
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
0
    return true;
173
0
  }
174
175
68
  bool result = false;
176
68
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
68
  if (dest_blob)
178
68
  {
179
68
    DEBUG_MSG (SUBSET, nullptr,
180
68
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
68
               HB_UNTAG (tag), dest_blob->length);
182
68
    result = plan->add_table (tag, dest_blob);
183
68
    hb_blob_destroy (dest_blob);
184
68
  }
185
186
68
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
68
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
68
  return result;
189
68
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::name const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
4.36k
{
135
4.36k
  auto &&source_blob = plan->source_table<TableType> ();
136
4.36k
  auto *table = source_blob.get ();
137
138
4.36k
  hb_tag_t tag = TableType::tableTag;
139
4.36k
  hb_blob_t *blob = source_blob.get_blob();
140
4.36k
  if (unlikely (!blob || !blob->data))
141
1.78k
  {
142
1.78k
    DEBUG_MSG (SUBSET, nullptr,
143
1.78k
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
1.78k
    return false;
145
1.78k
  }
146
147
2.58k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
2.58k
  DEBUG_MSG (SUBSET, nullptr,
149
2.58k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
2.58k
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
2.58k
  bool needed = false;
157
2.58k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
2.58k
  {
159
2.58k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
2.58k
    needed = _hb_subset_table_try (table, &buf, &c);
161
2.58k
  }
162
163
2.58k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
4
  {
165
4
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
4
    return false;
167
4
  }
168
169
2.57k
  if (!needed)
170
1
  {
171
1
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
1
    return true;
173
1
  }
174
175
2.57k
  bool result = false;
176
2.57k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
2.57k
  if (dest_blob)
178
2.57k
  {
179
2.57k
    DEBUG_MSG (SUBSET, nullptr,
180
2.57k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
2.57k
               HB_UNTAG (tag), dest_blob->length);
182
2.57k
    result = plan->add_table (tag, dest_blob);
183
2.57k
    hb_blob_destroy (dest_blob);
184
2.57k
  }
185
186
2.57k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
2.57k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
2.57k
  return result;
189
2.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
134
5.15k
{
135
5.15k
  auto &&source_blob = plan->source_table<TableType> ();
136
5.15k
  auto *table = source_blob.get ();
137
138
5.15k
  hb_tag_t tag = TableType::tableTag;
139
5.15k
  hb_blob_t *blob = source_blob.get_blob();
140
5.15k
  if (unlikely (!blob || !blob->data))
141
342
  {
142
342
    DEBUG_MSG (SUBSET, nullptr,
143
342
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
342
    return false;
145
342
  }
146
147
4.81k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
4.81k
  DEBUG_MSG (SUBSET, nullptr,
149
4.81k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
4.81k
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
4.81k
  bool needed = false;
157
4.81k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
4.81k
  {
159
4.81k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
4.81k
    needed = _hb_subset_table_try (table, &buf, &c);
161
4.81k
  }
162
163
4.81k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
301
  {
165
301
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
301
    return false;
167
301
  }
168
169
4.51k
  if (!needed)
170
815
  {
171
815
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
815
    return true;
173
815
  }
174
175
3.69k
  bool result = false;
176
3.69k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
3.69k
  if (dest_blob)
178
3.69k
  {
179
3.69k
    DEBUG_MSG (SUBSET, nullptr,
180
3.69k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
3.69k
               HB_UNTAG (tag), dest_blob->length);
182
3.69k
    result = plan->add_table (tag, dest_blob);
183
3.69k
    hb_blob_destroy (dest_blob);
184
3.69k
  }
185
186
3.69k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
3.69k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
3.69k
  return result;
189
4.51k
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::vmtx const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
715
{
135
715
  auto &&source_blob = plan->source_table<TableType> ();
136
715
  auto *table = source_blob.get ();
137
138
715
  hb_tag_t tag = TableType::tableTag;
139
715
  hb_blob_t *blob = source_blob.get_blob();
140
715
  if (unlikely (!blob || !blob->data))
141
48
  {
142
48
    DEBUG_MSG (SUBSET, nullptr,
143
48
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
48
    return false;
145
48
  }
146
147
667
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
667
  DEBUG_MSG (SUBSET, nullptr,
149
667
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
667
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
667
  bool needed = false;
157
667
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
667
  {
159
667
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
667
    needed = _hb_subset_table_try (table, &buf, &c);
161
667
  }
162
163
667
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
54
  {
165
54
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
54
    return false;
167
54
  }
168
169
613
  if (!needed)
170
492
  {
171
492
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
492
    return true;
173
492
  }
174
175
121
  bool result = false;
176
121
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
121
  if (dest_blob)
178
121
  {
179
121
    DEBUG_MSG (SUBSET, nullptr,
180
121
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
121
               HB_UNTAG (tag), dest_blob->length);
182
121
    result = plan->add_table (tag, dest_blob);
183
121
    hb_blob_destroy (dest_blob);
184
121
  }
185
186
121
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
121
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
121
  return result;
189
613
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::maxp const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
15.3k
{
135
15.3k
  auto &&source_blob = plan->source_table<TableType> ();
136
15.3k
  auto *table = source_blob.get ();
137
138
15.3k
  hb_tag_t tag = TableType::tableTag;
139
15.3k
  hb_blob_t *blob = source_blob.get_blob();
140
15.3k
  if (unlikely (!blob || !blob->data))
141
36
  {
142
36
    DEBUG_MSG (SUBSET, nullptr,
143
36
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
36
    return false;
145
36
  }
146
147
15.3k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
15.3k
  DEBUG_MSG (SUBSET, nullptr,
149
15.3k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
15.3k
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
15.3k
  bool needed = false;
157
15.3k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
15.3k
  {
159
15.3k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
15.3k
    needed = _hb_subset_table_try (table, &buf, &c);
161
15.3k
  }
162
163
15.3k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
21
  {
165
21
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
21
    return false;
167
21
  }
168
169
15.2k
  if (!needed)
170
0
  {
171
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
0
    return true;
173
0
  }
174
175
15.2k
  bool result = false;
176
15.2k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
15.2k
  if (dest_blob)
178
15.2k
  {
179
15.2k
    DEBUG_MSG (SUBSET, nullptr,
180
15.2k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
15.2k
               HB_UNTAG (tag), dest_blob->length);
182
15.2k
    result = plan->add_table (tag, dest_blob);
183
15.2k
    hb_blob_destroy (dest_blob);
184
15.2k
  }
185
186
15.2k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
15.2k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
15.2k
  return result;
189
15.2k
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::GLYF const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
22
{
135
22
  auto &&source_blob = plan->source_table<TableType> ();
136
22
  auto *table = source_blob.get ();
137
138
22
  hb_tag_t tag = TableType::tableTag;
139
22
  hb_blob_t *blob = source_blob.get_blob();
140
22
  if (unlikely (!blob || !blob->data))
141
4
  {
142
4
    DEBUG_MSG (SUBSET, nullptr,
143
4
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
4
    return false;
145
4
  }
146
147
18
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
18
  DEBUG_MSG (SUBSET, nullptr,
149
18
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
18
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
18
  bool needed = false;
157
18
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
18
  {
159
18
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
18
    needed = _hb_subset_table_try (table, &buf, &c);
161
18
  }
162
163
18
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
0
  {
165
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
0
    return false;
167
0
  }
168
169
18
  if (!needed)
170
18
  {
171
18
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
18
    return true;
173
18
  }
174
175
0
  bool result = false;
176
0
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
0
  if (dest_blob)
178
0
  {
179
0
    DEBUG_MSG (SUBSET, nullptr,
180
0
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
0
               HB_UNTAG (tag), dest_blob->length);
182
0
    result = plan->add_table (tag, dest_blob);
183
0
    hb_blob_destroy (dest_blob);
184
0
  }
185
186
0
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
0
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
0
  return result;
189
18
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::HMTX const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
114
{
135
114
  auto &&source_blob = plan->source_table<TableType> ();
136
114
  auto *table = source_blob.get ();
137
138
114
  hb_tag_t tag = TableType::tableTag;
139
114
  hb_blob_t *blob = source_blob.get_blob();
140
114
  if (unlikely (!blob || !blob->data))
141
3
  {
142
3
    DEBUG_MSG (SUBSET, nullptr,
143
3
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
3
    return false;
145
3
  }
146
147
111
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
111
  DEBUG_MSG (SUBSET, nullptr,
149
111
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
111
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
111
  bool needed = false;
157
111
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
111
  {
159
111
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
111
    needed = _hb_subset_table_try (table, &buf, &c);
161
111
  }
162
163
111
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
16
  {
165
16
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
16
    return false;
167
16
  }
168
169
95
  if (!needed)
170
95
  {
171
95
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
95
    return true;
173
95
  }
174
175
0
  bool result = false;
176
0
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
0
  if (dest_blob)
178
0
  {
179
0
    DEBUG_MSG (SUBSET, nullptr,
180
0
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
0
               HB_UNTAG (tag), dest_blob->length);
182
0
    result = plan->add_table (tag, dest_blob);
183
0
    hb_blob_destroy (dest_blob);
184
0
  }
185
186
0
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
0
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
0
  return result;
189
95
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::VMTX const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
140
{
135
140
  auto &&source_blob = plan->source_table<TableType> ();
136
140
  auto *table = source_blob.get ();
137
138
140
  hb_tag_t tag = TableType::tableTag;
139
140
  hb_blob_t *blob = source_blob.get_blob();
140
140
  if (unlikely (!blob || !blob->data))
141
3
  {
142
3
    DEBUG_MSG (SUBSET, nullptr,
143
3
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
3
    return false;
145
3
  }
146
147
137
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
137
  DEBUG_MSG (SUBSET, nullptr,
149
137
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
137
  if (unlikely (!buf.alloc (buf_size)))
151
1
  {
152
1
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
1
    return false;
154
1
  }
155
156
136
  bool needed = false;
157
136
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
136
  {
159
136
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
136
    needed = _hb_subset_table_try (table, &buf, &c);
161
136
  }
162
163
136
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
20
  {
165
20
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
20
    return false;
167
20
  }
168
169
116
  if (!needed)
170
77
  {
171
77
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
77
    return true;
173
77
  }
174
175
39
  bool result = false;
176
39
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
39
  if (dest_blob)
178
39
  {
179
39
    DEBUG_MSG (SUBSET, nullptr,
180
39
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
39
               HB_UNTAG (tag), dest_blob->length);
182
39
    result = plan->add_table (tag, dest_blob);
183
39
    hb_blob_destroy (dest_blob);
184
39
  }
185
186
39
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
39
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
39
  return result;
189
116
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::MAXP const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
61
{
135
61
  auto &&source_blob = plan->source_table<TableType> ();
136
61
  auto *table = source_blob.get ();
137
138
61
  hb_tag_t tag = TableType::tableTag;
139
61
  hb_blob_t *blob = source_blob.get_blob();
140
61
  if (unlikely (!blob || !blob->data))
141
12
  {
142
12
    DEBUG_MSG (SUBSET, nullptr,
143
12
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
12
    return false;
145
12
  }
146
147
49
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
49
  DEBUG_MSG (SUBSET, nullptr,
149
49
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
49
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
49
  bool needed = false;
157
49
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
49
  {
159
49
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
49
    needed = _hb_subset_table_try (table, &buf, &c);
161
49
  }
162
163
49
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
1
  {
165
1
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
1
    return false;
167
1
  }
168
169
48
  if (!needed)
170
0
  {
171
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
0
    return true;
173
0
  }
174
175
48
  bool result = false;
176
48
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
48
  if (dest_blob)
178
48
  {
179
48
    DEBUG_MSG (SUBSET, nullptr,
180
48
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
48
               HB_UNTAG (tag), dest_blob->length);
182
48
    result = plan->add_table (tag, dest_blob);
183
48
    hb_blob_destroy (dest_blob);
184
48
  }
185
186
48
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
48
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
48
  return result;
189
48
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::cmap const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
9.00k
{
135
9.00k
  auto &&source_blob = plan->source_table<TableType> ();
136
9.00k
  auto *table = source_blob.get ();
137
138
9.00k
  hb_tag_t tag = TableType::tableTag;
139
9.00k
  hb_blob_t *blob = source_blob.get_blob();
140
9.00k
  if (unlikely (!blob || !blob->data))
141
1.46k
  {
142
1.46k
    DEBUG_MSG (SUBSET, nullptr,
143
1.46k
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
1.46k
    return false;
145
1.46k
  }
146
147
7.53k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
7.53k
  DEBUG_MSG (SUBSET, nullptr,
149
7.53k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
7.53k
  if (unlikely (!buf.alloc (buf_size)))
151
1
  {
152
1
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
1
    return false;
154
1
  }
155
156
7.53k
  bool needed = false;
157
7.53k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
7.53k
  {
159
7.53k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
7.53k
    needed = _hb_subset_table_try (table, &buf, &c);
161
7.53k
  }
162
163
7.53k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
9
  {
165
9
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
9
    return false;
167
9
  }
168
169
7.52k
  if (!needed)
170
1.44k
  {
171
1.44k
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
1.44k
    return true;
173
1.44k
  }
174
175
6.08k
  bool result = false;
176
6.08k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
6.08k
  if (dest_blob)
178
6.08k
  {
179
6.08k
    DEBUG_MSG (SUBSET, nullptr,
180
6.08k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
6.08k
               HB_UNTAG (tag), dest_blob->length);
182
6.08k
    result = plan->add_table (tag, dest_blob);
183
6.08k
    hb_blob_destroy (dest_blob);
184
6.08k
  }
185
186
6.08k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
6.08k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
6.08k
  return result;
189
7.52k
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::DMAP const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
322
{
135
322
  auto &&source_blob = plan->source_table<TableType> ();
136
322
  auto *table = source_blob.get ();
137
138
322
  hb_tag_t tag = TableType::tableTag;
139
322
  hb_blob_t *blob = source_blob.get_blob();
140
322
  if (unlikely (!blob || !blob->data))
141
58
  {
142
58
    DEBUG_MSG (SUBSET, nullptr,
143
58
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
58
    return false;
145
58
  }
146
147
264
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
264
  DEBUG_MSG (SUBSET, nullptr,
149
264
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
264
  if (unlikely (!buf.alloc (buf_size)))
151
1
  {
152
1
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
1
    return false;
154
1
  }
155
156
263
  bool needed = false;
157
263
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
263
  {
159
263
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
263
    needed = _hb_subset_table_try (table, &buf, &c);
161
263
  }
162
163
263
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
0
  {
165
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
0
    return false;
167
0
  }
168
169
263
  if (!needed)
170
235
  {
171
235
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
235
    return true;
173
235
  }
174
175
28
  bool result = false;
176
28
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
28
  if (dest_blob)
178
28
  {
179
28
    DEBUG_MSG (SUBSET, nullptr,
180
28
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
28
               HB_UNTAG (tag), dest_blob->length);
182
28
    result = plan->add_table (tag, dest_blob);
183
28
    hb_blob_destroy (dest_blob);
184
28
  }
185
186
28
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
28
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
28
  return result;
189
263
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::OS2 const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
5.76k
{
135
5.76k
  auto &&source_blob = plan->source_table<TableType> ();
136
5.76k
  auto *table = source_blob.get ();
137
138
5.76k
  hb_tag_t tag = TableType::tableTag;
139
5.76k
  hb_blob_t *blob = source_blob.get_blob();
140
5.76k
  if (unlikely (!blob || !blob->data))
141
1.12k
  {
142
1.12k
    DEBUG_MSG (SUBSET, nullptr,
143
1.12k
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
1.12k
    return false;
145
1.12k
  }
146
147
4.63k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
4.63k
  DEBUG_MSG (SUBSET, nullptr,
149
4.63k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
4.63k
  if (unlikely (!buf.alloc (buf_size)))
151
1
  {
152
1
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
1
    return false;
154
1
  }
155
156
4.63k
  bool needed = false;
157
4.63k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
4.63k
  {
159
4.63k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
4.63k
    needed = _hb_subset_table_try (table, &buf, &c);
161
4.63k
  }
162
163
4.63k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
5
  {
165
5
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
5
    return false;
167
5
  }
168
169
4.62k
  if (!needed)
170
0
  {
171
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
0
    return true;
173
0
  }
174
175
4.62k
  bool result = false;
176
4.62k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
4.62k
  if (dest_blob)
178
4.62k
  {
179
4.62k
    DEBUG_MSG (SUBSET, nullptr,
180
4.62k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
4.62k
               HB_UNTAG (tag), dest_blob->length);
182
4.62k
    result = plan->add_table (tag, dest_blob);
183
4.62k
    hb_blob_destroy (dest_blob);
184
4.62k
  }
185
186
4.62k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
4.62k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
4.62k
  return result;
189
4.62k
}
hb-subset-table-other.cc:bool _hb_subset_table<OT::post const>(hb_subset_plan_t*, hb_vector_t<char, false>&)
Line
Count
Source
134
2.57k
{
135
2.57k
  auto &&source_blob = plan->source_table<TableType> ();
136
2.57k
  auto *table = source_blob.get ();
137
138
2.57k
  hb_tag_t tag = TableType::tableTag;
139
2.57k
  hb_blob_t *blob = source_blob.get_blob();
140
2.57k
  if (unlikely (!blob || !blob->data))
141
282
  {
142
282
    DEBUG_MSG (SUBSET, nullptr,
143
282
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
144
282
    return false;
145
282
  }
146
147
2.29k
  unsigned buf_size = _hb_subset_estimate_table_size (plan, blob->length, TableType::tableTag);
148
2.29k
  DEBUG_MSG (SUBSET, nullptr,
149
2.29k
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
150
2.29k
  if (unlikely (!buf.alloc (buf_size)))
151
0
  {
152
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
153
0
    return false;
154
0
  }
155
156
2.29k
  bool needed = false;
157
2.29k
  hb_serialize_context_t serializer (buf.arrayZ, buf.allocated);
158
2.29k
  {
159
2.29k
    hb_subset_context_t c (blob, plan, &serializer, tag);
160
2.29k
    needed = _hb_subset_table_try (table, &buf, &c);
161
2.29k
  }
162
163
2.29k
  if (serializer.in_error () && !serializer.only_offset_overflow ())
164
7
  {
165
7
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
166
7
    return false;
167
7
  }
168
169
2.29k
  if (!needed)
170
0
  {
171
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
172
0
    return true;
173
0
  }
174
175
2.29k
  bool result = false;
176
2.29k
  hb_blob_t *dest_blob = _hb_subset_repack (tag, serializer);
177
2.29k
  if (dest_blob)
178
2.29k
  {
179
2.29k
    DEBUG_MSG (SUBSET, nullptr,
180
2.29k
               "OT::%c%c%c%c final subset table size: %u bytes.",
181
2.29k
               HB_UNTAG (tag), dest_blob->length);
182
2.29k
    result = plan->add_table (tag, dest_blob);
183
2.29k
    hb_blob_destroy (dest_blob);
184
2.29k
  }
185
186
2.29k
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
187
2.29k
             HB_UNTAG (tag), result ? "success" : "FAILED!");
188
2.29k
  return result;
189
2.29k
}
190
191
static HB_UNUSED bool
192
_hb_subset_table_passthrough (hb_subset_plan_t *plan, hb_tag_t tag)
193
51.8k
{
194
51.8k
  hb_blob_t *source_table = hb_face_reference_table (plan->source, tag);
195
51.8k
  bool result = plan->add_table (tag, source_table);
196
51.8k
  hb_blob_destroy (source_table);
197
51.8k
  return result;
198
51.8k
}
hb-subset.cc:_hb_subset_table_passthrough(hb_subset_plan_t*, unsigned int)
Line
Count
Source
193
48.3k
{
194
48.3k
  hb_blob_t *source_table = hb_face_reference_table (plan->source, tag);
195
48.3k
  bool result = plan->add_table (tag, source_table);
196
48.3k
  hb_blob_destroy (source_table);
197
48.3k
  return result;
198
48.3k
}
Unexecuted instantiation: hb-subset-table-layout.cc:_hb_subset_table_passthrough(hb_subset_plan_t*, unsigned int)
hb-subset-table-var.cc:_hb_subset_table_passthrough(hb_subset_plan_t*, unsigned int)
Line
Count
Source
193
3.52k
{
194
3.52k
  hb_blob_t *source_table = hb_face_reference_table (plan->source, tag);
195
3.52k
  bool result = plan->add_table (tag, source_table);
196
3.52k
  hb_blob_destroy (source_table);
197
3.52k
  return result;
198
3.52k
}
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)
199
200
201
HB_INTERNAL bool _hb_subset_table_layout  (hb_subset_plan_t *plan, hb_vector_t<char> &buf, hb_tag_t tag, bool *success);
202
HB_INTERNAL bool _hb_subset_table_var   (hb_subset_plan_t *plan, hb_vector_t<char> &buf, hb_tag_t tag, bool *success);
203
HB_INTERNAL bool _hb_subset_table_cff   (hb_subset_plan_t *plan, hb_vector_t<char> &buf, hb_tag_t tag, bool *success);
204
HB_INTERNAL bool _hb_subset_table_color   (hb_subset_plan_t *plan, hb_vector_t<char> &buf, hb_tag_t tag, bool *success);
205
HB_INTERNAL bool _hb_subset_table_other   (hb_subset_plan_t *plan, hb_vector_t<char> &buf, hb_tag_t tag, bool *success);
206
207
208
#endif /* HB_SUBSET_TABLE_HH */