Fix typing error

This commit is contained in:
Jany Belluz 2021-06-30 14:04:13 +01:00
parent 3b34b228dd
commit ef67839fdb
2 changed files with 24 additions and 3 deletions

View File

@ -51,7 +51,8 @@ def main(args=None):
)
font = TTFont(options.font)
compact(font, options.gpos_compact_mode)
# TODO: switch everything to have type(mode) = int when using the Config class
compact(font, str(options.gpos_compact_mode))
font.save(options.outfile or options.font)

View File

@ -7,10 +7,12 @@ from fontTools.fontBuilder import FontBuilder
def test_main(tmpdir: Path):
"""Check that calling the main function on an input TTF works."""
glyphs = ".notdef space A B".split()
glyphs = ".notdef space A Aacute B D".split()
features = """
@A = [A Aacute];
@B = [B D];
feature kern {
pos A B -50;
pos @A @B -50;
} kern;
"""
fb = FontBuilder(1000)
@ -32,3 +34,21 @@ def test_main(tmpdir: Path):
check=True,
)
assert output.exists()
def test_off_by_default(tmpdir: Path):
"""Check that calling the main function on an input TTF works."""
glyphs = ".notdef space A B".split()
features = """
feature kern {
pos A B -50;
} kern;
"""
fb = FontBuilder(1000)
fb.setupGlyphOrder(glyphs)
addOpenTypeFeaturesFromString(fb.font, features)
input = tmpdir / "in.ttf"
fb.save(str(input))
output = tmpdir / "out.ttf"
run(["fonttools", "otlLib.optimize", str(input), "-o", str(output)], check=True)
assert output.exists()