Add support for customizing TTFA parameters. Fixes #347

This commit is contained in:
Belleve Invis 2019-10-10 19:58:26 -07:00
parent 8224f72e73
commit cb528c393a
3 changed files with 8 additions and 4 deletions

View file

@ -68,6 +68,7 @@ Since version 2.0, Iosevka would no longer support building via `makefile`. To i
upright = ["upright-only", "styles"] # Upright-only styles upright = ["upright-only", "styles"] # Upright-only styles
italic = ["italic-only", "styles"] # Italic-only styles italic = ["italic-only", "styles"] # Italic-only styles
oblique = ["oblique-only", "styles"] # Oblique-only styles oblique = ["oblique-only", "styles"] # Oblique-only styles
hintParams = ["-a", "sss"] # Optional custom parameters for ttfautohint
# Override default building weights # Override default building weights
# When buildPlans.<plan name>.weights is absent # When buildPlans.<plan name>.weights is absent

View file

@ -1,6 +1,7 @@
[buildPlans.iosevka-custom] # <iosevka-custom> is your plan name [buildPlans.iosevka-custom] # <iosevka-custom> is your plan name
family = "Iosevka Custom" # Font menu family name family = "Iosevka Custom" # Font menu family name
design = ["leading-1500", "v-i-hooky", "v-l-hooky"] # Customize styles design = ["leading-1500", "v-i-hooky", "v-l-hooky"] # Customize styles
hintParams = ["-a", "sss"] # Optional custom parameters for ttfautohint
# Override default building weights # Override default building weights

View file

@ -135,7 +135,7 @@ const FontBuildingParameters = computed(`font-building-parameters`, async target
const fontInfos = {}; const fontInfos = {};
const bp = {}; const bp = {};
for (const p in buildPlans) { for (const p in buildPlans) {
const { pre, post, prefix, family, weights, slants } = buildPlans[p]; const { pre, post, prefix, family, weights, slants, hintParams } = buildPlans[p];
const targets = []; const targets = [];
const suffixMapping = getSuffixSet(weights || defaultWeights, slants || defaultSlants); const suffixMapping = getSuffixSet(weights || defaultWeights, slants || defaultSlants);
for (const suffix in suffixMapping) { for (const suffix in suffixMapping) {
@ -151,7 +151,8 @@ const FontBuildingParameters = computed(`font-building-parameters`, async target
menuWeight: suffixMapping[suffix].menuWeight, menuWeight: suffixMapping[suffix].menuWeight,
menuStyle: suffixMapping[suffix].menuStyle, menuStyle: suffixMapping[suffix].menuStyle,
cssWeight: suffixMapping[suffix].cssWeight, cssWeight: suffixMapping[suffix].cssWeight,
cssStyle: suffixMapping[suffix].cssStyle cssStyle: suffixMapping[suffix].cssStyle,
hintParams: hintParams || []
}; };
targets.push(fileName); targets.push(fileName);
} }
@ -262,8 +263,9 @@ const DistUnhintedTTF = file.make(
const DistHintedTTF = file.make( const DistHintedTTF = file.make(
(gr, fn) => `${DIST}/${gr}/ttf/${fn}.ttf`, (gr, fn) => `${DIST}/${gr}/ttf/${fn}.ttf`,
async (target, path, gr, f) => { async (target, path, gr, f) => {
const [{ hintParams }] = await target.need(HivesOf(f));
const [from] = await target.need(BuildTTF(gr, f), de`${path.dir}`); const [from] = await target.need(BuildTTF(gr, f), de`${path.dir}`);
await run("ttfautohint", from.full, path.full); await run("ttfautohint", hintParams, from.full, path.full);
} }
); );
const DistWoff = file.make( const DistWoff = file.make(