Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check dependency when need #383

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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