Start detaching style selectors

This commit is contained in:
be5invis 2020-07-06 17:13:06 -07:00
parent 4b04f952d1
commit bbf73e9748
9 changed files with 288 additions and 291 deletions

View file

@ -355,9 +355,7 @@ upright = ["v-i-line", "v-l-line", 'v-f-narrow', 'v-t-narrow']
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']
snapshotFamily = 'iosevka-aile'
[buildPlans.iosevka-aile.post]
design = ["diversity-2"]
quasiProportionalDiversity = 2
[buildPlans.iosevka-aile.widths.normal]
shape = 576
@ -374,9 +372,7 @@ upright = ['v-i-serifed', 'v-l-serifed']
italic = ['v-i-italic', 'v-l-italic']
oblique = ['v-i-serifed', 'v-l-serifed']
snapshotFamily = 'iosevka-etoile'
[buildPlans.iosevka-etoile.post]
design = ["diversity-1"]
quasiProportionalDiversity = 1
[buildPlans.iosevka-etoile.widths.normal]
shape = 576
@ -393,9 +389,7 @@ upright = ['v-i-serifed', 'v-l-serifed', "v-f-serifed", "v-r-serifed"]
italic = ['v-i-italic', 'v-l-italic', "v-f-tailed", 'v-r-top-serifed']
oblique = ['v-i-serifed', 'v-l-serifed', "v-f-serifed", "v-r-serifed"]
snapshotFamily = 'iosevka-sparkle'
[buildPlans.iosevka-sparkle.post]
design = ["diversity-1"]
quasiProportionalDiversity = 1
[buildPlans.iosevka-sparkle.widths.normal]
shape = 576

View file

@ -178,7 +178,9 @@ glyph-block Symbol-Punctuation-Brackets : begin
define [BraceDim] : begin
local parenCenter [mix SB RightSB [mix designParameters.braceInside designParameters.braceOutside 0.5]]
local radius : [mix SB RightSB designParameters.braceInside] - parenCenter
local radius : Math.min
[mix SB RightSB designParameters.braceInside] - parenCenter
(parenTop - symbolMid - Stroke * 1.5) / 2
return : object parenCenter radius
define [BraceUpperHalfShape top bottom] : glyph-construction
@ -264,8 +266,8 @@ glyph-block Symbol-Punctuation-Brackets : begin
local m1 : mix SB RightSB [mix designParameters.braceInside designParameters.braceOutside designParameters.braceCurlyM1]
local m2 : mix SB RightSB [mix designParameters.braceInside designParameters.braceOutside designParameters.braceCurlyM2]
local braceRadiusLowLimit : (parenTop - symbolMid - sw) * (1 / 3) + hs
local radius1 : Math.min (xIns - m1) braceRadiusLowLimit
local radius2 : [Math.min (m2 - xOus) braceRadiusLowLimit] - hs
local radius1 : (sw / 16) + [Math.min (xIns - m1) braceRadiusLowLimit]
local radius2 : (sw / 16) + [Math.min (m2 - xOus) braceRadiusLowLimit] - hs
local ess : mix sw (Ess * sw / Stroke) 0.25
local top : mix symbolMid parenTop (1 + designParameters.braceOvershoot)
local bot : mix symbolMid parenBot (1 + designParameters.braceOvershoot)

View file

@ -20,6 +20,8 @@ module.exports = async function main(argv) {
// Parameter preparation
async function getParameters(argv) {
const PARAMETERS_TOML = path.resolve(__dirname, "../params/parameters.toml");
const WEIGHTS_TOML = path.resolve(__dirname, "../params/shape-weight.toml");
const WIDTHS_TOML = path.resolve(__dirname, "../params/shape-width.toml");
const PRIVATE_TOML = path.resolve(__dirname, "../params/private-parameters.toml");
const VARIANTS_TOML = path.resolve(__dirname, "../params/variants.toml");
const LIGATIONS_TOML = path.resolve(__dirname, "../params/ligation-set.toml");
@ -27,37 +29,44 @@ async function getParameters(argv) {
const parametersData = Object.assign(
{},
await tryParseToml(PARAMETERS_TOML),
(await fs.exists(PRIVATE_TOML)) ? await tryParseToml(PRIVATE_TOML) : []
await tryParseToml(WEIGHTS_TOML),
await tryParseToml(WIDTHS_TOML),
(await fs.exists(PRIVATE_TOML)) ? await tryParseToml(PRIVATE_TOML) : {}
);
const rawVariantsData = await tryParseToml(VARIANTS_TOML);
const rawLigationData = await tryParseToml(LIGATIONS_TOML);
const para = Parameters.build(parametersData, argv.hives, {
shapeWeight: argv.shape.weight,
shapeWidth: argv.shape.width
});
let para = {};
Parameters.apply(para, parametersData, ["iosevka"]);
Parameters.apply(para, parametersData, argv.preHives);
Parameters.apply(para, parametersData, ["shapeWeight"], { shapeWeight: argv.shape.weight });
Parameters.apply(para, parametersData, ["shapeWidth"], { shapeWidth: argv.shape.width });
Parameters.apply(para, parametersData, [`s-${argv.shape.slant}`]);
Parameters.apply(para, parametersData, [`diversity-${argv.shape.quasiProportionalDiversity}`]);
const variantsData = FormVariantData(rawVariantsData, para);
para.variants = variantsData;
para.variantSelector = Parameters.build(variantsData, ["default", ...argv.hives]);
para.variantSelector = {};
Parameters.apply(para.variantSelector, variantsData, ["default", ...argv.preHives]);
para.defaultVariant = variantsData.default;
const ligationData = FormLigationData(rawLigationData, para);
para.defaultBuildup = ligationData.defaultBuildup;
para.ligation = Parameters.build(ligationData.hives, ["default", ...argv.hives]);
para.defaultBuildup = { ...ligationData.defaultBuildup };
para.ligation = {};
Parameters.apply(para.ligation, ligationData.hives, ["default", ...argv.preHives]);
if (argv.excludedCharRanges) para.excludedCharRanges = argv.excludedCharRanges;
if (argv.compatibilityLigatures) para.compLig = argv.compatibilityLigatures;
if (argv.metricOverride) Parameters.applyMetricOverride(para, argv.metricOverride);
para.naming = {
...para.naming,
family: argv.menu.family,
version: argv.menu.version,
weight: argv.menu.weight - 0,
width: argv.menu.width - 0,
slant: argv.menu.slant
};
return para;
}

View file

@ -159,11 +159,11 @@ export : define [assignFontNames para metrics font] : begin
nameFont font VERSION version # Version
nameFont font COPYRIGHT para.copyright # Copyright
nameFont font MANUFACTURER para.manufacturer # Manufacturer
nameFont font DESIGNER para.designer # Designer
nameFont font DESCRIPTION para.description # Description
nameFont font LICENCE para.licence # Licence
nameFont font COPYRIGHT para.naming.copyright # Copyright
nameFont font MANUFACTURER para.naming.manufacturer # Manufacturer
nameFont font DESIGNER para.naming.designer # Designer
nameFont font DESCRIPTION para.naming.description # Description
nameFont font LICENCE para.naming.licence # Licence
set font.name : font.name.sort : lambda [a b] : begin
if (a.platformID != b.platformID) : return : a.platformID - b.platformID

View file

@ -2,12 +2,11 @@
const monotonicInterpolate = require("./monotonic-interpolate");
function build(parametersData, styles, blendArgs) {
const sink = {};
function apply(sink, parametersData, styles, blendArgs) {
if (!styles) return;
for (const item of styles) intro(parametersData, item, blendArgs, sink);
return sink;
}
exports.build = build;
exports.apply = apply;
function intro(source, style, blendArgs, sink) {
let hive = source[style];
@ -33,7 +32,8 @@ function intro(source, style, blendArgs, sink) {
for (const k in mu) sink[k] = [...(sink[k] || []), ...mu[k]];
delete hive.appends;
}
hive = hiveBlend(hive, getBlendArg(blendArgs, style), sink);
hive = hiveBlend(hive, getBlendArg(blendArgs, style));
for (const k in hive) sink[k] = hive[k];
}
@ -42,14 +42,13 @@ function getBlendArg(blendArgs, style) {
return blendArgs[style];
}
function hiveBlend(hive, value, sink) {
function hiveBlend(hive, value) {
if (!hive || !hive.blend || value == null) return hive;
const generatedHive = {};
const block = hive.blend;
let keys = new Set();
for (const grade in block) {
sink[grade] = block[grade];
if (!isFinite(parseFloat(grade))) continue;
for (const key in block[grade]) {
if (block[grade][key] == null) continue;

View file

@ -3,11 +3,11 @@
### Changing the numbers may make the builder crash / hang / produce broken shapes.
[iosevka]
copyright = 'Copyright (c) 2015-2020 Belleve Invis.'
licence = '''This font software is licenced under the SIL Open Font Licence, Version 1.1. This is licence is avaliable with a FAQ at: http://scripts.sil.org/OFL. This font software is distributes on an 'AS IS' basis, without warranties or conditions of any kind, either express or implied. See the SIL Open Font licence fot the specific language, premissions and limitations governing your use of this font software.'''
manufacturer = 'Belleve Invis'
designer = 'Belleve Invis'
description = 'Spatial efficient monospace font family for programming. Built from code. http://be5invis.github.io/Iosevka'
naming.copyright = 'Copyright (c) 2015-2020 Belleve Invis.'
naming.licence = '''This font software is licenced under the SIL Open Font Licence, Version 1.1. This is licence is avaliable with a FAQ at: http://scripts.sil.org/OFL. This font software is distributes on an 'AS IS' basis, without warranties or conditions of any kind, either express or implied. See the SIL Open Font licence fot the specific language, premissions and limitations governing your use of this font software.'''
naming.manufacturer = 'Belleve Invis'
naming.designer = 'Belleve Invis'
naming.description = 'Spatial efficient monospace font family for programming. Built from code. http://be5invis.github.io/Iosevka'
leading = 1250 # Default line height times 1000.
descenderPad = 0 # Additional line height, added to descender.
@ -51,12 +51,6 @@ powerlineScaleX = 1 # Horizontal scale
powerlineShiftY = 0 # Vertical shift
powerlineShiftX = 0 # Horizontal shift
# Diversity widths
diversityM = 1
diversityF = 1
diversityI = 1
diversityII = 1
# Whether to generate CV-SS features
enableCvSs = true
@ -115,6 +109,12 @@ slantAngle = 10
jhook = 120
###### Diversity
[diversity-0]
diversityM = 1
diversityF = 1
diversityI = 1
diversityII = 1
[diversity-1]
diversityM = 1.25
diversityF = 1.00
@ -127,241 +127,6 @@ diversityF = 0.75
diversityI = 0.75
diversityII = 0.5
###################################################################################################
### Blendable Options
###### Weight
[shapeWeight.blend.400]
stroke = 72 # Primary stroke width
sb = 60 # Primary sidebearings
essx = 1.12 # Proportion of widen of center of "S"
dotsize = 125 # Size of dots
periodsize = 140 # Size of period
jut = 85 # Length of slab serif
vjut = 145 # Length of vertical slab serif
longjut = 175 # Length of long serifs, like that in `i`.
smooth = 195 # Vertical arc size in capital letters.
smallsmooth = 200 # Vertical arc size in lowercase letters.
superness = 2.275 # Superness of arcs.
tightHookSuperness = 2.3 # superness of tight hooks
fbarStrokeAdj = 0.25 # Portion of the fill above the f-bar position
rbalance = 60
rbalance2 = 15
tbalance = 50
tbalance2 = 30
jbalance = 63
fbalance = 6
onebalance = 30
hook = 155 # Hook depth in most letters.
ahook = 130
shook = 110
jhook = 135
fhook = 120
hookx = 170
rhook = 110
cthin = 0.75
cthinb = 0.5
vtipfine = 0.8
vtipfineSlab = 0.9
[shapeWeight.blend.100]
jut = 70
vjut = 145
smooth = 195
rhook = 110
rbalance = 60
rbalance2 = 15
cthin = 0.9
cthinb = 0.9
vtipfine = 1
vtipfineSlab = 1
stroke = 18
sb = 72
dotsize = 53
periodsize = 55
[shapeWeight.blend.200]
jut = 75
vjut = 145
smooth = 195
rhook = 110
rbalance = 60
rbalance2 = 15
cthin = 0.75
cthinb = 0.75
vtipfine = 1
vtipfineSlab = 1
stroke = 36
sb = 68
dotsize = 70
periodsize = 77
[shapeWeight.blend.300]
jut = 80
vjut = 145
smooth = 195
rhook = 110
rbalance = 60
rbalance2 = 15
cthin = 0.75
cthinb = 0.5
vtipfine = 0.9
vtipfineSlab = 0.9
stroke = 56
sb = 64
dotsize = 100
periodsize = 115
[shapeWeight.blend.500]
essx = 1.12
jut = 85
vjut = 157
smooth = 200
rhook = 110
rbalance = 60
rbalance2 = 15
stroke = 84
sb = 57
dotsize = 135
periodsize = 160
[shapeWeight.blend.600]
essx = 1.07
jut = 85
vjut = 170
smooth = 203
rhook = 110
rbalance = 55
rbalance2 = 20
stroke = 97
sb = 54
dotsize = 145
periodsize = 168
[shapeWeight.blend.700]
essx = 1.06
jut = 89
vjut = 179
smooth = 206
rhook = 95
rbalance = 52
rbalance2 = 23
stroke = 106
sb = 50
dotsize = 157
periodsize = 180
[shapeWeight.blend.800]
essx = 1.05
jut = 96
vjut = 189
smooth = 210
rhook = 97
rbalance = 50
rbalance2 = 25
stroke = 116
sb = 45
dotsize = 167
periodsize = 188
[shapeWeight.blend.900]
essx = 1.03
jut = 100
vjut = 199
smooth = 215
rhook = 105
rbalance = 50
rbalance2 = 25
stroke = 126
sb = 42
dotsize = 180
periodsize = 200
###### Widths
[shapeWidth.multiplies.blend.500]
width = 1
stroke = 1
sb = 1
jut = 1
longjut = 1
rhook = 1
rbalance = 1
tbalance = 1
smallsmooth = 1
[shapeWidth.multiplies.blend.664]
width = 1.328 # 664 for normal char
stroke = 1.103 # Make strokes a little thicker
sb = 1.777
jut = 1.323
longjut = 1.323
rhook = 1.323
rbalance = 1.236
tbalance = 1.210
smallsmooth = 1.103
[shapeWidth.multiplies.blend.618]
width = 1.236 # 618 for normal char
stroke = 1.075 # Make strokes a little thicker
sb = 1.539
jut = 1.233
longjut = 1.233
rhook = 1.233
rbalance = 1.236
tbalance = 1.154
smallsmooth = 1.075
[shapeWidth.multiplies.blend.576]
width = 1.152 # 576mem for normal char
stroke = 1.050 # Make strokes a little thicker
sb = 1.333
jut = 1.150
longjut = 1.150
rhook = 1.150
rbalance = 1.152
tbalance = 1.100
smallsmooth = 1.050
[shapeWidth.multiplies.blend.537]
width = 1.074 # 537mem for normal char
stroke = 1.023 # Make strokes a little thicker
sb = 1.154
jut = 1.072
longjut = 1.072
rhook = 1.072
rbalance = 1.074
tbalance = 1.049
smallsmooth = 1.023
[shapeWidth.multiplies.blend.466]
width = 0.932 # 466mem for normal char
stroke = 0.975
sb = 0.866
jut = 0.933
longjut = 0.933
rhook = 1
rbalance = 0.931
tbalance = 0.953
smallsmooth = 0.975
[shapeWidth.multiplies.blend.434]
width = 0.868 # 434mem for normal char
stroke = 0.952
sb = 0.750
jut = 0.870
longjut = 0.870
rhook = 1
rbalance = 0.868
tbalance = 0.909
smallsmooth = 0.952
###################################################################################################
### Metric-override hives
### These hives are now discouraged in favor of 'metric-override' in build plans but they are

151
params/shape-weight.toml Normal file
View file

@ -0,0 +1,151 @@
[shapeWeight.blend.400]
stroke = 72 # Primary stroke width
sb = 60 # Primary sidebearings
essx = 1.12 # Proportion of widen of center of "S"
dotsize = 125 # Size of dots
periodsize = 140 # Size of period
jut = 85 # Length of slab serif
vjut = 145 # Length of vertical slab serif
longjut = 175 # Length of long serifs, like that in `i`.
smooth = 195 # Vertical arc size in capital letters.
smallsmooth = 200 # Vertical arc size in lowercase letters.
superness = 2.275 # Superness of arcs.
tightHookSuperness = 2.3 # superness of tight hooks
fbarStrokeAdj = 0.25 # Portion of the fill above the f-bar position
rbalance = 60
rbalance2 = 15
tbalance = 50
tbalance2 = 30
jbalance = 63
fbalance = 6
onebalance = 30
hook = 155 # Hook depth in most letters.
ahook = 130
shook = 110
jhook = 135
fhook = 120
hookx = 170
rhook = 110
cthin = 0.75
cthinb = 0.5
vtipfine = 0.8
vtipfineSlab = 0.9
[shapeWeight.blend.100]
jut = 70
vjut = 145
smooth = 195
rhook = 110
rbalance = 60
rbalance2 = 15
cthin = 0.9
cthinb = 0.9
vtipfine = 1
vtipfineSlab = 1
stroke = 18
sb = 72
dotsize = 53
periodsize = 55
[shapeWeight.blend.200]
jut = 75
vjut = 145
smooth = 195
rhook = 110
rbalance = 60
rbalance2 = 15
cthin = 0.75
cthinb = 0.75
vtipfine = 1
vtipfineSlab = 1
stroke = 36
sb = 68
dotsize = 70
periodsize = 77
[shapeWeight.blend.300]
jut = 80
vjut = 145
smooth = 195
rhook = 110
rbalance = 60
rbalance2 = 15
cthin = 0.75
cthinb = 0.5
vtipfine = 0.9
vtipfineSlab = 0.9
stroke = 56
sb = 64
dotsize = 100
periodsize = 115
[shapeWeight.blend.500]
essx = 1.12
jut = 85
vjut = 157
smooth = 200
rhook = 110
rbalance = 60
rbalance2 = 15
stroke = 84
sb = 57
dotsize = 135
periodsize = 160
[shapeWeight.blend.600]
essx = 1.07
jut = 85
vjut = 170
smooth = 203
rhook = 110
rbalance = 55
rbalance2 = 20
stroke = 97
sb = 54
dotsize = 145
periodsize = 168
[shapeWeight.blend.700]
essx = 1.06
jut = 89
vjut = 179
smooth = 206
rhook = 95
rbalance = 52
rbalance2 = 23
stroke = 106
sb = 50
dotsize = 157
periodsize = 180
[shapeWeight.blend.800]
essx = 1.05
jut = 96
vjut = 189
smooth = 210
rhook = 97
rbalance = 50
rbalance2 = 25
stroke = 116
sb = 45
dotsize = 167
periodsize = 188
[shapeWeight.blend.900]
essx = 1.03
jut = 100
vjut = 199
smooth = 215
rhook = 105
rbalance = 50
rbalance2 = 25
stroke = 126
sb = 42
dotsize = 180
periodsize = 200

76
params/shape-width.toml Normal file
View file

@ -0,0 +1,76 @@
[shapeWidth.multiplies.blend.500]
width = 1
stroke = 1
sb = 1
jut = 1
longjut = 1
rhook = 1
rbalance = 1
tbalance = 1
smallsmooth = 1
[shapeWidth.multiplies.blend.664]
width = 1.328 # 664 for normal char
stroke = 1.103 # Make strokes a little thicker
sb = 1.777
jut = 1.323
longjut = 1.323
rhook = 1.323
rbalance = 1.236
tbalance = 1.210
smallsmooth = 1.103
[shapeWidth.multiplies.blend.618]
width = 1.236 # 618 for normal char
stroke = 1.075 # Make strokes a little thicker
sb = 1.539
jut = 1.233
longjut = 1.233
rhook = 1.233
rbalance = 1.236
tbalance = 1.154
smallsmooth = 1.075
[shapeWidth.multiplies.blend.576]
width = 1.152 # 576mem for normal char
stroke = 1.050 # Make strokes a little thicker
sb = 1.333
jut = 1.150
longjut = 1.150
rhook = 1.150
rbalance = 1.152
tbalance = 1.100
smallsmooth = 1.050
[shapeWidth.multiplies.blend.537]
width = 1.074 # 537mem for normal char
stroke = 1.023 # Make strokes a little thicker
sb = 1.154
jut = 1.072
longjut = 1.072
rhook = 1.072
rbalance = 1.074
tbalance = 1.049
smallsmooth = 1.023
[shapeWidth.multiplies.blend.466]
width = 0.932 # 466mem for normal char
stroke = 0.975
sb = 0.866
jut = 0.933
longjut = 0.933
rhook = 1
rbalance = 0.931
tbalance = 0.953
smallsmooth = 0.975
[shapeWidth.multiplies.blend.434]
width = 0.868 # 434mem for normal char
stroke = 0.952
sb = 0.750
jut = 0.870
longjut = 0.870
rhook = 1
rbalance = 0.868
tbalance = 0.909
smallsmooth = 0.952

View file

@ -184,11 +184,16 @@ const FontInfoOf = computed.group("metadata:font-info-of", async (target, fileNa
const postHives = [...bp.post.design, ...bp.post[sfi.slant]];
return {
name: fileName,
hives: ["iosevka", ...preHives, ...sfi.hives, ...postHives],
// Hives
preHives,
// Shape
shape: {
weight: sfi.shapeWeight,
width: sfi.shapeWidth
slant: sfi.slant,
width: sfi.shapeWidth,
quasiProportionalDiversity: bp["quasiProportionalDiversity"] || 0
},
// Menu
menu: {
family: bp.family,
version: version,
@ -196,6 +201,7 @@ const FontInfoOf = computed.group("metadata:font-info-of", async (target, fileNa
slant: sfi.menuSlant,
weight: sfi.menuWeight
},
// CSS
css: {
weight: sfi.cssWeight,
stretch: sfi.cssStretch,
@ -217,7 +223,6 @@ function getSuffixMapping(weights, slants, widths) {
for (const wd in widths) {
const suffix = makeSuffix(w, wd, s, "regular");
mapping[suffix] = {
hives: [`shapeWeight`, `s-${s}`, `shapeWidth`],
weight: w,
shapeWeight: nValidate("Shape weight of " + w, weights[w].shape, vlShapeWeight),
cssWeight: nValidate("CSS weight of " + w, weights[w].css, vlCssWeight),
@ -832,21 +837,15 @@ const UtilScriptFiles = computed("util-script-files", async target => {
return [...js, ...ejs, ...md];
});
const ScriptFiles = computed.group("script-files", async (target, ext) => {
const ss = await target.need(
ScriptsUnder(ext, `font-src/gen`),
ScriptsUnder(ext, `font-src/glyphs`),
ScriptsUnder(ext, `font-src/meta`),
ScriptsUnder(ext, `font-src/otl`),
ScriptsUnder(ext, `font-src/support`)
);
return ss.reduce((a, b) => [...a, ...b]);
const [ss] = await target.need(ScriptsUnder(ext, `font-src`));
return ss;
});
const JavaScriptFromPtl = computed("scripts-js-from-ptl", async target => {
const [ptl] = await target.need(ScriptFiles("ptl"));
return ptl.map(x => x.replace(/\.ptl$/g, ".js"));
});
const ScriptJS = file.glob(`font-src/*/**/*.js`, async (target, path) => {
const ScriptJS = file.glob(`font-src/**/*.js`, async (target, path) => {
const [jsFromPtl] = await target.need(JavaScriptFromPtl);
if (jsFromPtl.indexOf(path.full) >= 0) {
const ptl = path.full.replace(/\.js$/g, ".ptl");
@ -873,6 +872,8 @@ const UtilScripts = task("util-scripts", async target => {
const Parameters = task(`meta:parameters`, async target => {
await target.need(
sfu`params/parameters.toml`,
sfu`params/shape-weight.toml`,
sfu`params/shape-width.toml`,
ofu`params/private-parameters.toml`,
sfu`params/variants.toml`,
sfu`params/ligation-set.toml`