diff --git a/font-src/gen/build-font.js b/font-src/gen/build-font.js index 0ebe52181..525812165 100644 --- a/font-src/gen/build-font.js +++ b/font-src/gen/build-font.js @@ -4,12 +4,13 @@ const EmptyFont = require("./empty-font"); const buildGlyphs = require("../glyphs/index"); const finalizeFont = require("./finalize/index"); const convertOtd = require("./otd-conv/index"); +const Caching = require("./caching/index"); const { buildOtl } = require("../otl/index"); const { assignFontNames } = require("../meta/naming"); const { copyFontMetrics } = require("../meta/aesthetics"); -module.exports = async function (cache, para) { +module.exports = async function (argv, para) { const otd = EmptyFont(); const gs = buildGlyphs(para); @@ -29,7 +30,10 @@ module.exports = async function (cache, para) { } } + const cache = await Caching.load(argv); const finalGs = finalizeFont(cache, para, gs.glyphStore, excludeChars, otd); + await Caching.save(argv, cache); + const font = convertOtd(otd, finalGs); return { font, glyphStore: finalGs }; }; diff --git a/font-src/caching/index.js b/font-src/gen/caching/index.js similarity index 100% rename from font-src/caching/index.js rename to font-src/gen/caching/index.js diff --git a/font-src/index.js b/font-src/index.js index 9d53eaf5e..d42f62290 100644 --- a/font-src/index.js +++ b/font-src/index.js @@ -8,7 +8,6 @@ const { encode } = require("@msgpack/msgpack"); const { FontIo } = require("ot-builder"); const Toml = require("@iarna/toml"); -const Caching = require("./caching/index"); const BuildFont = require("./gen/build-font.js"); const Parameters = require("./support/parameters"); const VariantData = require("./support/variant-data"); @@ -17,14 +16,9 @@ const { createGrDisplaySheet } = require("./support/gr"); module.exports = async function main(argv) { const paraT = await getParameters(); - - const cache = await Caching.load(argv); - - const { font, glyphStore } = await BuildFont(cache, paraT(argv)); + const { font, glyphStore } = await BuildFont(argv, paraT(argv)); if (argv.oCharMap) await saveCharMap(argv, glyphStore); if (argv.o) await saveTTF(argv, font); - - await Caching.save(argv, cache); }; // Parameter preparation