Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add --no-auto-use-my-metrics to disable setting USE_MY_METRICS in ufo2ft #994

Merged
merged 1 commit into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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