[subset] add --no-layout-closure flag.
Disables layout glyph closure. Fixes #4192.
This commit is contained in:
parent
9c258936e7
commit
14b9d8d534
|
@ -295,7 +295,7 @@ _closure_glyphs_lookups_features (hb_subset_plan_t *plan,
|
||||||
feature_record_cond_idx_map,
|
feature_record_cond_idx_map,
|
||||||
feature_substitutes_map);
|
feature_substitutes_map);
|
||||||
|
|
||||||
if (table_tag == HB_OT_TAG_GSUB)
|
if (table_tag == HB_OT_TAG_GSUB && !(plan->flags & HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE))
|
||||||
hb_ot_layout_lookups_substitute_closure (plan->source,
|
hb_ot_layout_lookups_substitute_closure (plan->source,
|
||||||
&lookup_indices,
|
&lookup_indices,
|
||||||
gids_to_retain);
|
gids_to_retain);
|
||||||
|
|
|
@ -71,6 +71,8 @@ typedef struct hb_subset_plan_t hb_subset_plan_t;
|
||||||
* in the final subset.
|
* in the final subset.
|
||||||
* @HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES: If set then the unicode ranges in
|
* @HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES: If set then the unicode ranges in
|
||||||
* OS/2 will not be recalculated.
|
* OS/2 will not be recalculated.
|
||||||
|
* @HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE: If set don't perform glyph closure on layout
|
||||||
|
* tables (GSUB, GPOS, GDEF).
|
||||||
*
|
*
|
||||||
* List of boolean properties that can be configured on the subset input.
|
* List of boolean properties that can be configured on the subset input.
|
||||||
*
|
*
|
||||||
|
@ -87,6 +89,7 @@ typedef enum { /*< flags >*/
|
||||||
HB_SUBSET_FLAGS_NOTDEF_OUTLINE = 0x00000040u,
|
HB_SUBSET_FLAGS_NOTDEF_OUTLINE = 0x00000040u,
|
||||||
HB_SUBSET_FLAGS_GLYPH_NAMES = 0x00000080u,
|
HB_SUBSET_FLAGS_GLYPH_NAMES = 0x00000080u,
|
||||||
HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES = 0x00000100u,
|
HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES = 0x00000100u,
|
||||||
|
HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE = 0x00000200u,
|
||||||
} hb_subset_flags_t;
|
} hb_subset_flags_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,6 +44,7 @@ EXTRA_DIST += \
|
||||||
expected/layout.duplicate_features \
|
expected/layout.duplicate_features \
|
||||||
expected/layout.unsorted_featurelist \
|
expected/layout.unsorted_featurelist \
|
||||||
expected/layout.drop_feature \
|
expected/layout.drop_feature \
|
||||||
|
expected/no_layout_closure \
|
||||||
expected/cmap \
|
expected/cmap \
|
||||||
expected/cmap14 \
|
expected/cmap14 \
|
||||||
expected/sbix \
|
expected/sbix \
|
||||||
|
|
|
@ -43,6 +43,7 @@ TESTS = \
|
||||||
tests/layout.duplicate_features.tests \
|
tests/layout.duplicate_features.tests \
|
||||||
tests/layout.unsorted_featurelist.tests \
|
tests/layout.unsorted_featurelist.tests \
|
||||||
tests/layout.drop_feature.tests \
|
tests/layout.drop_feature.tests \
|
||||||
|
tests/no_layout_closure.tests \
|
||||||
tests/sbix.tests \
|
tests/sbix.tests \
|
||||||
tests/variable.tests \
|
tests/variable.tests \
|
||||||
tests/glyph_names.tests \
|
tests/glyph_names.tests \
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
||||||
|
--no-layout-closure
|
||||||
|
--gids=74,77,446
|
|
@ -0,0 +1,8 @@
|
||||||
|
FONTS:
|
||||||
|
Roboto-Regular.ttf
|
||||||
|
|
||||||
|
PROFILES:
|
||||||
|
no-layout-closure-gids.txt
|
||||||
|
|
||||||
|
SUBSETS:
|
||||||
|
no-unicodes
|
|
@ -47,8 +47,10 @@ def generate_expected_output(input_file, unicodes, profile_flags, instance_flags
|
||||||
args.extend(["--drop-tables+=DSIG",
|
args.extend(["--drop-tables+=DSIG",
|
||||||
"--drop-tables-=sbix",
|
"--drop-tables-=sbix",
|
||||||
"--no-harfbuzz-repacker", # disable harfbuzz repacker so we aren't comparing to ourself.
|
"--no-harfbuzz-repacker", # disable harfbuzz repacker so we aren't comparing to ourself.
|
||||||
"--unicodes=%s" % unicodes,
|
|
||||||
"--output-file=%s" % fonttools_path])
|
"--output-file=%s" % fonttools_path])
|
||||||
|
if unicodes != "":
|
||||||
|
args.extend(["--unicodes=%s" % unicodes,])
|
||||||
|
|
||||||
args.extend(profile_flags)
|
args.extend(profile_flags)
|
||||||
if not no_fonttools:
|
if not no_fonttools:
|
||||||
check_call(args)
|
check_call(args)
|
||||||
|
@ -63,9 +65,10 @@ def generate_expected_output(input_file, unicodes, profile_flags, instance_flags
|
||||||
hb_subset,
|
hb_subset,
|
||||||
"--font-file=" + input_file,
|
"--font-file=" + input_file,
|
||||||
"--output-file=" + harfbuzz_path,
|
"--output-file=" + harfbuzz_path,
|
||||||
"--unicodes=%s" % unicodes,
|
|
||||||
"--drop-tables+=DSIG",
|
"--drop-tables+=DSIG",
|
||||||
"--drop-tables-=sbix"]
|
"--drop-tables-=sbix"]
|
||||||
|
if unicodes != "":
|
||||||
|
args.extend(["--unicodes=%s" % unicodes,])
|
||||||
args.extend(profile_flags)
|
args.extend(profile_flags)
|
||||||
if instance_flags:
|
if instance_flags:
|
||||||
args.extend(["--instance=%s" % ','.join(instance_flags)])
|
args.extend(["--instance=%s" % ','.join(instance_flags)])
|
||||||
|
|
|
@ -34,6 +34,7 @@ tests = [
|
||||||
'layout.duplicate_features',
|
'layout.duplicate_features',
|
||||||
'layout.unsorted_featurelist',
|
'layout.unsorted_featurelist',
|
||||||
'layout.drop_feature',
|
'layout.drop_feature',
|
||||||
|
'no_layout_closure',
|
||||||
'cmap',
|
'cmap',
|
||||||
'cmap14',
|
'cmap14',
|
||||||
'sbix',
|
'sbix',
|
||||||
|
|
|
@ -16,6 +16,8 @@ class Test:
|
||||||
import re
|
import re
|
||||||
if self.subset == '*':
|
if self.subset == '*':
|
||||||
return self.subset[0]
|
return self.subset[0]
|
||||||
|
elif self.subset == "no-unicodes":
|
||||||
|
return ""
|
||||||
elif re.match("^U\+", self.subset):
|
elif re.match("^U\+", self.subset):
|
||||||
s = re.sub (r"U\+", "", self.subset)
|
s = re.sub (r"U\+", "", self.subset)
|
||||||
return s
|
return s
|
||||||
|
@ -49,6 +51,11 @@ class Test:
|
||||||
profile_name,
|
profile_name,
|
||||||
self.instance_name(),
|
self.instance_name(),
|
||||||
font_base_name_parts[1])
|
font_base_name_parts[1])
|
||||||
|
elif self.unicodes() == "":
|
||||||
|
return "%s.%s.no-unicodes%s%s" % (font_base_name_parts[0],
|
||||||
|
profile_name,
|
||||||
|
self.instance_name(),
|
||||||
|
font_base_name_parts[1])
|
||||||
else:
|
else:
|
||||||
return "%s.%s.%s%s%s" % (font_base_name_parts[0],
|
return "%s.%s.%s%s%s" % (font_base_name_parts[0],
|
||||||
profile_name,
|
profile_name,
|
||||||
|
|
|
@ -941,6 +941,7 @@ subset_main_t::add_options ()
|
||||||
{"set-overlaps-flag", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_SET_OVERLAPS_FLAG>, "Set the overlaps flag on each glyph.", nullptr},
|
{"set-overlaps-flag", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_SET_OVERLAPS_FLAG>, "Set the overlaps flag on each glyph.", nullptr},
|
||||||
{"notdef-outline", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_NOTDEF_OUTLINE>, "Keep the outline of \'.notdef\' glyph", nullptr},
|
{"notdef-outline", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_NOTDEF_OUTLINE>, "Keep the outline of \'.notdef\' glyph", nullptr},
|
||||||
{"no-prune-unicode-ranges", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES>, "Don't change the 'OS/2 ulUnicodeRange*' bits.", nullptr},
|
{"no-prune-unicode-ranges", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES>, "Don't change the 'OS/2 ulUnicodeRange*' bits.", nullptr},
|
||||||
|
{"no-layout-closure", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE>, "Don't perform glyph closure for layout tables (GSUB, GPOS, GDEF).", nullptr},
|
||||||
{"glyph-names", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_GLYPH_NAMES>, "Keep PS glyph names in TT-flavored fonts. ", nullptr},
|
{"glyph-names", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_GLYPH_NAMES>, "Keep PS glyph names in TT-flavored fonts. ", nullptr},
|
||||||
{"passthrough-tables", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_PASSTHROUGH_UNRECOGNIZED>, "Do not drop tables that the tool does not know how to subset.", nullptr},
|
{"passthrough-tables", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (gpointer) &set_flag<HB_SUBSET_FLAGS_PASSTHROUGH_UNRECOGNIZED>, "Do not drop tables that the tool does not know how to subset.", nullptr},
|
||||||
{"preprocess-face", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &this->preprocess,
|
{"preprocess-face", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &this->preprocess,
|
||||||
|
|
Loading…
Reference in New Issue