From 5d59e68d06a4baccefea9fc70acb8ab72b34ddae Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Wed, 27 Aug 2025 12:44:03 +0100 Subject: [PATCH] Don't do autoUseMyMetrics by default for variable fonts same as https://github.com/googlefonts/fontmake/pull/1154, for when ufo2ft is called programmatically as opposed to through fontmake CLI --- .../_compilers/interpolatableTTFCompiler.py | 2 +- Lib/ufo2ft/_compilers/variableTTFsCompiler.py | 2 +- tests/data/TestFont-interpolatable.ttx | 598 ++++++++++++++++++ .../TestVariableFont-TTF-not-allQuadratic.ttx | 2 +- tests/data/TestVariableFont-TTF-post3.ttx | 2 +- ...estVariableFont-TTF-useProductionNames.ttx | 2 +- tests/data/TestVariableFont-TTF.ttx | 2 +- tests/integration_test.py | 4 +- 8 files changed, 606 insertions(+), 8 deletions(-) create mode 100644 tests/data/TestFont-interpolatable.ttx diff --git a/Lib/ufo2ft/_compilers/interpolatableTTFCompiler.py b/Lib/ufo2ft/_compilers/interpolatableTTFCompiler.py index f797b8485..496f69fc2 100644 --- a/Lib/ufo2ft/_compilers/interpolatableTTFCompiler.py +++ b/Lib/ufo2ft/_compilers/interpolatableTTFCompiler.py @@ -22,7 +22,7 @@ class InterpolatableTTFCompiler(BaseInterpolatableCompiler): layerNames: Optional[str] = None colrLayerReuse: bool = False colrAutoClipBoxes: bool = False - autoUseMyMetrics: bool = True + autoUseMyMetrics: bool = False allQuadratic: bool = True skipFeatureCompilation: bool = False diff --git a/Lib/ufo2ft/_compilers/variableTTFsCompiler.py b/Lib/ufo2ft/_compilers/variableTTFsCompiler.py index e9e75b7cb..f296fe5e3 100644 --- a/Lib/ufo2ft/_compilers/variableTTFsCompiler.py +++ b/Lib/ufo2ft/_compilers/variableTTFsCompiler.py @@ -18,7 +18,7 @@ class VariableTTFsCompiler(InterpolatableTTFCompiler): excludeVariationTables: tuple = () optimizeGvar: bool = True colrAutoClipBoxes: bool = False - autoUseMyMetrics: bool = True + autoUseMyMetrics: bool = False dropImpliedOnCurves: bool = False allQuadratic: bool = True variableFeatures: bool = True diff --git a/tests/data/TestFont-interpolatable.ttx b/tests/data/TestFont-interpolatable.ttx new file mode 100644 index 000000000..cfd71f372 --- /dev/null +++ b/tests/data/TestFont-interpolatable.ttx @@ -0,0 +1,598 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Unique Font Identifier + + + Copyright © Some Foundry. + + + Some Font Regular (Style Map Family Name) + + + Regular + + + OpenType name Table Unique ID + + + Some Font (Preferred Family Name) Regular (Preferred Subfamily Name) + + + OpenType name Table Version + + + SomeFont-Regular Postscript Font Name + + + Trademark Some Foundry + + + Some Foundry (Manufacturer Name) + + + Some Designer + + + Some Font by Some Designer for Some Foundry. + + + http://somefoundry.com + + + http://somedesigner.com + + + License info for Some Foundry. + + + http://somefoundry.com/license + + + Some Font (Preferred Family Name) + + + Regular (Preferred Subfamily Name) + + + Some Font Regular (Compatible Full Name) + + + Sample Text for Some Font. + + + Some Font (WWS Family Name) + + + Regular (WWS Subfamily Name) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0001beef + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/TestVariableFont-TTF-not-allQuadratic.ttx b/tests/data/TestVariableFont-TTF-not-allQuadratic.ttx index de78095af..ceb210387 100644 --- a/tests/data/TestVariableFont-TTF-not-allQuadratic.ttx +++ b/tests/data/TestVariableFont-TTF-not-allQuadratic.ttx @@ -91,7 +91,7 @@ - + diff --git a/tests/data/TestVariableFont-TTF-post3.ttx b/tests/data/TestVariableFont-TTF-post3.ttx index c730d6369..60b55f0a8 100644 --- a/tests/data/TestVariableFont-TTF-post3.ttx +++ b/tests/data/TestVariableFont-TTF-post3.ttx @@ -222,7 +222,7 @@ - + diff --git a/tests/data/TestVariableFont-TTF-useProductionNames.ttx b/tests/data/TestVariableFont-TTF-useProductionNames.ttx index 4f365f3f6..81303b292 100644 --- a/tests/data/TestVariableFont-TTF-useProductionNames.ttx +++ b/tests/data/TestVariableFont-TTF-useProductionNames.ttx @@ -240,7 +240,7 @@ - + diff --git a/tests/data/TestVariableFont-TTF.ttx b/tests/data/TestVariableFont-TTF.ttx index b36a9c5ff..ecfed3533 100644 --- a/tests/data/TestVariableFont-TTF.ttx +++ b/tests/data/TestVariableFont-TTF.ttx @@ -232,7 +232,7 @@ - + diff --git a/tests/integration_test.py b/tests/integration_test.py index efb507c9a..3a9828e8c 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -177,8 +177,8 @@ def test_interpolatableTTFs_lazy(self, FontClass): # two same UFOs **must** be interpolatable ufos = [FontClass(getpath("TestFont.ufo")) for _ in range(2)] ttfs = list(compileInterpolatableTTFs(ufos)) - expectTTX(ttfs[0], "TestFont.ttx") - expectTTX(ttfs[1], "TestFont.ttx") + expectTTX(ttfs[0], "TestFont-interpolatable.ttx") + expectTTX(ttfs[1], "TestFont-interpolatable.ttx") @pytest.mark.parametrize( "cff_version, expected_ttx",