This commit is contained in:
Belleve Invis 2019-12-27 06:21:31 -08:00
parent 3672aad56e
commit 40b7c1452e
6 changed files with 105 additions and 59 deletions

View file

@ -82,6 +82,7 @@ design = ["termlig", "slab", "shape-curly-bar", "v-at-fourfold"]
family = "IosevkaCC Curly Slab"
design = ["cc", "slab", "shape-curly-bar", "v-at-fourfold"]
###################################################################################################
# SSxx
[buildPlans.iosevka-ss01]
family = "Iosevka SS01"
@ -286,8 +287,8 @@ design = ["type", "ss12"]
family = "Iosevka TermLig SS12"
design = ["termlig", "ss12"]
###################################################################################################
# Proportional families
[buildPlans.iosevka-aile]
family = "Iosevka Aile"
design = ["type", "v-at-fourfold", "v-j-narrow", 'v-capital-i-straight', 'v-capital-j-straight', 'v-g-singlestorey', 'v-r-narrow', "no-cv-ss", "no-ligation"]
@ -296,7 +297,15 @@ italic = ["v-i-line", "v-l-line", 'v-f-narrow', 'v-t-narrow']
oblique = ["v-i-line", "v-l-line", 'v-f-narrow', 'v-t-narrow']
[buildPlans.iosevka-aile.post]
design = ['wd-extended', "diversity-2"]
design = ["diversity-2"]
[buildPlans.iosevka-aile.widths.normal]
shape = 7
menu = 5
css = "normal"
[buildPlans.iosevka-etoile]
family = "Iosevka Etoile"
@ -306,7 +315,15 @@ italic = ['v-i-italic', 'v-l-italic']
oblique = ['v-i-serifed', 'v-l-serifed']
[buildPlans.iosevka-etoile.post]
design = ['wd-extended', "diversity-1"]
design = ["diversity-1"]
[buildPlans.iosevka-etoile.widths.normal]
shape = 7
menu = 5
css = "normal"
[buildPlans.iosevka-sparkle]
family = "Iosevka Sparkle"
@ -316,21 +333,15 @@ italic = ['v-i-italic', 'v-l-italic', "v-f-tailed", 'v-r-standard']
oblique = ['v-i-serifed', 'v-l-serifed', "v-f-force-serifed", "v-r-force-serifed"]
[buildPlans.iosevka-sparkle.post]
design = ['wd-extended', "diversity-1"]
design = ["diversity-1"]
[buildPlans.iosevka-extended]
family = "Iosevka"
[buildPlans.iosevka-sparkle.widths.normal]
shape = 7
menu = 5
css = "normal"
[buildPlans.iosevka-extended.post]
design = ['wd-extended', 'menu-subfamily-extended']
[buildPlans.iosevka-slab-extended]
family = "Iosevka Slab"
design = ["slab"]
[buildPlans.iosevka-slab-extended.post]
design = ['wd-extended', 'menu-subfamily-extended']
###################################################################################################
# Export plans
# This mapping affects the process of creating ZIP archives only
[exportPlans]
@ -424,9 +435,8 @@ iosevka-term-lig-ss12 = "iosevka-term-lig-ss12"
iosevka-aile = "iosevka-aile"
iosevka-etoile = "iosevka-etoile"
iosevka-sparkle = "iosevka-sparkle"
iosevka-extended = "iosevka-extended"
iosevka-slab-extended = "iosevka-slab-extended"
###################################################################################################
# TTC collection plans
[collectPlans.iosevka]
from = [
@ -460,9 +470,11 @@ from = [
"iosevka-term-lig-curly-slab"
]
# Weight mappings (style => shape weight, CSS weight)
###################################################################################################
# Weight mappings (style => shape weight, menu weight, CSS weight)
# Shape weight : affects the shape of the glyphs
# CSS weight : affects the font menu name and webfont CSS
# Menu weight : affects the font menu name
# CSS weight : affects the webfont CSS "font-weight" property
[weights.thin]
shape = 100
menu = 100
@ -515,3 +527,24 @@ css = 900
upright = "normal"
oblique = "oblique"
italic = "italic"
# Width mappings (style => shape width, menu width, CSS stretch)
# Shape width : affects the shape of the glyphs
# Menu width : affects the font menu name
# CSS stretch : affects the webfont CSS "font-stretch" property
# IMPORTANT!!
# Currently "shape" property only support 3, 5, and 7
[widths.condensed]
shape = 3
menu = 3
css = "condensed"
[widths.normal]
shape = 5
menu = 5
css = "normal"
[widths.extended]
shape = 7
menu = 7
css = "expanded"

View file

@ -49,6 +49,7 @@ function getParameters(argv) {
family: argv.family,
version: argv.ver,
weight: argv["menu-weight"] - 0,
width: argv["menu-width"] - 0,
slant: argv["menu-slant"]
};

View file

@ -89,7 +89,7 @@ export : define [assignFontNames para metrics font] : begin
set font.name {}
define family : para.naming.family.trim
define style : getStyle para.naming.weight para.menuWidth para.naming.slant
define style : getStyle para.naming.weight para.naming.width para.naming.slant
define version para.naming.version
define isItalic : para.naming.slant == "italic"
@ -110,7 +110,7 @@ export : define [assignFontNames para metrics font] : begin
if [not : isRBIBI style] : begin
if isItalic : begin
set compatStyle slantToMenuStyleMap.italic
set compatFamily : family + ' ' + [getStyle para.naming.weight para.menuWidth 'normal']
set compatFamily : family + ' ' + [getStyle para.naming.weight para.naming.width 'normal']
: else : begin
set compatStyle 'Regular'
set compatFamily : family + ' ' + style
@ -119,9 +119,9 @@ export : define [assignFontNames para metrics font] : begin
if (compatFamily.length >= 31) : begin
if isItalic : begin
set compatStyle slantToMenuStyleMap.italic
set compatFamily : family + ' ' + [getShortStyle para.naming.weight para.menuWidth 'normal']
set compatFamily : family + ' ' + [getShortStyle para.naming.weight para.naming.width 'normal']
: else : begin
local shortStyle : getShortStyle para.naming.weight para.menuWidth para.naming.slant
local shortStyle : getShortStyle para.naming.weight para.naming.width para.naming.slant
set compatStyle 'Regular'
set compatFamily : family + ' ' + shortStyle
@ -150,7 +150,7 @@ export : define [assignFontNames para metrics font] : begin
# Weight, width and slantness
set font.OS_2.usWeightClass para.naming.weight
set font.OS_2.usWidthClass para.menuWidth
set font.OS_2.usWidthClass para.naming.width
set font.OS_2.panose.2 : 1 + para.naming.weight / 100
set font.OS_2.fsSelection : object
oblique : not : not isOblique

View file

@ -74,8 +74,6 @@ lllcrowdedness = 3.33333333
spacing = 1 # Spacing indicator
menuWidth = 5 # Menu width
# Powerline-specific parameters
powerlineScaleY = 1 # Vertical scale
powerlineScaleX = 1 # Horizontal scale
@ -255,7 +253,7 @@ spacing = 3
# NOTE: this section is highly experimental
# HANDLE WITH EXTREME CARE
# Expanded : I heard someone want it being wider...
[wd-extended.multiplies]
[wd-7.multiplies]
width = 1.152 # 576mem for normal char
sb = 1.375
jut = 1.15
@ -265,20 +263,14 @@ rbalance = 1.375
tbalance = 1.100
[extended]
inherits = ['wd-extended']
[menu-subfamily-extended]
menuWidth = 7
inherits = ['wd-7']
# Compressed : And someone else want it being narrower
[wd-condensed.multiplies]
[wd-3.multiplies]
width = 0.9
sb = 0.9
[condensed]
inherits = ['wd-condensed']
[menu-subfamily-condensed]
menuWidth = 3
inherits = ['wd-3']
[shape-curly-bar]
straightBar = 0

View file

@ -11,6 +11,7 @@ module.exports = function(output, family, hs, formats) {
font-family: '${family + " Web"}';
font-display: swap;
font-weight: ${term.cssWeight};
font-stretch: ${term.cssStretch};
font-style: ${term.cssStyle};
src: ${src};
}
@ -22,6 +23,7 @@ module.exports = function(output, family, hs, formats) {
font-family: '${family + " Web Oblique"}';
font-display: swap;
font-weight: ${term.cssWeight};
font-stretch: ${term.cssStretch};
src: ${src};
}
`;

View file

@ -102,53 +102,68 @@ const RawCollectPlans = computed("raw-collect-plans", async target => {
const [rp] = await target.need(RawPlans);
return rp.collectPlans;
});
const Weights = computed("weights", async target => {
const Weights = computed("metadata:global-weights", async target => {
const [rp] = await target.need(RawPlans);
return rp.weights;
});
const Slants = computed("slants", async target => {
const Slants = computed("metadata:global-slants", async target => {
const [rp] = await target.need(RawPlans);
return rp.slants;
});
const Widths = computed("metadata:global-widths", async target => {
const [rp] = await target.need(RawPlans);
return rp.widths;
});
function getSuffixSet(weights, slants) {
function getSuffixSet(weights, slants, widths) {
const mapping = {};
for (const w in weights) {
for (const s in slants) {
for (const wd in widths) {
const suffix =
(w === "regular" ? (s === "upright" ? "regular" : "") : w) +
(s === "upright" ? "" : s);
(wd === "normal" ? "" : wd) +
(w === "regular" ? "" : w) +
(s === "upright" ? "" : s) || "regular";
mapping[suffix] = {
hives: [`w-${weights[w].shape}`, `s-${s}`],
hives: [`w-${weights[w].shape}`, `s-${s}`, `wd-${widths[wd].shape}`],
weight: w,
cssWeight: weights[w].css || w,
menuWeight: weights[w].menu || weights[w].css || w,
width: wd,
cssStretch: widths[wd].css || wd,
menuWidth: widths[wd].menu || widths[wd].css || wd,
slant: s,
cssStyle: slants[s] || s,
menuStyle: slants[s] || s
};
}
}
}
return mapping;
}
const Suffixes = computed(`suffixes`, async target => {
const [weights, slants] = await target.need(Weights, Slants);
return getSuffixSet(weights, slants);
const [weights, slants, widths] = await target.need(Weights, Slants, Widths);
return getSuffixSet(weights, slants, widths);
});
const FontBuildingParameters = computed(`font-building-parameters`, async target => {
const [buildPlans, defaultWeights, defaultSlants] = await target.need(
const [buildPlans, defaultWeights, defaultSlants, defaultWidths] = await target.need(
BuildPlans,
Weights,
Slants
Slants,
Widths
);
const fontInfos = {};
const bp = {};
for (const p in buildPlans) {
const { pre, post, prefix, family, weights, slants, hintParams } = buildPlans[p];
const { pre, post, prefix, family, weights, slants, widths, hintParams } = buildPlans[p];
const targets = [];
const suffixMapping = getSuffixSet(weights || defaultWeights, slants || defaultSlants);
const suffixMapping = getSuffixSet(
weights || defaultWeights,
slants || defaultSlants,
widths || defaultWidths
);
for (const suffix in suffixMapping) {
if (weights && !weights[suffixMapping[suffix].weight]) continue;
if (slants && !slants[suffixMapping[suffix].slant]) continue;
@ -160,8 +175,10 @@ const FontBuildingParameters = computed(`font-building-parameters`, async target
family,
hives: ["iosevka", ...preHives, ...suffixMapping[suffix].hives, ...postHives],
menuWeight: suffixMapping[suffix].menuWeight,
menuWidth: suffixMapping[suffix].menuWidth,
menuStyle: suffixMapping[suffix].menuStyle,
cssWeight: suffixMapping[suffix].cssWeight,
cssStretch: suffixMapping[suffix].cssStretch,
cssStyle: suffixMapping[suffix].cssStyle,
hintParams: hintParams || []
};
@ -227,7 +244,7 @@ const CollectionPartsOf = computed.group("collection-parts-of", async (target, i
const BuildTTF = file.make(
(gr, fn) => `${BUILD}/${gr}/${fn}.ttf`,
async (target, output, _gr, fn) => {
const [{ hives, family, menuWeight, menuStyle }, version] = await target.need(
const [{ hives, family, menuWeight, menuStyle, menuWidth }, version] = await target.need(
HivesOf(fn),
Version
);
@ -244,6 +261,7 @@ const BuildTTF = file.make(
["--ver", version],
["--menu-weight", menuWeight],
["--menu-slant", menuStyle],
["--menu-width", menuWidth],
hives
);
await run("otfccbuild", otdTmp, "-o", ttfTmp, "-O3", "--keep-average-char-width");