From 79302f3a7c4a3bb39265c48f9e0d40e4972dc77b Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Mon, 12 Jun 2023 16:41:38 +0100 Subject: [PATCH 1/2] bump fonttools and ufo2ft min requirements newest ufo2ft no longer requires standalone cu2qu --- requirements.txt | 7 +++---- setup.py | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/requirements.txt b/requirements.txt index 5e68a2ba..2b8dfd3d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,7 @@ -fonttools[unicode,ufo,lxml]==4.39.3; platform_python_implementation == 'CPython' -fonttools[unicode,ufo]==4.39.3; platform_python_implementation != 'CPython' -cu2qu==1.6.7.post1 +fonttools[unicode,ufo,lxml]==4.40.0; platform_python_implementation == 'CPython' +fonttools[unicode,ufo]==4.40.0; platform_python_implementation != 'CPython' glyphsLib==6.2.1 -ufo2ft==2.31.1 +ufo2ft==2.32.0 MutatorMath==3.0.1 fontMath==0.9.3 defcon[lxml]==0.10.2; platform_python_implementation == 'CPython' diff --git a/setup.py b/setup.py index b6f33824..98085be0 100644 --- a/setup.py +++ b/setup.py @@ -55,10 +55,10 @@ setup_requires=wheel + ["setuptools_scm"], python_requires=">=3.8", install_requires=[ - "fonttools[ufo,lxml,unicode]>=4.39.3 ; implementation_name == 'cpython'", - "fonttools[ufo,unicode]>=4.39.3 ; implementation_name != 'cpython'", + "fonttools[ufo,lxml,unicode]>=4.40.0 ; implementation_name == 'cpython'", + "fonttools[ufo,unicode]>=4.40.0 ; implementation_name != 'cpython'", "glyphsLib>=6.2.1", - "ufo2ft[compreffor]>=2.31.1", + "ufo2ft[compreffor]>=2.32.0", "fontMath>=0.9.3", "ufoLib2>=0.14.0", "attrs>=19", From 46ad66bc18901c7b422500e4de51c6e27edc7f04 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Thu, 8 Jun 2023 12:45:40 +0100 Subject: [PATCH 2/2] add option to --drop-implied-oncurves requires not-yet-released ufo2ft and fonttools https://github.com/googlefonts/ufo2ft/pull/753 --- Lib/fontmake/__main__.py | 6 ++++++ Lib/fontmake/font_project.py | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/Lib/fontmake/__main__.py b/Lib/fontmake/__main__.py index aceb5074..a25c75e0 100644 --- a/Lib/fontmake/__main__.py +++ b/Lib/fontmake/__main__.py @@ -510,6 +510,12 @@ def main(args=None): action="store_false", help="Don't automatically set USE_MY_METRICS glyf component flags (0x0200).", ) + contourGroup.add_argument( + "--drop-implied-oncurves", + action="store_true", + help="drop on-curve points that can be implied when exactly in the middle of " + "two off-curve points (TrueType only; default: %(default)s).", + ) layoutGroup = parser.add_argument_group(title="Handling of OpenType Layout") layoutGroup.add_argument( diff --git a/Lib/fontmake/font_project.py b/Lib/fontmake/font_project.py index 9694d56f..5a2ee9e7 100644 --- a/Lib/fontmake/font_project.py +++ b/Lib/fontmake/font_project.py @@ -372,6 +372,7 @@ def build_variable_fonts( flatten_components=False, filters=None, auto_use_my_metrics=True, + drop_implied_oncurves=False, **kwargs, ): """Build OpenType variable fonts from masters in a designspace.""" @@ -434,6 +435,7 @@ def build_variable_fonts( inplace=True, variableFontNames=list(vf_name_to_output_path), autoUseMyMetrics=auto_use_my_metrics, + dropImpliedOnCurves=drop_implied_oncurves, ) else: fonts = ufo2ft.compileVariableCFF2s( @@ -466,6 +468,7 @@ def _iter_compile(self, ufos, ttf=False, debugFeatureFile=None, **kwargs): "reverseDirection", "flattenComponents", "autoUseMyMetrics", + "dropImpliedOnCurves", ): options.pop(key, None) compile_func, fmt = ufo2ft.compileOTF, "OTF" @@ -513,6 +516,7 @@ def save_otfs( generate_GDEF=True, fea_include_dir=None, auto_use_my_metrics=True, + drop_implied_oncurves=False, ): """Build OpenType binaries from UFOs. @@ -570,6 +574,8 @@ def save_otfs( be disabled with other arguments. auto_use_my_metrics: whether to automatically set USE_MY_METRICS glyf component flags (0x0200). Not needed unless the font has hinted metrics. + drop_implied_oncurves: drop on-curve points that can be implied when exactly + in the middle of two off-curve points (TrueType only; default: False). """ # noqa: B950 assert not (output_path and output_dir), "mutually exclusive args" @@ -624,6 +630,7 @@ def save_otfs( flattenComponents=flatten_components, filters=filters, autoUseMyMetrics=auto_use_my_metrics, + dropImpliedOnCurves=drop_implied_oncurves, inplace=True, # avoid extra copy )