Skip to content

Commit

Permalink
Merge pull request #1005 from googlefonts/drop-implied-oncurves
Browse files Browse the repository at this point in the history
add option to --drop-implied-oncurves
  • Loading branch information
anthrotype authored Jun 12, 2023
2 parents 27387a0 + 46ad66b commit 7f262a7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
6 changes: 6 additions & 0 deletions Lib/fontmake/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 7 additions & 0 deletions Lib/fontmake/font_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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
)

Expand Down
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 7f262a7

Please sign in to comment.