Coverage Report

Created: 2021-08-22 09:07

/src/skia/third_party/externals/harfbuzz/src/hb-subset.cc
Line
Count
Source (jump to first uncovered line)
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, Rod Sheeter, Behdad Esfahbod
25
 */
26
27
#include "hb.hh"
28
#include "hb-open-type.hh"
29
30
#include "hb-subset.hh"
31
32
#include "hb-open-file.hh"
33
#include "hb-ot-cmap-table.hh"
34
#include "hb-ot-glyf-table.hh"
35
#include "hb-ot-hdmx-table.hh"
36
#include "hb-ot-head-table.hh"
37
#include "hb-ot-hhea-table.hh"
38
#include "hb-ot-hmtx-table.hh"
39
#include "hb-ot-maxp-table.hh"
40
#include "hb-ot-color-sbix-table.hh"
41
#include "hb-ot-color-colr-table.hh"
42
#include "hb-ot-color-cpal-table.hh"
43
#include "hb-ot-os2-table.hh"
44
#include "hb-ot-post-table.hh"
45
#include "hb-ot-post-table-v2subset.hh"
46
#include "hb-ot-cff1-table.hh"
47
#include "hb-ot-cff2-table.hh"
48
#include "hb-ot-vorg-table.hh"
49
#include "hb-ot-name-table.hh"
50
#include "hb-ot-color-cbdt-table.hh"
51
#include "hb-ot-layout-gsub-table.hh"
52
#include "hb-ot-layout-gpos-table.hh"
53
#include "hb-ot-var-gvar-table.hh"
54
#include "hb-ot-var-hvar-table.hh"
55
#include "hb-repacker.hh"
56
57
/**
58
 * SECTION:hb-subset
59
 * @title: hb-subset
60
 * @short_description: Subsets font files.
61
 * @include: hb-subset.h
62
 *
63
 * Subsetting reduces the codepoint coverage of font files and removes all data
64
 * that is no longer needed. A subset input describes the desired subset. The input is
65
 * provided along with a font to the subsetting operation. Output is a new font file
66
 * containing only the data specified in the input.
67
 *
68
 * Currently most outline and bitmap tables are supported: glyf, CFF, CFF2, sbix,
69
 * COLR, and CBDT/CBLC. This also includes fonts with variable outlines via OpenType
70
 * variations. Notably EBDT/EBLC and SVG are not supported. Layout subsetting is supported
71
 * only for OpenType Layout tables (GSUB, GPOS, GDEF). Notably subsetting of graphite or AAT tables
72
 * is not yet supported.
73
 *
74
 * Fonts with graphite or AAT tables may still be subsetted but will likely need to use the
75
 * retain glyph ids option and configure the subset to pass through the layout tables untouched.
76
 */
77
78
static unsigned
79
_plan_estimate_subset_table_size (hb_subset_plan_t *plan, unsigned table_len)
80
0
{
81
0
  unsigned src_glyphs = plan->source->get_num_glyphs ();
82
0
  unsigned dst_glyphs = plan->glyphset ()->get_population ();
83
84
0
  if (unlikely (!src_glyphs))
85
0
    return 512 + table_len;
86
87
0
  return 512 + (unsigned) (table_len * sqrt ((double) dst_glyphs / src_glyphs));
88
0
}
89
90
/*
91
 * Repack the serialization buffer if any offset overflows exist.
92
 */
93
static hb_blob_t*
94
_repack (hb_tag_t tag, const hb_serialize_context_t& c)
95
0
{
96
0
  if (tag != HB_OT_TAG_GPOS
97
0
      &&  tag != HB_OT_TAG_GSUB)
98
0
  {
99
    // Check for overflow in a non-handled table.
100
0
    return c.successful () ? c.copy_blob () : nullptr;
101
0
  }
102
103
0
  if (!c.offset_overflow ())
104
0
    return c.copy_blob ();
105
106
0
  hb_vector_t<char> buf;
107
0
  int buf_size = c.end - c.start;
108
0
  if (unlikely (!buf.alloc (buf_size)))
109
0
    return nullptr;
110
111
0
  hb_serialize_context_t repacked ((void *) buf, buf_size);
112
0
  hb_resolve_overflows (c.object_graph (), &repacked);
113
114
0
  if (unlikely (repacked.in_error ()))
115
    // TODO(garretrieger): refactor so we can share the resize/retry logic with the subset
116
    //                     portion.
117
0
    return nullptr;
118
119
0
  return repacked.copy_blob ();
120
0
}
121
122
template<typename TableType>
123
static
124
bool
125
_try_subset (const TableType *table,
126
             hb_vector_t<char>* buf,
127
             unsigned buf_size,
128
             hb_subset_context_t* c /* OUT */)
129
0
{
130
0
  c->serializer->start_serialize<TableType> ();
131
0
  if (c->serializer->in_error ()) return false;
132
133
0
  bool needed = table->subset (c);
134
0
  if (!c->serializer->ran_out_of_room ())
135
0
  {
136
0
    c->serializer->end_serialize ();
137
0
    return needed;
138
0
  }
139
140
0
  buf_size += (buf_size >> 1) + 32;
141
0
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
142
0
             HB_UNTAG (c->table_tag), buf_size);
143
144
0
  if (unlikely (!buf->alloc (buf_size)))
145
0
  {
146
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
147
0
               HB_UNTAG (c->table_tag), buf_size);
148
0
    return needed;
149
0
  }
150
151
0
  c->serializer->reset (buf->arrayZ, buf_size);
152
0
  return _try_subset (table, buf, buf_size, c);
153
0
}
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::glyf>(OT::glyf const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::hdmx>(OT::hdmx const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::name>(OT::name const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::head>(OT::head const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::hmtx>(OT::hmtx const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::vmtx>(OT::vmtx const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::maxp>(OT::maxp const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::sbix>(OT::sbix const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::cmap>(OT::cmap const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::OS2>(OT::OS2 const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::post>(OT::post const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::COLR>(OT::COLR const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::CPAL>(OT::CPAL const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::CBLC>(OT::CBLC const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::cff1>(OT::cff1 const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::cff2>(OT::cff2 const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::VORG>(OT::VORG const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::GDEF>(OT::GDEF const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::GSUB>(OT::GSUB const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::GPOS>(OT::GPOS const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::gvar>(OT::gvar const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::HVAR>(OT::HVAR const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
Unexecuted instantiation: hb-subset.cc:bool _try_subset<OT::VVAR>(OT::VVAR const*, hb_vector_t<char>*, unsigned int, hb_subset_context_t*)
154
155
template<typename TableType>
156
static bool
157
_subset (hb_subset_plan_t *plan)
158
0
{
159
0
  hb_blob_t *source_blob = hb_sanitize_context_t ().reference_table<TableType> (plan->source);
160
0
  const TableType *table = source_blob->as<TableType> ();
161
162
0
  hb_tag_t tag = TableType::tableTag;
163
0
  if (!source_blob->data)
164
0
  {
165
0
    DEBUG_MSG (SUBSET, nullptr,
166
0
               "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
167
0
    hb_blob_destroy (source_blob);
168
0
    return false;
169
0
  }
170
171
0
  hb_vector_t<char> buf;
172
  /* TODO Not all tables are glyph-related.  'name' table size for example should not be
173
   * affected by number of glyphs.  Accommodate that. */
174
0
  unsigned buf_size = _plan_estimate_subset_table_size (plan, source_blob->length);
175
0
  DEBUG_MSG (SUBSET, nullptr,
176
0
             "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size);
177
0
  if (unlikely (!buf.alloc (buf_size)))
178
0
  {
179
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
180
0
    hb_blob_destroy (source_blob);
181
0
    return false;
182
0
  }
183
184
0
  bool needed = false;
185
0
  hb_serialize_context_t serializer (buf.arrayZ, buf_size);
186
0
  {
187
0
    hb_subset_context_t c (source_blob, plan, &serializer, tag);
188
0
    needed = _try_subset (table, &buf, buf_size, &c);
189
0
  }
190
0
  hb_blob_destroy (source_blob);
191
192
0
  if (serializer.in_error () && !serializer.only_offset_overflow ())
193
0
  {
194
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset FAILED!", HB_UNTAG (tag));
195
0
    return false;
196
0
  }
197
198
0
  if (!needed)
199
0
  {
200
0
    DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag));
201
0
    return true;
202
0
  }
203
204
0
  bool result = false;
205
0
  hb_blob_t *dest_blob = _repack (tag, serializer);
206
0
  if (dest_blob)
207
0
  {
208
0
    DEBUG_MSG (SUBSET, nullptr,
209
0
               "OT::%c%c%c%c final subset table size: %u bytes.",
210
0
               HB_UNTAG (tag), dest_blob->length);
211
0
    result = plan->add_table (tag, dest_blob);
212
0
    hb_blob_destroy (dest_blob);
213
0
  }
214
215
0
  DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c::subset %s",
216
0
             HB_UNTAG (tag), result ? "success" : "FAILED!");
217
0
  return result;
218
0
}
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::glyf const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::hdmx const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::name const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::head const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::hmtx const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::vmtx const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::maxp const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::sbix const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::cmap const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::OS2 const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::post const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::COLR const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::CPAL const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::CBLC const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::cff1 const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::cff2 const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::VORG const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::GDEF const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::GSUB const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::GPOS const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::gvar const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::HVAR const>(hb_subset_plan_t*)
Unexecuted instantiation: hb-subset.cc:bool _subset<OT::VVAR const>(hb_subset_plan_t*)
219
220
static bool
221
_is_table_present (hb_face_t *source, hb_tag_t tag)
222
0
{
223
0
  hb_tag_t table_tags[32];
224
0
  unsigned offset = 0, num_tables = ARRAY_LENGTH (table_tags);
225
0
  while ((hb_face_get_table_tags (source, offset, &num_tables, table_tags), num_tables))
226
0
  {
227
0
    for (unsigned i = 0; i < num_tables; ++i)
228
0
      if (table_tags[i] == tag)
229
0
  return true;
230
0
    offset += num_tables;
231
0
  }
232
0
  return false;
233
0
}
234
235
static bool
236
_should_drop_table (hb_subset_plan_t *plan, hb_tag_t tag)
237
0
{
238
0
  if (plan->drop_tables->has (tag))
239
0
    return true;
240
241
0
  switch (tag)
242
0
  {
243
0
  case HB_TAG ('c','v','a','r'): /* hint table, fallthrough */
244
0
  case HB_TAG ('c','v','t',' '): /* hint table, fallthrough */
245
0
  case HB_TAG ('f','p','g','m'): /* hint table, fallthrough */
246
0
  case HB_TAG ('p','r','e','p'): /* hint table, fallthrough */
247
0
  case HB_TAG ('h','d','m','x'): /* hint table, fallthrough */
248
0
  case HB_TAG ('V','D','M','X'): /* hint table, fallthrough */
249
0
    return plan->flags & HB_SUBSET_FLAGS_NO_HINTING;
250
251
#ifdef HB_NO_SUBSET_LAYOUT
252
    // Drop Layout Tables if requested.
253
  case HB_OT_TAG_GDEF:
254
  case HB_OT_TAG_GPOS:
255
  case HB_OT_TAG_GSUB:
256
  case HB_TAG ('m','o','r','x'):
257
  case HB_TAG ('m','o','r','t'):
258
  case HB_TAG ('k','e','r','x'):
259
  case HB_TAG ('k','e','r','n'):
260
    return true;
261
#endif
262
263
0
  default:
264
0
    return false;
265
0
  }
266
0
}
267
268
static bool
269
_passthrough (hb_subset_plan_t *plan, hb_tag_t tag)
270
0
{
271
0
  hb_blob_t *source_table = hb_face_reference_table (plan->source, tag);
272
0
  bool result = plan->add_table (tag, source_table);
273
0
  hb_blob_destroy (source_table);
274
0
  return result;
275
0
}
276
277
static bool
278
_subset_table (hb_subset_plan_t *plan, hb_tag_t tag)
279
0
{
280
0
  if (plan->no_subset_tables->has (tag)) {
281
0
    return _passthrough (plan, tag);
282
0
  }
283
284
0
  DEBUG_MSG (SUBSET, nullptr, "subset %c%c%c%c", HB_UNTAG (tag));
285
0
  switch (tag)
286
0
  {
287
0
  case HB_OT_TAG_glyf: return _subset<const OT::glyf> (plan);
288
0
  case HB_OT_TAG_hdmx: return _subset<const OT::hdmx> (plan);
289
0
  case HB_OT_TAG_name: return _subset<const OT::name> (plan);
290
0
  case HB_OT_TAG_head:
291
0
    if (_is_table_present (plan->source, HB_OT_TAG_glyf) && !_should_drop_table (plan, HB_OT_TAG_glyf))
292
0
      return true; /* skip head, handled by glyf */
293
0
    return _subset<const OT::head> (plan);
294
0
  case HB_OT_TAG_hhea: return true; /* skip hhea, handled by hmtx */
295
0
  case HB_OT_TAG_hmtx: return _subset<const OT::hmtx> (plan);
296
0
  case HB_OT_TAG_vhea: return true; /* skip vhea, handled by vmtx */
297
0
  case HB_OT_TAG_vmtx: return _subset<const OT::vmtx> (plan);
298
0
  case HB_OT_TAG_maxp: return _subset<const OT::maxp> (plan);
299
0
  case HB_OT_TAG_sbix: return _subset<const OT::sbix> (plan);
300
0
  case HB_OT_TAG_loca: return true; /* skip loca, handled by glyf */
301
0
  case HB_OT_TAG_cmap: return _subset<const OT::cmap> (plan);
302
0
  case HB_OT_TAG_OS2 : return _subset<const OT::OS2 > (plan);
303
0
  case HB_OT_TAG_post: return _subset<const OT::post> (plan);
304
0
  case HB_OT_TAG_COLR: return _subset<const OT::COLR> (plan);
305
0
  case HB_OT_TAG_CPAL: return _subset<const OT::CPAL> (plan);
306
0
  case HB_OT_TAG_CBLC: return _subset<const OT::CBLC> (plan);
307
0
  case HB_OT_TAG_CBDT: return true; /* skip CBDT, handled by CBLC */
308
309
0
#ifndef HB_NO_SUBSET_CFF
310
0
  case HB_OT_TAG_cff1: return _subset<const OT::cff1> (plan);
311
0
  case HB_OT_TAG_cff2: return _subset<const OT::cff2> (plan);
312
0
  case HB_OT_TAG_VORG: return _subset<const OT::VORG> (plan);
313
0
#endif
314
315
0
#ifndef HB_NO_SUBSET_LAYOUT
316
0
  case HB_OT_TAG_GDEF: return _subset<const OT::GDEF> (plan);
317
0
  case HB_OT_TAG_GSUB: return _subset<const OT::GSUB> (plan);
318
0
  case HB_OT_TAG_GPOS: return _subset<const OT::GPOS> (plan);
319
0
  case HB_OT_TAG_gvar: return _subset<const OT::gvar> (plan);
320
0
  case HB_OT_TAG_HVAR: return _subset<const OT::HVAR> (plan);
321
0
  case HB_OT_TAG_VVAR: return _subset<const OT::VVAR> (plan);
322
0
#endif
323
324
0
  default:
325
0
    if (plan->flags & HB_SUBSET_FLAGS_PASSTHROUGH_UNRECOGNIZED)
326
0
      return _passthrough (plan, tag);
327
328
    // Drop table
329
0
    return true;
330
0
  }
331
0
}
332
333
/**
334
 * hb_subset_or_fail:
335
 * @source: font face data to be subset.
336
 * @input: input to use for the subsetting.
337
 *
338
 * Subsets a font according to provided input. Returns nullptr
339
 * if the subset operation fails.
340
 *
341
 * Since: REPLACE
342
 **/
343
hb_face_t *
344
hb_subset_or_fail (hb_face_t *source, const hb_subset_input_t *input)
345
0
{
346
0
  if (unlikely (!input || !source)) return hb_face_get_empty ();
347
348
0
  hb_subset_plan_t *plan = hb_subset_plan_create (source, input);
349
0
  if (unlikely (plan->in_error ())) {
350
0
    hb_subset_plan_destroy (plan);
351
0
    return nullptr;
352
0
  }
353
354
0
  hb_set_t tags_set;
355
0
  bool success = true;
356
0
  hb_tag_t table_tags[32];
357
0
  unsigned offset = 0, num_tables = ARRAY_LENGTH (table_tags);
358
0
  while ((hb_face_get_table_tags (source, offset, &num_tables, table_tags), num_tables))
359
0
  {
360
0
    for (unsigned i = 0; i < num_tables; ++i)
361
0
    {
362
0
      hb_tag_t tag = table_tags[i];
363
0
      if (_should_drop_table (plan, tag) && !tags_set.has (tag)) continue;
364
0
      tags_set.add (tag);
365
0
      success = _subset_table (plan, tag);
366
0
      if (unlikely (!success)) goto end;
367
0
    }
368
0
    offset += num_tables;
369
0
  }
370
0
end:
371
372
0
  hb_face_t *result = success ? hb_face_reference (plan->dest) : nullptr;
373
374
0
  hb_subset_plan_destroy (plan);
375
0
  return result;
376
0
}