def test_varlib_interpolate_layout_main_ttf(self): """Mostly for testing varLib.interpolate_layout.main() """ 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.temp_dir() ttf_dir = os.path.join(self.tempdir, 'master_ttf_interpolatable') os.makedirs(ttf_dir) ttx_paths = self.get_file_list(ttx_dir, '.ttx', 'TestFamily-') for path in ttx_paths: self.compile_font(path, suffix, ttf_dir) finder = lambda s: s.replace(ufo_dir, ttf_dir).replace('.ufo', suffix) varfont, _, _ = build(ds_path, finder) varfont_name = 'InterpolateLayoutMain' varfont_path = os.path.join(self.tempdir, varfont_name + suffix) varfont.save(varfont_path) ds_copy = os.path.splitext(varfont_path)[0] + '.designspace' shutil.copy2(ds_path, ds_copy) args = [ds_copy, 'weight=500', 'contrast=50'] interpolate_layout_main(args) instfont_path = os.path.splitext( varfont_path)[0] + '-instance' + suffix instfont = TTFont(instfont_path) tables = [ table_tag for table_tag in instfont.keys() if table_tag != 'head' ] expected_ttx_path = self.get_test_output(varfont_name + '.ttx') self.expect_ttx(instfont, expected_ttx_path, tables)
def test_varlib_interpolate_layout_main_ttf(self): """Mostly for testing varLib.interpolate_layout.main() """ 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.temp_dir() ttf_dir = os.path.join(self.tempdir, 'master_ttf_interpolatable') os.makedirs(ttf_dir) ttx_paths = self.get_file_list(ttx_dir, '.ttx', 'TestFamily-') for path in ttx_paths: self.compile_font(path, suffix, ttf_dir) finder = lambda s: s.replace(ufo_dir, ttf_dir).replace('.ufo', suffix) varfont, _, _ = build(ds_path, finder) varfont_name = 'InterpolateLayoutMain' varfont_path = os.path.join(self.tempdir, varfont_name + suffix) varfont.save(varfont_path) ds_copy = os.path.splitext(varfont_path)[0] + '.designspace' shutil.copy2(ds_path, ds_copy) args = [ds_copy, 'weight=500', 'contrast=50'] interpolate_layout_main(args) instfont_path = os.path.splitext(varfont_path)[0] + '-instance' + suffix instfont = TTFont(instfont_path) tables = [table_tag for table_tag in instfont.keys() if table_tag != 'head'] expected_ttx_path = self.get_test_output(varfont_name + '.ttx') self.expect_ttx(instfont, expected_ttx_path, tables)