Skip to content

Commit

Permalink
add --no-auto-use-my-metrics to disable setting USE_MY_METRICS in ufo2ft
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Apr 20, 2023
1 parent 98f48e1 commit 62a5b63
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Lib/fontmake/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
9 changes: 9 additions & 0 deletions Lib/fontmake/font_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -615,6 +623,7 @@ def save_otfs(
subroutinizer=subroutinizer,
flattenComponents=flatten_components,
filters=filters,
autoUseMyMetrics=auto_use_my_metrics,
inplace=True, # avoid extra copy
)

Expand Down

0 comments on commit 62a5b63

Please sign in to comment.