Build only needed weights and slants

This commit is contained in:
Alexey Ten (Lynn) 2018-07-26 19:04:09 +03:00
parent bae8c1c6c0
commit 020110d49c
2 changed files with 5 additions and 1 deletions

View file

@ -233,3 +233,5 @@ oblique = "oblique"
# upright = ["upright-only", "styles"] # Upright-only styles
# italic = ["italic-only", "styles"] # Italic-only styles
# oblique = ["oblique-only", "styles"] # Oblique-only styles
# weights = ["regular", "bold"] # Build only regular and bold fonts
# slants = ["upright", "italic"] # Build only upright and italic fonts

View file

@ -102,9 +102,11 @@ oracle(`o:font-building-parameters`).def(async target => {
const fontInfos = {};
const bp = {};
for (const p in buildPlans) {
const { pre, post, prefix, family } = buildPlans[p];
const { pre, post, prefix, family, weights, slants } = buildPlans[p];
const targets = [];
for (const suffix in suffixMapping) {
if (weights && !weights.includes(suffixMapping[suffix].weight)) continue;
if (slants && !slants.includes(suffixMapping[suffix].slant)) continue;
const fileName = [prefix, suffix].join("-");
const preHives = [...pre.design, ...pre[suffixMapping[suffix].slant]];
const postHives = [...post.design, ...post[suffixMapping[suffix].slant]];