Skip to content

Commit 46ad66b

Browse files
committed
add option to --drop-implied-oncurves
requires not-yet-released ufo2ft and fonttools googlefonts/ufo2ft#753
1 parent 79302f3 commit 46ad66b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Lib/fontmake/__main__.py

+6
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,12 @@ def main(args=None):
510510
action="store_false",
511511
help="Don't automatically set USE_MY_METRICS glyf component flags (0x0200).",
512512
)
513+
contourGroup.add_argument(
514+
"--drop-implied-oncurves",
515+
action="store_true",
516+
help="drop on-curve points that can be implied when exactly in the middle of "
517+
"two off-curve points (TrueType only; default: %(default)s).",
518+
)
513519

514520
layoutGroup = parser.add_argument_group(title="Handling of OpenType Layout")
515521
layoutGroup.add_argument(

Lib/fontmake/font_project.py

+7
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ def build_variable_fonts(
372372
flatten_components=False,
373373
filters=None,
374374
auto_use_my_metrics=True,
375+
drop_implied_oncurves=False,
375376
**kwargs,
376377
):
377378
"""Build OpenType variable fonts from masters in a designspace."""
@@ -434,6 +435,7 @@ def build_variable_fonts(
434435
inplace=True,
435436
variableFontNames=list(vf_name_to_output_path),
436437
autoUseMyMetrics=auto_use_my_metrics,
438+
dropImpliedOnCurves=drop_implied_oncurves,
437439
)
438440
else:
439441
fonts = ufo2ft.compileVariableCFF2s(
@@ -466,6 +468,7 @@ def _iter_compile(self, ufos, ttf=False, debugFeatureFile=None, **kwargs):
466468
"reverseDirection",
467469
"flattenComponents",
468470
"autoUseMyMetrics",
471+
"dropImpliedOnCurves",
469472
):
470473
options.pop(key, None)
471474
compile_func, fmt = ufo2ft.compileOTF, "OTF"
@@ -513,6 +516,7 @@ def save_otfs(
513516
generate_GDEF=True,
514517
fea_include_dir=None,
515518
auto_use_my_metrics=True,
519+
drop_implied_oncurves=False,
516520
):
517521
"""Build OpenType binaries from UFOs.
518522
@@ -570,6 +574,8 @@ def save_otfs(
570574
be disabled with other arguments.
571575
auto_use_my_metrics: whether to automatically set USE_MY_METRICS glyf
572576
component flags (0x0200). Not needed unless the font has hinted metrics.
577+
drop_implied_oncurves: drop on-curve points that can be implied when exactly
578+
in the middle of two off-curve points (TrueType only; default: False).
573579
""" # noqa: B950
574580
assert not (output_path and output_dir), "mutually exclusive args"
575581

@@ -624,6 +630,7 @@ def save_otfs(
624630
flattenComponents=flatten_components,
625631
filters=filters,
626632
autoUseMyMetrics=auto_use_my_metrics,
633+
dropImpliedOnCurves=drop_implied_oncurves,
627634
inplace=True, # avoid extra copy
628635
)
629636

0 commit comments

Comments
 (0)