Skip to content

Commit

Permalink
Merge pull request #383 from Zenvie/test
Browse files Browse the repository at this point in the history
fix: check dependency when need
  • Loading branch information
be5invis authored Mar 24, 2024
2 parents 3c81311 + b868e5d commit 22ac367
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 0 additions & 1 deletion checkenv.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ function check(util) {

check("otc2otf");
check("otf2ttf");
check("ttfautohint");
12 changes: 11 additions & 1 deletion verdafile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const PROJECT_ROOT = url.fileURLToPath(new URL(".", import.meta.url));
const NODEJS = `node`;
const SEVEN_ZIP = process.env.SEVEN_ZIP_PATH || "7z";
const OTC2OTF = `otc2otf`;
const TTFAUTOHINT = process.env.TTFAUTOHINT_PATH || "ttfautohint";

const TTC_BUNDLE = [
NODEJS,
Expand Down Expand Up @@ -87,6 +88,14 @@ const Ttf = phony(`ttf`, async t => {
await t.need(TtfFontFiles`TTF`, TtfFontFiles`TTF-Unhinted`);
});

const CheckTtfAutoHintExists = oracle("oracle:check-ttfautohint-exists", async target => {
try {
return await which(TTFAUTOHINT);
} catch (e) {
fail("External dependency <ttfautohint>, needed for building hinted font, does not exist.");
}
});

const Dependencies = oracle("oracles::dependencies", async () => {
const pkg = await fs.readJSON(path.resolve(PROJECT_ROOT, "package.json"));
const depJson = {};
Expand Down Expand Up @@ -308,6 +317,7 @@ const LatinSource = file.make(
if (isCff) {
await run("otf2ttf", "-o", out.full, source.full);
} else {
await t.need(CheckTtfAutoHintExists);
await run("ttfautohint", "-d", source.full, out.full);
}
}
Expand Down Expand Up @@ -352,7 +362,7 @@ const Pass1 = file.make(
const Pass1Hinted = file.make(
(family, region, style) => `${BUILD}/pass1-hinted/${family}-${region}-${style}.ttf`,
async (t, out, family, region, style) => {
const [pass1] = await t.need(Pass1(family, region, style), de(out.dir));
const [pass1] = await t.need(Pass1(family, region, style), CheckTtfAutoHintExists, de(out.dir));
await run("ttfautohint", pass1.full, out.full);
}
);
Expand Down

0 comments on commit 22ac367

Please sign in to comment.