diff --git a/checkenv.js b/checkenv.js index 928699f5..0fe318bb 100644 --- a/checkenv.js +++ b/checkenv.js @@ -11,4 +11,3 @@ function check(util) { check("otc2otf"); check("otf2ttf"); -check("ttfautohint"); diff --git a/verdafile.mjs b/verdafile.mjs index 07684b5d..a888772e 100644 --- a/verdafile.mjs +++ b/verdafile.mjs @@ -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, @@ -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 , 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 = {}; @@ -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); } } @@ -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); } );