def test_custom_layer_compilation_interpolatable_otf_from_ds( designspace, inplace): result = compileInterpolatableOTFsFromDS(designspace, inplace=inplace) assert (designspace is result) == inplace master_otfs = [s.font for s in result.sources] assert master_otfs[0].getGlyphOrder() == [ ".notdef", "a", "e", "s", "dotabovecomb", "edotabove", ] assert master_otfs[1].getGlyphOrder() == [".notdef", "e"] assert master_otfs[2].getGlyphOrder() == [ ".notdef", "a", "e", "s", "dotabovecomb", "edotabove", ] sparse_tables = [ tag for tag in master_otfs[1].keys() if tag != "GlyphOrder" ] assert SPARSE_OTF_MASTER_TABLES.issuperset(sparse_tables)
def _build_interpolatable_masters( self, designspace, ttf, use_production_names=None, reverse_direction=True, conversion_error=None, feature_writers=None, cff_round_tolerance=None, **kwargs, ): designspace = self._load_designspace_sources(designspace) if ttf: return ufo2ft.compileInterpolatableTTFsFromDS( designspace, useProductionNames=use_production_names, reverseDirection=reverse_direction, cubicConversionError=conversion_error, featureWriters=feature_writers, inplace=True, ) else: return ufo2ft.compileInterpolatableOTFsFromDS( designspace, useProductionNames=use_production_names, roundTolerance=cff_round_tolerance, featureWriters=feature_writers, inplace=True, )
def _build_interpolatable_masters(self, designspace, ttf, use_production_names=None, reverse_direction=True, conversion_error=None, feature_writers=None, cff_round_tolerance=None, **kwargs): if hasattr(designspace, "__fspath__"): ds_path = designspace.__fspath__() if isinstance(designspace, basestring): ds_path = designspace else: # reload designspace from its path so we have a new copy # that can be modified in-place. ds_path = designspace.path if ds_path is not None: designspace = designspaceLib.DesignSpaceDocument.fromfile(ds_path) self._load_designspace_sources(designspace) if ttf: return ufo2ft.compileInterpolatableTTFsFromDS( designspace, useProductionNames=use_production_names, reverseDirection=reverse_direction, cubicConversionError=conversion_error, featureWriters=feature_writers, inplace=True, ) else: return ufo2ft.compileInterpolatableOTFsFromDS( designspace, useProductionNames=use_production_names, roundTolerance=cff_round_tolerance, featureWriters=feature_writers, inplace=True, )