From 62a5b63481398abbcccbf9eab317d4a3146b18c6 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Thu, 20 Apr 2023 16:18:33 +0100 Subject: [PATCH] add --no-auto-use-my-metrics to disable setting USE_MY_METRICS in ufo2ft Requires https://github.com/googlefonts/ufo2ft/pull/741 --- Lib/fontmake/__main__.py | 6 ++++++ Lib/fontmake/font_project.py | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/Lib/fontmake/__main__.py b/Lib/fontmake/__main__.py index fc914182..aceb5074 100644 --- a/Lib/fontmake/__main__.py +++ b/Lib/fontmake/__main__.py @@ -504,6 +504,12 @@ def main(args=None): "in the UFO lib. You can use an ellipsis --filter='...' to keep the " "latter and insert additional --filter(s), either before or after it.", ) + contourGroup.add_argument( + "--no-auto-use-my-metrics", + dest="auto_use_my_metrics", + action="store_false", + help="Don't automatically set USE_MY_METRICS glyf component flags (0x0200).", + ) 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 eb065a4d..9694d56f 100644 --- a/Lib/fontmake/font_project.py +++ b/Lib/fontmake/font_project.py @@ -312,6 +312,7 @@ def _build_interpolatable_masters( fea_include_dir=None, flatten_components=False, filters=None, + auto_use_my_metrics=True, **kwargs, ): if ttf: @@ -325,6 +326,7 @@ def _build_interpolatable_masters( feaIncludeDir=fea_include_dir, filters=filters, flattenComponents=flatten_components, + autoUseMyMetrics=auto_use_my_metrics, inplace=True, ) else: @@ -369,6 +371,7 @@ def build_variable_fonts( fea_include_dir=None, flatten_components=False, filters=None, + auto_use_my_metrics=True, **kwargs, ): """Build OpenType variable fonts from masters in a designspace.""" @@ -430,6 +433,7 @@ def build_variable_fonts( filters=filters, inplace=True, variableFontNames=list(vf_name_to_output_path), + autoUseMyMetrics=auto_use_my_metrics, ) else: fonts = ufo2ft.compileVariableCFF2s( @@ -461,6 +465,7 @@ def _iter_compile(self, ufos, ttf=False, debugFeatureFile=None, **kwargs): "cubicConversionError", "reverseDirection", "flattenComponents", + "autoUseMyMetrics", ): options.pop(key, None) compile_func, fmt = ufo2ft.compileOTF, "OTF" @@ -507,6 +512,7 @@ def save_otfs( filters=None, generate_GDEF=True, fea_include_dir=None, + auto_use_my_metrics=True, ): """Build OpenType binaries from UFOs. @@ -562,6 +568,8 @@ def save_otfs( pre-filters or post-filters, called before or after the default filters. The default filters are format specific and some can 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. """ # noqa: B950 assert not (output_path and output_dir), "mutually exclusive args" @@ -615,6 +623,7 @@ def save_otfs( subroutinizer=subroutinizer, flattenComponents=flatten_components, filters=filters, + autoUseMyMetrics=auto_use_my_metrics, inplace=True, # avoid extra copy )