diff --git a/Lib/fontTools/otlLib/optimize/__init__.py b/Lib/fontTools/otlLib/optimize/__init__.py index d39bb28d1..5c007e891 100644 --- a/Lib/fontTools/otlLib/optimize/__init__.py +++ b/Lib/fontTools/otlLib/optimize/__init__.py @@ -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) diff --git a/Tests/otlLib/optimize_test.py b/Tests/otlLib/optimize_test.py index c2f2468eb..4201aed09 100644 --- a/Tests/otlLib/optimize_test.py +++ b/Tests/otlLib/optimize_test.py @@ -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()