[instance] add tests for featureVariations
Also updated the script that is used to generate tests.With fonttools, we now do instancing first and then subsetting. With different order of subsetting and instancing operations on the same VF file, fonttools seems to generate 2 different font files with different glyph set. 1. do subsetting and then instancing: this seems result in a larger glyph set in the font file. Lookups are collected from both retained features and all possible alternate featurevariations, this leads to a larger glyph set after glyph closurei. And instancer doesn't redo glyph closure, it does lookups pruning only. 2. do instancing and then subsetting: lookups are collected from features that are replaced already and possible alternate feature variations
This commit is contained in:
parent
b90ce34a25
commit
d5fc4a73c0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,12 @@
|
||||||
|
FONTS:
|
||||||
|
MPLUS1-Variable.ttf
|
||||||
|
|
||||||
|
PROFILES:
|
||||||
|
default.txt
|
||||||
|
notdef-outline.txt
|
||||||
|
|
||||||
|
SUBSETS:
|
||||||
|
*
|
||||||
|
|
||||||
|
INSTANCES:
|
||||||
|
wght=400
|
|
@ -28,15 +28,7 @@ def strip_check_sum (ttx_string):
|
||||||
|
|
||||||
|
|
||||||
def generate_expected_output(input_file, unicodes, profile_flags, instance_flags, output_directory, font_name):
|
def generate_expected_output(input_file, unicodes, profile_flags, instance_flags, output_directory, font_name):
|
||||||
fonttools_path = os.path.join(tempfile.mkdtemp (), font_name)
|
input_path = input_file
|
||||||
args = ["fonttools", "subset", input_file]
|
|
||||||
args.extend(["--drop-tables+=DSIG",
|
|
||||||
"--drop-tables-=sbix",
|
|
||||||
"--unicodes=%s" % unicodes,
|
|
||||||
"--output-file=%s" % fonttools_path])
|
|
||||||
args.extend(profile_flags)
|
|
||||||
check_call(args)
|
|
||||||
|
|
||||||
if instance_flags:
|
if instance_flags:
|
||||||
instance_path = os.path.join(tempfile.mkdtemp (), font_name)
|
instance_path = os.path.join(tempfile.mkdtemp (), font_name)
|
||||||
args = ["fonttools", "varLib.instancer",
|
args = ["fonttools", "varLib.instancer",
|
||||||
|
@ -44,10 +36,19 @@ def generate_expected_output(input_file, unicodes, profile_flags, instance_flags
|
||||||
"--no-recalc-bounds",
|
"--no-recalc-bounds",
|
||||||
"--no-recalc-timestamp",
|
"--no-recalc-timestamp",
|
||||||
"--output=%s" % instance_path,
|
"--output=%s" % instance_path,
|
||||||
fonttools_path]
|
input_file]
|
||||||
args.extend(instance_flags)
|
args.extend(instance_flags)
|
||||||
check_call(args)
|
check_call(args)
|
||||||
fonttools_path = instance_path
|
input_path = instance_path
|
||||||
|
|
||||||
|
fonttools_path = os.path.join(tempfile.mkdtemp (), font_name)
|
||||||
|
args = ["fonttools", "subset", input_path]
|
||||||
|
args.extend(["--drop-tables+=DSIG",
|
||||||
|
"--drop-tables-=sbix",
|
||||||
|
"--unicodes=%s" % unicodes,
|
||||||
|
"--output-file=%s" % fonttools_path])
|
||||||
|
args.extend(profile_flags)
|
||||||
|
check_call(args)
|
||||||
|
|
||||||
with io.StringIO () as fp:
|
with io.StringIO () as fp:
|
||||||
with TTFont (fonttools_path) as font:
|
with TTFont (fonttools_path) as font:
|
||||||
|
|
|
@ -54,6 +54,7 @@ tests = [
|
||||||
# 'pin_all_at_default',
|
# 'pin_all_at_default',
|
||||||
# 'instantiate_glyf',
|
# 'instantiate_glyf',
|
||||||
# 'full_instance',
|
# 'full_instance',
|
||||||
|
# 'instance_feature_variations',
|
||||||
]
|
]
|
||||||
|
|
||||||
repack_tests = [
|
repack_tests = [
|
||||||
|
|
Loading…
Reference in New Issue