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

pull/4221/head
Garret Rieger 2 years ago
parent 1be3972914
commit e711e305c8
  1. 16
      src/hb-subset-input.cc
  2. 1
      src/hb-subset-input.hh
  3. 5
      src/hb-subset.h

@ -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:

@ -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

@ -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,

Loading…
Cancel
Save