[subset] Add new subsetting API method to receive a user specified glyph mapping.

This commit is contained in:
Garret Rieger 2023-05-04 18:47:55 +00:00
parent 1be3972914
commit e711e305c8
3 changed files with 22 additions and 0 deletions

View file

@ -520,6 +520,22 @@ hb_subset_preprocess (hb_face_t *source)
return new_source;
}
HB_EXTERN hb_bool_t
hb_subset_input_set_old_to_new_glyph_mapping (hb_subset_input_t *input,
const hb_map_t* mapping)
{
hb_set_t new_gids;
for (auto gid : mapping->values())
{
// Mapping cannot map multiple old gids to the same new gid.
if (new_gids.has(gid)) return false;
new_gids.add(gid);
}
input->glyph_map = *mapping;
return true;
}
#ifdef HB_EXPERIMENTAL_API
/**
* hb_subset_input_override_name_table:

View file

@ -119,6 +119,7 @@ struct hb_subset_input_t
bool force_long_loca = false;
hb_hashmap_t<hb_tag_t, float> axes_location;
hb_map_t glyph_map;
#ifdef HB_EXPERIMENTAL_API
hb_hashmap_t<hb_ot_name_record_ids_t, hb_bytes_t> name_table_overrides;
#endif

View file

@ -172,6 +172,11 @@ hb_subset_input_pin_axis_location (hb_subset_input_t *input,
hb_tag_t axis_tag,
float axis_value);
HB_EXTERN hb_bool_t
hb_subset_input_set_old_to_new_glyph_mapping (hb_subset_input_t *input,
const hb_map_t* mapping);
#ifdef HB_EXPERIMENTAL_API
HB_EXTERN hb_bool_t
hb_subset_input_override_name_table (hb_subset_input_t *input,