[subset] remove helper functions for accessing subset input sets.

This commit is contained in:
Garret Rieger 2021-08-30 11:16:51 -07:00
parent 57d6bf8251
commit 3844e58e14
3 changed files with 22 additions and 92 deletions

View File

@ -56,8 +56,8 @@ hb_subset_input_create_or_fail (void)
input->flags = HB_SUBSET_FLAGS_DEFAULT;
hb_set_add_range (input->name_ids (), 0, 6);
hb_set_add (input->name_languages (), 0x0409);
hb_set_add_range (input->sets.name_ids, 0, 6);
hb_set_add (input->sets.name_languages, 0x0409);
hb_tag_t default_drop_tables[] = {
// Layout disabled by default
@ -83,7 +83,7 @@ hb_subset_input_create_or_fail (void)
HB_TAG ('S', 'i', 'l', 'f'),
HB_TAG ('S', 'i', 'l', 'l'),
};
input->drop_tables ()->add_array (default_drop_tables, ARRAY_LENGTH (default_drop_tables));
input->sets.drop_tables->add_array (default_drop_tables, ARRAY_LENGTH (default_drop_tables));
hb_tag_t default_no_subset_tables[] = {
HB_TAG ('a', 'v', 'a', 'r'),
@ -98,7 +98,7 @@ hb_subset_input_create_or_fail (void)
HB_TAG ('c', 'v', 'a', 'r'),
HB_TAG ('S', 'T', 'A', 'T'),
};
input->no_subset_tables ()->add_array (default_no_subset_tables,
input->sets.no_subset_tables->add_array (default_no_subset_tables,
ARRAY_LENGTH (default_no_subset_tables));
//copied from _layout_features_groups in fonttools
@ -188,7 +188,7 @@ hb_subset_input_create_or_fail (void)
HB_TAG ('b', 'l', 'w', 'm'),
};
input->layout_features ()->add_array (default_layout_features, ARRAY_LENGTH (default_layout_features));
input->sets.layout_features->add_array (default_layout_features, ARRAY_LENGTH (default_layout_features));
if (input->in_error ())
{
@ -249,7 +249,7 @@ hb_subset_input_destroy (hb_subset_input_t *input)
HB_EXTERN hb_set_t *
hb_subset_input_unicode_set (hb_subset_input_t *input)
{
return input->unicodes ();
return input->sets.unicodes;
}
/**
@ -266,7 +266,7 @@ hb_subset_input_unicode_set (hb_subset_input_t *input)
HB_EXTERN hb_set_t *
hb_subset_input_glyph_set (hb_subset_input_t *input)
{
return input->glyphs ();
return input->sets.glyphs;
}
/**
@ -283,7 +283,7 @@ hb_subset_input_glyph_set (hb_subset_input_t *input)
HB_EXTERN hb_set_t *
hb_subset_input_nameid_set (hb_subset_input_t *input)
{
return input->name_ids ();
return input->sets.name_ids;
}
/**
@ -300,7 +300,7 @@ hb_subset_input_nameid_set (hb_subset_input_t *input)
HB_EXTERN hb_set_t *
hb_subset_input_namelangid_set (hb_subset_input_t *input)
{
return input->name_languages ();
return input->sets.name_languages;
}
@ -318,7 +318,7 @@ hb_subset_input_namelangid_set (hb_subset_input_t *input)
HB_EXTERN hb_set_t *
hb_subset_input_layout_features_set (hb_subset_input_t *input)
{
return input->layout_features ();
return input->sets.layout_features;
}
/**
@ -335,7 +335,7 @@ hb_subset_input_layout_features_set (hb_subset_input_t *input)
HB_EXTERN hb_set_t *
hb_subset_input_drop_tables_set (hb_subset_input_t *input)
{
return input->drop_tables ();
return input->sets.drop_tables;
}
/**
@ -369,7 +369,7 @@ hb_subset_input_set (hb_subset_input_t *input, hb_subset_sets_t set_type)
HB_EXTERN hb_set_t *
hb_subset_input_no_subset_tables_set (hb_subset_input_t *input)
{
return input->no_subset_tables ();
return input->sets.no_subset_tables;
}

View File

@ -67,76 +67,6 @@ struct hb_subset_input_t
return hb_array_t<hb_set_t*> (set_ptrs, num_sets ());
}
inline hb_set_t* unicodes()
{
return sets.unicodes;
}
inline const hb_set_t* unicodes() const
{
return sets.unicodes;
}
inline hb_set_t* glyphs ()
{
return sets.glyphs;
}
inline const hb_set_t* glyphs () const
{
return sets.glyphs;
}
inline hb_set_t* name_ids ()
{
return sets.name_ids;
}
inline const hb_set_t* name_ids () const
{
return sets.name_ids;
}
inline hb_set_t* name_languages ()
{
return sets.name_languages;
}
inline const hb_set_t* name_languages () const
{
return sets.name_languages;
}
inline hb_set_t* no_subset_tables ()
{
return sets.no_subset_tables;
}
inline const hb_set_t* no_subset_tables () const
{
return sets.no_subset_tables;
}
inline hb_set_t* drop_tables ()
{
return sets.drop_tables;
}
inline const hb_set_t* drop_tables () const
{
return sets.drop_tables;
}
inline hb_set_t* layout_features ()
{
return sets.layout_features;
}
inline const hb_set_t* layout_features () const
{
return sets.layout_features;
}
bool in_error () const
{
for (unsigned i = 0; i < num_sets (); i++)

View File

@ -456,13 +456,13 @@ hb_subset_plan_create (hb_face_t *face,
plan->successful = true;
plan->flags = input->flags;
plan->unicodes = hb_set_create ();
plan->name_ids = hb_set_copy (input->name_ids ());
plan->name_ids = hb_set_copy (input->sets.name_ids);
_nameid_closure (face, plan->name_ids);
plan->name_languages = hb_set_copy (input->name_languages ());
plan->layout_features = hb_set_copy (input->layout_features ());
plan->glyphs_requested = hb_set_copy (input->glyphs ());
plan->drop_tables = hb_set_copy (input->drop_tables ());
plan->no_subset_tables = hb_set_copy (input->no_subset_tables ());
plan->name_languages = hb_set_copy (input->sets.name_languages);
plan->layout_features = hb_set_copy (input->sets.layout_features);
plan->glyphs_requested = hb_set_copy (input->sets.glyphs);
plan->drop_tables = hb_set_copy (input->sets.drop_tables);
plan->no_subset_tables = hb_set_copy (input->sets.no_subset_tables);
plan->source = hb_face_reference (face);
plan->dest = hb_face_builder_create ();
@ -490,12 +490,12 @@ hb_subset_plan_create (hb_face_t *face,
return plan;
}
_populate_unicodes_to_retain (input->unicodes (), input->glyphs (), plan);
_populate_unicodes_to_retain (input->sets.unicodes, input->sets.glyphs, plan);
_populate_gids_to_retain (plan,
!input->drop_tables ()->has (HB_OT_TAG_GSUB),
!input->drop_tables ()->has (HB_OT_TAG_GPOS),
!input->drop_tables ()->has (HB_OT_TAG_GDEF));
!input->sets.drop_tables->has (HB_OT_TAG_GSUB),
!input->sets.drop_tables->has (HB_OT_TAG_GPOS),
!input->sets.drop_tables->has (HB_OT_TAG_GDEF));
_create_old_gid_to_new_gid_map (face,
input->flags & HB_SUBSET_FLAGS_RETAIN_GIDS,