[subset] add option --no-prune-unicode-ranges

This commit is contained in:
Qunxin Liu 2021-06-24 10:17:46 -07:00 committed by Behdad Esfahbod
parent c3be28ea26
commit eee7b459ee
27 changed files with 28 additions and 0 deletions

View File

@ -172,6 +172,7 @@ struct OS2
TRACE_SUBSET (this);
OS2 *os2_prime = c->serializer->embed (this);
if (unlikely (!os2_prime)) return_trace (false);
if (!c->plan->prune_unicode_ranges) return_trace (true);
hb_set_t unicodes;
if (!c->plan->glyphs_requested->is_empty ())

View File

@ -56,6 +56,7 @@ hb_subset_input_create_or_fail ()
input->name_legacy = false;
input->overlaps_flag = false;
input->notdef_outline = false;
input->no_prune_unicode_ranges = false;
input->retain_all_layout_features = false;
hb_tag_t default_drop_tables[] = {
@ -364,3 +365,16 @@ hb_subset_input_get_notdef_outline (hb_subset_input_t *subset_input)
return subset_input->notdef_outline;
}
HB_EXTERN void
hb_subset_input_set_no_prune_unicode_ranges (hb_subset_input_t *subset_input,
hb_bool_t no_prune_unicode_ranges)
{
subset_input->no_prune_unicode_ranges = no_prune_unicode_ranges;
}
HB_EXTERN hb_bool_t
hb_subset_input_get_no_prune_unicode_ranges (hb_subset_input_t *subset_input)
{
return subset_input->no_prune_unicode_ranges;
}

View File

@ -52,6 +52,7 @@ struct hb_subset_input_t
hb_bool_t name_legacy;
hb_bool_t overlaps_flag;
hb_bool_t notdef_outline;
hb_bool_t no_prune_unicode_ranges;
hb_bool_t retain_all_layout_features;
/* TODO
*

View File

@ -403,6 +403,7 @@ hb_subset_plan_create (hb_face_t *face,
plan->name_legacy = input->name_legacy;
plan->overlaps_flag = input->overlaps_flag;
plan->notdef_outline = input->notdef_outline;
plan->prune_unicode_ranges = !input->no_prune_unicode_ranges;
plan->retain_all_layout_features = input->retain_all_layout_features;
plan->unicodes = hb_set_create ();
plan->name_ids = hb_set_reference (input->name_ids);

View File

@ -46,6 +46,7 @@ struct hb_subset_plan_t
bool name_legacy : 1;
bool overlaps_flag : 1;
bool notdef_outline : 1;
bool prune_unicode_ranges : 1;
bool retain_all_layout_features : 1;
// For each cp that we'd like to retain maps to the corresponding gid.

View File

@ -110,6 +110,13 @@ hb_subset_input_set_notdef_outline (hb_subset_input_t *subset_input,
HB_EXTERN hb_bool_t
hb_subset_input_get_notdef_outline (hb_subset_input_t *subset_input);
HB_EXTERN void
hb_subset_input_set_no_prune_unicode_ranges (hb_subset_input_t *subset_input,
hb_bool_t no_prune_unicode_ranges);
HB_EXTERN hb_bool_t
hb_subset_input_get_no_prune_unicode_ranges (hb_subset_input_t *subset_input);
/* hb_subset () */
HB_EXTERN hb_face_t *
hb_subset (hb_face_t *source, hb_subset_input_t *input);

View File

@ -0,0 +1 @@
--no-prune-unicode-ranges

View File

@ -15,6 +15,7 @@ name-legacy.txt
gids.txt
layout-features.txt
keep-all-layout-features.txt
no-prune-unicode-ranges.txt
SUBSETS:
abc

View File

@ -311,6 +311,7 @@ subset_options_t::add_options (option_parser_t *parser)
{"set-overlaps-flag", 0, 0, G_OPTION_ARG_NONE, &this->input->overlaps_flag,
"Set the overlaps flag on each glyph.", nullptr},
{"notdef-outline", 0, 0, G_OPTION_ARG_NONE, &this->input->notdef_outline, "Keep the outline of \'.notdef\' glyph", nullptr},
{"no-prune-unicode-ranges", 0, 0, G_OPTION_ARG_NONE, &this->input->no_prune_unicode_ranges, "Don't change the 'OS/2 ulUnicodeRange*' bits.", nullptr},
{nullptr}
};
parser->add_group (entries,