Merge pull request #3893 from googlefonts/preprocess_test

[subset] Fix testing of preprocess
This commit is contained in:
Behdad Esfahbod 2022-11-24 11:56:58 -07:00 committed by GitHub
commit a4a4078632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 16 additions and 2 deletions

View File

@ -2421,6 +2421,7 @@ struct ContextFormat2_5
const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups;
bool ret = true;
int non_zero_index = -1, index = 0;
auto snapshot = c->serializer->snapshot();
for (const auto& _ : + hb_enumerate (ruleSet)
| hb_filter (klass_map, hb_first))
{
@ -2432,8 +2433,10 @@ struct ContextFormat2_5
}
if (coverage_glyph_classes.has (_.first) &&
o->serialize_subset (c, _.second, this, lookup_map, &klass_map))
o->serialize_subset (c, _.second, this, lookup_map, &klass_map)) {
non_zero_index = index;
snapshot = c->serializer->snapshot();
}
index++;
}
@ -2447,6 +2450,7 @@ struct ContextFormat2_5
out->ruleSet.pop ();
index--;
}
c->serializer->revert (snapshot);
return_trace (bool (out->ruleSet));
}

View File

@ -468,6 +468,9 @@ hb_subset_preprocess (hb_face_t *source)
hb_set_clear (hb_subset_input_set(input, HB_SUBSET_SETS_UNICODE));
hb_set_invert (hb_subset_input_set(input, HB_SUBSET_SETS_UNICODE));
hb_set_clear (hb_subset_input_set(input, HB_SUBSET_SETS_GLYPH_INDEX));
hb_set_invert (hb_subset_input_set(input, HB_SUBSET_SETS_GLYPH_INDEX));
hb_set_clear (hb_subset_input_set(input,
HB_SUBSET_SETS_LAYOUT_FEATURE_TAG));
hb_set_invert (hb_subset_input_set(input,
@ -483,6 +486,11 @@ hb_subset_preprocess (hb_face_t *source)
hb_set_invert (hb_subset_input_set(input,
HB_SUBSET_SETS_NAME_ID));
hb_set_clear (hb_subset_input_set(input,
HB_SUBSET_SETS_NAME_LANG_ID));
hb_set_invert (hb_subset_input_set(input,
HB_SUBSET_SETS_NAME_LANG_ID));
hb_subset_input_set_flags(input,
HB_SUBSET_FLAGS_NOTDEF_OUTLINE |
HB_SUBSET_FLAGS_GLYPH_NAMES |

View File

@ -35,6 +35,7 @@ def generate_expected_output(input_file, unicodes, profile_flags, instance_flags
"--no-overlap-flag",
"--no-recalc-bounds",
"--no-recalc-timestamp",
"--no-harfbuzz-repacker", # disable harfbuzz repacker so we aren't comparing to ourself.
"--output=%s" % instance_path,
input_file]
args.extend(instance_flags)
@ -45,6 +46,7 @@ def generate_expected_output(input_file, unicodes, profile_flags, instance_flags
args = ["fonttools", "subset", input_path]
args.extend(["--drop-tables+=DSIG",
"--drop-tables-=sbix",
"--no-harfbuzz-repacker", # disable harfbuzz repacker so we aren't comparing to ourself.
"--unicodes=%s" % unicodes,
"--output-file=%s" % fonttools_path])
args.extend(profile_flags)

View File

@ -120,7 +120,7 @@ struct subset_main_t : option_parser_t, face_options_t, output_options_t<false>
for (unsigned i = 0; i < num_iterations; i++)
{
hb_face_destroy (new_face);
new_face = hb_subset_or_fail (face, input);
new_face = hb_subset_or_fail (orig_face, input);
}
bool success = new_face;