Skip to content

Commit

Permalink
Allow fontmake options to pass through
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed Mar 20, 2024
1 parent 138def2 commit 14eff2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/fontra_compile/compile_fontmake_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
@dataclass(kw_only=True)
class CompileFontMakeAction:
destination: str
options: dict[str, str] = field(default_factory=dict)
input: ReadableFontBackend | None = field(init=False, default=None)

@asynccontextmanager
Expand Down Expand Up @@ -52,4 +53,10 @@ async def process(self, outputDir: os.PathLike = pathlib.Path()) -> None:
"--output-path",
os.fspath(outputFontPath),
]

for option, value in self.options.items():
command.append(f"--{option}")
if value:
command.append(value)

subprocess.run(command, check=True)
4 changes: 3 additions & 1 deletion tests/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
- action: input
source: "tests/data/MutatorSans.fontra"
- action: compile-fontmake
options:
flatten-components: # no value
destination: "output-fontmake.ttf"
""",
"MutatorSans-fontmake.ttx",
Expand Down Expand Up @@ -54,4 +56,4 @@ async def test_workflow(tmpdir, workflowSource, ttxFileName):

ttxLines = cleanupTTX(outTTXPath.read_text())
expectedLines = cleanupTTX(ttxPath.read_text())
assert expectedLines == ttxLines
assert expectedLines == ttxLines, outTTXPath

0 comments on commit 14eff2e

Please sign in to comment.