diff --git a/Tests/varLib/data/BuildAvarEmptyAxis.designspace b/Tests/varLib/data/BuildAvarEmptyAxis.designspace new file mode 100644 index 000000000..6f0d84e0e --- /dev/null +++ b/Tests/varLib/data/BuildAvarEmptyAxis.designspace @@ -0,0 +1,59 @@ + + + + + + + + + Weight + + + Width + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/BuildAvarIdentityMaps.designspace b/Tests/varLib/data/BuildAvarIdentityMaps.designspace new file mode 100644 index 000000000..a9f30bfa5 --- /dev/null +++ b/Tests/varLib/data/BuildAvarIdentityMaps.designspace @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + Weight + + + + + + + Width + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/BuildAvarSingleAxis.designspace b/Tests/varLib/data/BuildAvarSingleAxis.designspace new file mode 100644 index 000000000..889500789 --- /dev/null +++ b/Tests/varLib/data/BuildAvarSingleAxis.designspace @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + Weight + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-Bold.ttx b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-Bold.ttx new file mode 100644 index 000000000..a752bc17d --- /dev/null +++ b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-Bold.ttx @@ -0,0 +1,520 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copyright 2015 Google Inc. All Rights Reserved. + + + Test Family 3 + + + Bold + + + 1.902;GOOG;TestFamily3-Bold + + + Test Family 3 Bold + + + Version 1.902 + + + TestFamily3-Bold + + + Noto is a trademark of Google Inc. + + + Monotype Imaging Inc. + + + Monotype Design Team + + + Designed by Monotype design team. + + + http://www.google.com/get/noto/ + + + http://www.monotype.com/studio + + + This Font Software is licensed under the SIL Open Font License, Version 1.1. This Font Software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the SIL Open Font License for the specific language, permissions and limitations governing your use of this Font Software. + + + http://scripts.sil.org/OFL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-Condensed.ttx b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-Condensed.ttx new file mode 100644 index 000000000..db0372abc --- /dev/null +++ b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-Condensed.ttx @@ -0,0 +1,526 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copyright 2015 Google Inc. All Rights Reserved. + + + Test Family 3 Condensed + + + Regular + + + 1.902;GOOG;TestFamily3-Condensed + + + Test Family 3 Condensed + + + Version 1.902 + + + TestFamily3-Condensed + + + Noto is a trademark of Google Inc. + + + Monotype Imaging Inc. + + + Monotype Design Team + + + Designed by Monotype design team. + + + http://www.google.com/get/noto/ + + + http://www.monotype.com/studio + + + This Font Software is licensed under the SIL Open Font License, Version 1.1. This Font Software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the SIL Open Font License for the specific language, permissions and limitations governing your use of this Font Software. + + + http://scripts.sil.org/OFL + + + Test Family 3 + + + Condensed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-CondensedBold.ttx b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-CondensedBold.ttx new file mode 100644 index 000000000..3313ce6d4 --- /dev/null +++ b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-CondensedBold.ttx @@ -0,0 +1,526 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copyright 2015 Google Inc. All Rights Reserved. + + + Test Family 3 Condensed Bold + + + Regular + + + 1.902;GOOG;TestFamily3-CondensedBold + + + Test Family 3 Condensed Bold + + + Version 1.902 + + + TestFamily3-CondensedBold + + + Noto is a trademark of Google Inc. + + + Monotype Imaging Inc. + + + Monotype Design Team + + + Designed by Monotype design team. + + + http://www.google.com/get/noto/ + + + http://www.monotype.com/studio + + + This Font Software is licensed under the SIL Open Font License, Version 1.1. This Font Software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the SIL Open Font License for the specific language, permissions and limitations governing your use of this Font Software. + + + http://scripts.sil.org/OFL + + + Test Family 3 + + + Condensed Bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-CondensedLight.ttx b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-CondensedLight.ttx new file mode 100644 index 000000000..c83912b23 --- /dev/null +++ b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-CondensedLight.ttx @@ -0,0 +1,526 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copyright 2015 Google Inc. All Rights Reserved. + + + Test Family 3 Condensed Light + + + Regular + + + 1.902;GOOG;TestFamily3-CondensedLight + + + Test Family 3 Condensed Light + + + Version 1.902 + + + TestFamily3-CondensedLight + + + Noto is a trademark of Google Inc. + + + Monotype Imaging Inc. + + + Monotype Design Team + + + Designed by Monotype design team. + + + http://www.google.com/get/noto/ + + + http://www.monotype.com/studio + + + This Font Software is licensed under the SIL Open Font License, Version 1.1. This Font Software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the SIL Open Font License for the specific language, permissions and limitations governing your use of this Font Software. + + + http://scripts.sil.org/OFL + + + Test Family 3 + + + Condensed Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-CondensedSemiBold.ttx b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-CondensedSemiBold.ttx new file mode 100644 index 000000000..7b0c88f8c --- /dev/null +++ b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-CondensedSemiBold.ttx @@ -0,0 +1,526 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copyright 2015 Google Inc. All Rights Reserved. + + + Test Family 3 Condensed SemiBold + + + Regular + + + 1.902;GOOG;TestFamily3-CondensedSemiBold + + + Test Family 3 Condensed SemiBold + + + Version 1.902 + + + TestFamily3-CondensedSemiBold + + + Noto is a trademark of Google Inc. + + + Monotype Imaging Inc. + + + Monotype Design Team + + + Designed by Monotype design team. + + + http://www.google.com/get/noto/ + + + http://www.monotype.com/studio + + + This Font Software is licensed under the SIL Open Font License, Version 1.1. This Font Software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the SIL Open Font License for the specific language, permissions and limitations governing your use of this Font Software. + + + http://scripts.sil.org/OFL + + + Test Family 3 + + + Condensed SemiBold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-Light.ttx b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-Light.ttx new file mode 100644 index 000000000..0e84719d7 --- /dev/null +++ b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-Light.ttx @@ -0,0 +1,526 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copyright 2015 Google Inc. All Rights Reserved. + + + Test Family 3 Light + + + Regular + + + 1.902;GOOG;TestFamily3-Light + + + Test Family 3 Light + + + Version 1.902 + + + TestFamily3-Light + + + Noto is a trademark of Google Inc. + + + Monotype Imaging Inc. + + + Monotype Design Team + + + Designed by Monotype design team. + + + http://www.google.com/get/noto/ + + + http://www.monotype.com/studio + + + This Font Software is licensed under the SIL Open Font License, Version 1.1. This Font Software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the SIL Open Font License for the specific language, permissions and limitations governing your use of this Font Software. + + + http://scripts.sil.org/OFL + + + Test Family 3 + + + Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-Regular.ttx b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-Regular.ttx new file mode 100644 index 000000000..44848db23 --- /dev/null +++ b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-Regular.ttx @@ -0,0 +1,520 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copyright 2015 Google Inc. All Rights Reserved. + + + Test Family 3 + + + Regular + + + 1.902;GOOG;TestFamily3-Regular + + + Test Family 3 Regular + + + Version 1.902 + + + TestFamily3-Regular + + + Noto is a trademark of Google Inc. + + + Monotype Imaging Inc. + + + Monotype Design Team + + + Designed by Monotype design team. + + + http://www.google.com/get/noto/ + + + http://www.monotype.com/studio + + + This Font Software is licensed under the SIL Open Font License, Version 1.1. This Font Software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the SIL Open Font License for the specific language, permissions and limitations governing your use of this Font Software. + + + http://scripts.sil.org/OFL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-SemiBold.ttx b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-SemiBold.ttx new file mode 100644 index 000000000..7e6a0b326 --- /dev/null +++ b/Tests/varLib/data/master_ttx_interpolatable_ttf/TestFamily3-SemiBold.ttx @@ -0,0 +1,526 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copyright 2015 Google Inc. All Rights Reserved. + + + Test Family 3 SemiBold + + + Regular + + + 1.902;GOOG;TestFamily3-SemiBold + + + Test Family 3 SemiBold + + + Version 1.902 + + + TestFamily3-SemiBold + + + Noto is a trademark of Google Inc. + + + Monotype Imaging Inc. + + + Monotype Design Team + + + Designed by Monotype design team. + + + http://www.google.com/get/noto/ + + + http://www.monotype.com/studio + + + This Font Software is licensed under the SIL Open Font License, Version 1.1. This Font Software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the SIL Open Font License for the specific language, permissions and limitations governing your use of this Font Software. + + + http://scripts.sil.org/OFL + + + Test Family 3 + + + SemiBold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/test_results/BuildAvarEmptyAxis.ttx b/Tests/varLib/data/test_results/BuildAvarEmptyAxis.ttx new file mode 100644 index 000000000..aee6f5aec --- /dev/null +++ b/Tests/varLib/data/test_results/BuildAvarEmptyAxis.ttx @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/test_results/BuildAvarIdentityMaps.ttx b/Tests/varLib/data/test_results/BuildAvarIdentityMaps.ttx new file mode 100644 index 000000000..799d68f1d --- /dev/null +++ b/Tests/varLib/data/test_results/BuildAvarIdentityMaps.ttx @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/data/test_results/BuildAvarSingleAxis.ttx b/Tests/varLib/data/test_results/BuildAvarSingleAxis.ttx new file mode 100644 index 000000000..9daa330f5 --- /dev/null +++ b/Tests/varLib/data/test_results/BuildAvarSingleAxis.ttx @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/Tests/varLib/varLib_test.py b/Tests/varLib/varLib_test.py index 6c08c94fb..6aae6a464 100644 --- a/Tests/varLib/varLib_test.py +++ b/Tests/varLib/varLib_test.py @@ -93,51 +93,97 @@ class BuildTest(unittest.TestCase): font.save(savepath, reorderTables=None) return font, savepath + def _run_varlib_build_test(self, designspace_name, font_name, tables, + expected_ttx_name): + suffix = '.ttf' + ds_path = self.get_test_input(designspace_name + '.designspace') + ufo_dir = self.get_test_input('master_ufo') + ttx_dir = self.get_test_input('master_ttx_interpolatable_ttf') + + self.temp_dir() + ttx_paths = self.get_file_list(ttx_dir, '.ttx', font_name + '-') + for path in ttx_paths: + self.compile_font(path, suffix, self.tempdir) + + finder = lambda s: s.replace(ufo_dir, self.tempdir).replace('.ufo', suffix) + varfont, model, _ = build(ds_path, finder) + + expected_ttx_path = self.get_test_output(expected_ttx_name + '.ttx') + self.expect_ttx(varfont, expected_ttx_path, tables) + self.check_ttx_dump(varfont, expected_ttx_path, tables, suffix) # ----- # Tests # ----- def test_varlib_build_ttf(self): """Designspace file contains element.""" - suffix = '.ttf' - ds_path = self.get_test_input('Build.designspace') - ufo_dir = self.get_test_input('master_ufo') - ttx_dir = self.get_test_input('master_ttx_interpolatable_ttf') + self._run_varlib_build_test( + designspace_name='Build', + font_name='TestFamily', + tables=['GDEF', 'HVAR', 'MVAR', 'fvar', 'gvar'], + expected_ttx_name='Build' + ) - self.temp_dir() - ttx_paths = self.get_file_list(ttx_dir, '.ttx', 'TestFamily-') - for path in ttx_paths: - self.compile_font(path, suffix, self.tempdir) - - finder = lambda s: s.replace(ufo_dir, self.tempdir).replace('.ufo', suffix) - varfont, model, _ = build(ds_path, finder) - - tables = ['GDEF', 'HVAR', 'MVAR', 'fvar', 'gvar'] - expected_ttx_path = self.get_test_output('Build.ttx') - self.expect_ttx(varfont, expected_ttx_path, tables) - self.check_ttx_dump(varfont, expected_ttx_path, tables, suffix) - - - def test_varlib_build3_ttf(self): + def test_varlib_build_no_axes_ttf(self): """Designspace file does not contain an element.""" - suffix = '.ttf' - ds_path = self.get_test_input('InterpolateLayout3.designspace') - ufo_dir = self.get_test_input('master_ufo') - ttx_dir = self.get_test_input('master_ttx_interpolatable_ttf') + self._run_varlib_build_test( + designspace_name='InterpolateLayout3', + font_name='TestFamily2', + tables=['GDEF', 'HVAR', 'MVAR', 'fvar', 'gvar'], + expected_ttx_name='Build3' + ) - self.temp_dir() - ttx_paths = self.get_file_list(ttx_dir, '.ttx', 'TestFamily2-') - for path in ttx_paths: - self.compile_font(path, suffix, self.tempdir) + def test_varlib_avar_single_axis(self): + """Designspace file contains a 'weight' axis with elements + modifying the normalization mapping. An 'avar' table is generated. + """ + test_name = 'BuildAvarSingleAxis' + self._run_varlib_build_test( + designspace_name=test_name, + font_name='TestFamily3', + tables=['avar'], + expected_ttx_name=test_name + ) - finder = lambda s: s.replace(ufo_dir, self.tempdir).replace('.ufo', suffix) - varfont, model, _ = build(ds_path, finder) + def test_varlib_avar_with_identity_maps(self): + """Designspace file contains two 'weight' and 'width' axes both with + elements. - tables = ['GDEF', 'HVAR', 'MVAR', 'fvar', 'gvar'] - expected_ttx_path = self.get_test_output('Build3.ttx') - self.expect_ttx(varfont, expected_ttx_path, tables) - self.check_ttx_dump(varfont, expected_ttx_path, tables, suffix) + The 'width' axis only contains identity mappings, however the resulting + avar segment will not be empty but will contain the default axis value + maps: {-1.0: -1.0, 0.0: 0.0, 1.0: 1.0}. + This is to to work around an issue with some rasterizers: + https://github.com/googlei18n/fontmake/issues/295 + https://github.com/fonttools/fonttools/issues/1011 + """ + test_name = 'BuildAvarIdentityMaps' + self._run_varlib_build_test( + designspace_name=test_name, + font_name='TestFamily3', + tables=['avar'], + expected_ttx_name=test_name + ) + + def test_varlib_avar_empty_axis(self): + """Designspace file contains two 'weight' and 'width' axes, but + only one axis ('weight') has some elements. + + Even if no elements are defined for the 'width' axis, the + resulting avar segment still contains the default axis value maps: + {-1.0: -1.0, 0.0: 0.0, 1.0: 1.0}. + + This is again to to work around an issue with some rasterizers: + https://github.com/googlei18n/fontmake/issues/295 + https://github.com/fonttools/fonttools/issues/1011 + """ + test_name = 'BuildAvarEmptyAxis' + self._run_varlib_build_test( + designspace_name=test_name, + font_name='TestFamily3', + tables=['avar'], + expected_ttx_name=test_name + ) def test_varlib_main_ttf(self): """Mostly for testing varLib.main()