Skip to content

Commit

Permalink
If TYPST_FONT_PATHS is set, pass it through
Browse files Browse the repository at this point in the history
Other our internal use of `--font-path` will override the value
  • Loading branch information
cderv committed Nov 15, 2023
1 parent eb36ef9 commit 87f1fed
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/core/typst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ export function typstBinaryPath() {
architectureToolsPath("typst");
}

function fontPathsArgs() {
const fontPathsEnv = Deno.env.get("TYPST_FONT_PATHS");
const fontPathsQuarto = ["--font-path", resourcePath("formats/typst/fonts")];
if (fontPathsEnv) {
return [...fontPathsQuarto, "--font-path", fontPathsEnv];
} else {
return fontPathsQuarto;
}
}

export async function typstCompile(
input: string,
output: string,
Expand All @@ -27,13 +37,11 @@ export async function typstCompile(
if (!quiet) {
typstProgress(input, output);
}

const cmd = [
typstBinaryPath(),
"compile",
input,
"--font-path",
resourcePath("formats/typst/fonts"),
...fontPathsArgs(),
output,
];
const result = await execProcess({ cmd });
Expand Down

0 comments on commit 87f1fed

Please sign in to comment.