Skip to content

Commit

Permalink
add option to disable ufo2ft variable FEA, restore varLib merging of …
Browse files Browse the repository at this point in the history
…OTL tables

this is meant to work with googlefonts/ufo2ft#635
  • Loading branch information
anthrotype committed Jan 11, 2024
1 parent 2abf1eb commit 72c30cf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Lib/fontmake/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,16 @@ def main(args=None):
"features (kern, mark, mkmk, etc.)."
),
)
layoutGroup.add_argument(
"--no-variable-features",
action="store_false",
dest="variable_features",
help=(
"Disable generation of variable FEA in ufo2ft when compiling VFs; "
"instead build separate OT layout tables for each master and merge "
"them with varLib."
),
)

feaCompilerGroup = layoutGroup.add_mutually_exclusive_group(required=False)
feaCompilerGroup.add_argument(
Expand Down Expand Up @@ -680,7 +690,7 @@ def main(args=None):
exclude_args(
parser,
args,
["variable_fonts", "optimize_gvar"],
["variable_fonts", "optimize_gvar", "variable_features"],
"static output",
positive=False,
)
Expand Down
8 changes: 8 additions & 0 deletions Lib/fontmake/font_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ def build_variable_fonts(
filters=None,
auto_use_my_metrics=True,
drop_implied_oncurves=False,
variable_features=True,
**kwargs,
):
"""Build OpenType variable fonts from masters in a designspace."""
Expand Down Expand Up @@ -464,6 +465,7 @@ def build_variable_fonts(
variableFontNames=list(vf_name_to_output_path),
autoUseMyMetrics=auto_use_my_metrics,
dropImpliedOnCurves=drop_implied_oncurves,
variableFeatures=variable_features,
)
else:
fonts = ufo2ft.compileVariableCFF2s(
Expand All @@ -477,6 +479,7 @@ def build_variable_fonts(
filters=filters,
inplace=True,
variableFontNames=list(vf_name_to_output_path),
variableFeatures=variable_features,
)

for name, font in fonts.items():
Expand Down Expand Up @@ -1086,6 +1089,7 @@ def run_from_designspace(
interpolate_binary_layout=False,
round_instances=False,
feature_writers=None,
variable_features=True,
filters=None,
expand_features_to_instances=False,
check_compatibility=None,
Expand Down Expand Up @@ -1204,6 +1208,7 @@ def run_from_designspace(
variable_fonts=variable_fonts,
feature_writers=feature_writers,
filters=filters,
variable_features=variable_features,
**kwargs,
)
except FontmakeError as e:
Expand Down Expand Up @@ -1293,6 +1298,7 @@ def _run_from_designspace_interpolatable(
designspace,
outputs,
variable_fonts: str = ".*",
variable_features=True,
output_path=None,
output_dir=None,
**kwargs,
Expand All @@ -1303,6 +1309,7 @@ def _run_from_designspace_interpolatable(
self.build_variable_fonts(
designspace,
variable_fonts=variable_fonts,
variable_features=variable_features,
output_path=output_path,
output_dir=output_dir,
**kwargs,
Expand All @@ -1316,6 +1323,7 @@ def _run_from_designspace_interpolatable(
self.build_variable_fonts(
designspace,
variable_fonts=variable_fonts,
variable_features=variable_features,
output_path=output_path,
output_dir=output_dir,
ttf=False,
Expand Down

0 comments on commit 72c30cf

Please sign in to comment.