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

accept '...' in --filter/--feature-writer options to extend preexisting #874

Merged
merged 2 commits into from
Apr 8, 2022
Merged
Changes from 1 commit
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
19 changes: 17 additions & 2 deletions Lib/fontmake/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,23 @@

def _loadPlugins(parser, specs, from_string_func, parser_error_message):
plugins = []
seen_ellipsis = False
for s in specs:
if s == "None":
# magic value that means "don't write any features or don't apply
# any filters!"
return []
elif s == "...":
if seen_ellipsis:
parser.error(
parser_error_message.format(
"ValueError", "'...' can only be provided once"
)
)
seen_ellipsis = True
plugins.append(...)
continue

try:
plugins.append(from_string_func(s))
except Exception as e:
Expand Down Expand Up @@ -425,7 +437,8 @@ def main(args=None):
"the given keyword arguments. The class and module names are "
"separated by '::'. The option can be repeated multiple times "
"for each filter class. The option overrides the filters specified "
"in the UFO lib.",
"in the UFO lib. You can use an ellipsis --filter='...' to keep the "
"latter and insert additional --filter(s), either before or after it.",
)

layoutGroup = parser.add_argument_group(title="Handling of OpenType Layout")
Expand All @@ -449,7 +462,9 @@ def main(args=None):
"separated by '::'. The option can be repeated multiple times "
"for each writer class. A special value of 'None' will disable "
"all automatic feature generation. The option overrides both the "
"default ufo2ft writers and those specified in the UFO lib.",
"default ufo2ft writers and those specified in the UFO lib. "
"You can use ellipsis --feature-writer='...' to keep the latter and "
"insert additional --feature-writer(s) either before or after those.",
)
layoutGroup.add_argument(
"--debug-feature-file",
Expand Down