Skip to content

Commit

Permalink
Merge pull request #874 from googlefonts/ellipsis-in-filters
Browse files Browse the repository at this point in the history
accept '...' in --filter/--feature-writer options to extend preexisting
  • Loading branch information
anthrotype authored Apr 8, 2022
2 parents b5a482f + da335f6 commit 5b5a126
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
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
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fonttools[unicode,lxml,ufo]==4.29.1
fonttools[unicode,lxml,ufo]==4.32.0
cu2qu==1.6.7.post1
glyphsLib==6.0.4
ufo2ft[pathops]==2.25.3
ufo2ft[pathops]==2.27.0
MutatorMath==3.0.1
fontMath==0.9.1
defcon[lxml]==0.10.0; platform_python_implementation == 'CPython'
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
setup_requires=wheel + ["setuptools_scm"],
python_requires=">=3.7",
install_requires=[
"fonttools[ufo,lxml,unicode]>=4.28.5",
"fonttools[ufo,lxml,unicode]>=4.32.0",
"glyphsLib>=6.0.4",
"ufo2ft[compreffor]>=2.25.2",
"ufo2ft[compreffor]>=2.27.0",
"fontMath>=0.9.1",
"ufoLib2>=0.13.0",
"attrs>=19",
Expand Down

0 comments on commit 5b5a126

Please sign in to comment.