[subset] Allocate space for null entry in script/feature list.

pull/3699/head
Garret Rieger 2 years ago
parent dbfd2bf327
commit 216cf5946b
  1. 8
      src/hb-subset-plan.cc
  2. 2
      src/hb-subset.h

@ -99,7 +99,7 @@ static bool _filter_tag_list(hb_vector_t<hb_tag_t>* tags, /* IN/OUT */
const hb_set_t* filter)
{
hb_vector_t<hb_tag_t> out;
out.alloc (tags->get_size());
out.alloc (tags->get_size() + 1); // +1 is to allocate room for the null terminator.
bool removed = false;
hb_set_t visited;
@ -129,18 +129,16 @@ static void _collect_layout_indices (hb_subset_plan_t *plan,
layout_collect_func_t layout_collect_func,
hb_set_t *indices /* OUT */)
{
unsigned num_features = table.get_feature_count () + 1;
unsigned num_features = table.get_feature_count ();
hb_vector_t<hb_tag_t> features;
if (!plan->check_success (features.resize (num_features))) return;
table.get_feature_tags (0, &num_features, features.arrayZ);
features.resize (num_features);
bool retain_all_features = !_filter_tag_list (&features, plan->layout_features);
unsigned num_scripts = table.get_script_count () + 1;
unsigned num_scripts = table.get_script_count ();
hb_vector_t<hb_tag_t> scripts;
if (!plan->check_success (scripts.resize (num_scripts))) return;
table.get_script_tags (0, &num_scripts, scripts.arrayZ);
scripts.resize (num_scripts);
bool retain_all_scripts = !_filter_tag_list (&scripts, plan->layout_scripts);
if (!plan->check_success (!features.in_error ()) || !features

@ -101,7 +101,7 @@ typedef enum { /*< flags >*/
* @HB_SUBSET_SETS_LAYOUT_FEATURE_TAG: the set of layout feature tags that will be retained
* in the subset.
* @HB_SUBSET_SETS_LAYOUT_SCRIPT_TAG: the set of layout script tags that will be retained
* in the subset. Defaults to all tags.
* in the subset. Defaults to all tags. Since: REPLACEME
*
* List of sets that can be configured on the subset input.
*

Loading…
Cancel
Save