diff --git a/Tests/varLib/data/TestNoOverwriteSTAT.designspace b/Tests/varLib/data/TestNoOverwriteSTAT.designspace new file mode 100644 index 000000000..e06a1be55 --- /dev/null +++ b/Tests/varLib/data/TestNoOverwriteSTAT.designspace @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/master_no_overwrite_stat/Test-CondensedBlack.ttx b/Tests/varLib/data/master_no_overwrite_stat/Test-CondensedBlack.ttx new file mode 100644 index 000000000..db687a9f4 --- /dev/null +++ b/Tests/varLib/data/master_no_overwrite_stat/Test-CondensedBlack.ttx @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Test Condensed Black + + + Regular + + + 3.013;NONE;Test-CondensedBlack + + + Test Condensed Black + + + Version 3.013 + + + Test-CondensedBlack + + + Test + + + Condensed Black + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/master_no_overwrite_stat/Test-CondensedThin.ttx b/Tests/varLib/data/master_no_overwrite_stat/Test-CondensedThin.ttx new file mode 100644 index 000000000..e3d164641 --- /dev/null +++ b/Tests/varLib/data/master_no_overwrite_stat/Test-CondensedThin.ttx @@ -0,0 +1,373 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Test Condensed Thin + + + Regular + + + 3.013;NONE;Test-CondensedThin + + + Test Condensed Thin + + + Version 3.013 + + + Test-CondensedThin + + + Test + + + Condensed Thin + + + Standard + + + Heaviness + + + Extralight + + + Thin + + + Light + + + Regular + + + Medium + + + Semibold + + + Bold + + + Wideness + + + Compressed + + + Condensed + + + Normal + + + Extended + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/master_no_overwrite_stat/Test-ExtendedBlack.ttx b/Tests/varLib/data/master_no_overwrite_stat/Test-ExtendedBlack.ttx new file mode 100644 index 000000000..8dc693993 --- /dev/null +++ b/Tests/varLib/data/master_no_overwrite_stat/Test-ExtendedBlack.ttx @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Test Extended Black + + + Regular + + + 3.013;NONE;Test-ExtendedBlack + + + Test Extended Black + + + Version 3.013 + + + Test-ExtendedBlack + + + Test + + + Extended Black + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/master_no_overwrite_stat/Test-ExtendedThin.ttx b/Tests/varLib/data/master_no_overwrite_stat/Test-ExtendedThin.ttx new file mode 100644 index 000000000..d9209eddf --- /dev/null +++ b/Tests/varLib/data/master_no_overwrite_stat/Test-ExtendedThin.ttx @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Test Extended Thin + + + Regular + + + 3.013;NONE;Test-ExtendedThin + + + Test Extended Thin + + + Version 3.013 + + + Test-ExtendedThin + + + Test + + + Extended Thin + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/varLib_test.py b/Tests/varLib/varLib_test.py index c19a8a8ca..a8f7a4574 100644 --- a/Tests/varLib/varLib_test.py +++ b/Tests/varLib/varLib_test.py @@ -1,7 +1,7 @@ from fontTools.colorLib.builder import buildCOLR from fontTools.ttLib import TTFont, newTable from fontTools.ttLib.tables import otTables as ot -from fontTools.varLib import build, load_designspace, _add_COLR +from fontTools.varLib import build, build_many, load_designspace, _add_COLR from fontTools.varLib.errors import VarLibValidationError import fontTools.varLib.errors as varLibErrors from fontTools.varLib.models import VariationModel @@ -538,6 +538,29 @@ class BuildTest(unittest.TestCase): self.assertTrue(os.path.isdir(outdir)) self.assertTrue(os.path.exists(os.path.join(outdir, "BuildMain-VF.ttf"))) + def test_varLib_build_many_no_overwrite_STAT(self): + # Ensure that varLib.build_many doesn't overwrite a pre-existing STAT table, + # e.g. one built by feaLib from features.fea; the VF simply should inherit the + # STAT from the base master: https://github.com/googlefonts/fontmake/issues/985 + base_master = TTFont() + base_master.importXML( + self.get_test_input("master_no_overwrite_stat/Test-CondensedThin.ttx") + ) + assert "STAT" in base_master + + vf = next( + iter( + build_many( + DesignSpaceDocument.fromfile( + self.get_test_input("TestNoOverwriteSTAT.designspace") + ) + ).values() + ) + ) + assert "STAT" in vf + + assert vf["STAT"].table == base_master["STAT"].table + def test_varlib_build_from_ds_object_in_memory_ttfonts(self): ds_path = self.get_test_input("Build.designspace") ttx_dir = self.get_test_input("master_ttx_interpolatable_ttf")