refactored the process of weight assigning.
|
@ -173,20 +173,45 @@ from = [
|
||||||
"iosevka-cc-slab"
|
"iosevka-cc-slab"
|
||||||
]
|
]
|
||||||
|
|
||||||
# Weight mappings (style => CSS)
|
# Weight mappings (style => shape weight, CSS weight)
|
||||||
|
# Shape weight : affects the shape of the glyphs
|
||||||
|
# CSS weight : affects the font menu name and webfont CSS
|
||||||
# Comment the lines to build less weights
|
# Comment the lines to build less weights
|
||||||
# NOTE: This mapping does NOT affect the font's metadata, only affects
|
[weights.thin]
|
||||||
# the webfont CSS. Change `parameters.toml` instead.
|
shape = 100
|
||||||
[weights]
|
css = 100
|
||||||
thin = 100
|
|
||||||
extralight = 200
|
[weights.extralight]
|
||||||
light = 300
|
shape = 200
|
||||||
book = 400
|
css = 200
|
||||||
medium = 500
|
|
||||||
semibold = 600
|
[weights.light]
|
||||||
bold = 700
|
shape = 300
|
||||||
extrabold = 800
|
css = 300
|
||||||
heavy = 900
|
|
||||||
|
[weights.regular]
|
||||||
|
shape = 400
|
||||||
|
css = 400
|
||||||
|
|
||||||
|
[weights.medium]
|
||||||
|
shape = 500
|
||||||
|
css = 500
|
||||||
|
|
||||||
|
[weights.semibold]
|
||||||
|
shape = 600
|
||||||
|
css = 600
|
||||||
|
|
||||||
|
[weights.bold]
|
||||||
|
shape = 700
|
||||||
|
css = 700
|
||||||
|
|
||||||
|
[weights.extrabold]
|
||||||
|
shape = 800
|
||||||
|
css = 800
|
||||||
|
|
||||||
|
[weights.heavy]
|
||||||
|
shape = 900
|
||||||
|
css = 900
|
||||||
|
|
||||||
# Slant mappings (style => CSS)
|
# Slant mappings (style => CSS)
|
||||||
# NOTE: This mapping does NOT affect the font's metadata, only affects
|
# NOTE: This mapping does NOT affect the font's metadata, only affects
|
||||||
|
|
|
@ -108,8 +108,14 @@ function getParameters(argv) {
|
||||||
para.variants = variantsData;
|
para.variants = variantsData;
|
||||||
para.variantSelector = parameters.build(variantsData, argv._);
|
para.variantSelector = parameters.build(variantsData, argv._);
|
||||||
para.defaultVariant = variantsData.default;
|
para.defaultVariant = variantsData.default;
|
||||||
if (argv.family) para.family = argv.family;
|
|
||||||
if (argv.ver) para.version = argv.ver;
|
para.naming = {
|
||||||
|
family: argv.family,
|
||||||
|
version: argv.ver,
|
||||||
|
weight: argv.weight - 0,
|
||||||
|
slant: argv.slant
|
||||||
|
};
|
||||||
|
|
||||||
return para;
|
return para;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 123 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 130 KiB |
Before Width: | Height: | Size: 422 KiB After Width: | Height: | Size: 422 KiB |
Before Width: | Height: | Size: 191 KiB After Width: | Height: | Size: 191 KiB |
Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 180 KiB |
Before Width: | Height: | Size: 356 KiB After Width: | Height: | Size: 356 KiB |
Before Width: | Height: | Size: 805 KiB After Width: | Height: | Size: 805 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 342 KiB After Width: | Height: | Size: 341 KiB |
|
@ -29,41 +29,65 @@ define [nameFont font nameid str] : begin
|
||||||
nameID nameid
|
nameID nameid
|
||||||
nameString str
|
nameString str
|
||||||
|
|
||||||
|
define weightToMenuStyleMap : object
|
||||||
|
100 "Thin"
|
||||||
|
200 "Extralight"
|
||||||
|
300 "Light"
|
||||||
|
400 ""
|
||||||
|
500 "Medium"
|
||||||
|
600 "Semibold"
|
||||||
|
700 "Bold"
|
||||||
|
800 "Extrabold"
|
||||||
|
900 "Heavy"
|
||||||
|
|
||||||
|
define slantToMenuStyleMap : object
|
||||||
|
normal ""
|
||||||
|
italic "Italic"
|
||||||
|
oblique "Oblique"
|
||||||
|
|
||||||
|
define [getStyle weight slant] : [(weightToMenuStyleMap.(weight) + " " + slantToMenuStyleMap.(slant)).trim] || "Regular"
|
||||||
|
|
||||||
|
|
||||||
export : define [assignFontNames para metrics font] : begin
|
export : define [assignFontNames para metrics font] : begin
|
||||||
set font.name {}
|
set font.name {}
|
||||||
|
|
||||||
set para.family [para.family.trim]
|
define family : para.naming.family.trim
|
||||||
set para.style : [para.style.trim] || "Regular"
|
define style : getStyle para.naming.weight para.naming.slant
|
||||||
|
define version para.naming.version
|
||||||
|
|
||||||
nameFont font PREFERRED_FAMILY para.family # Preferred Family
|
define isItalic : para.naming.slant == "italic"
|
||||||
nameFont font PREFERRED_STYLE para.style # Preferred Style
|
define isOblique : para.naming.slant == "oblique"
|
||||||
nameFont font WWS_PREFERRED_FAMILY para.family # WWS Preferred Family
|
define isBold : para.naming.weight > 650
|
||||||
nameFont font WWS_PREFERRED_STYLE para.style # WWS Preferred Style
|
|
||||||
|
|
||||||
set font.name.preferredFamily para.family
|
nameFont font PREFERRED_FAMILY family # Preferred Family
|
||||||
set font.name.preferredSubFamily para.style
|
nameFont font PREFERRED_STYLE style # Preferred Style
|
||||||
if (para.style == 'Regular' || para.style == 'Bold' || para.style == 'Italic' || para.style == "Bold Italic") : then
|
nameFont font WWS_PREFERRED_FAMILY family # WWS Preferred Family
|
||||||
nameFont font FAMILY para.family # Family
|
nameFont font WWS_PREFERRED_STYLE style # WWS Preferred Style
|
||||||
nameFont font STYLE para.style # Style
|
|
||||||
|
set font.name.preferredFamily family
|
||||||
|
set font.name.preferredSubFamily style
|
||||||
|
if (style == 'Regular' || style == 'Bold' || style == 'Italic' || style == "Bold Italic") : then
|
||||||
|
nameFont font FAMILY family # Family
|
||||||
|
nameFont font STYLE style # Style
|
||||||
: else
|
: else
|
||||||
local compatFamilySuffix : para.style.replace [regex ' Italic$'] '' :.replace [regex ' Extra'] 'X'
|
local compatFamilySuffix : style.replace [regex ' Italic$'] '' :.replace [regex ' Extra'] 'X'
|
||||||
local compatStyle : if [[regex ' Italic$'].test para.style] 'Italic' 'Regular'
|
local compatStyle : if [[regex ' Italic$'].test style] 'Italic' 'Regular'
|
||||||
nameFont font FAMILY : para.family + ' ' + compatFamilySuffix
|
nameFont font FAMILY : family + ' ' + compatFamilySuffix
|
||||||
nameFont font STYLE compatStyle
|
nameFont font STYLE compatStyle
|
||||||
|
|
||||||
nameFont font UNIQUE_NAME "\(para.family) \(para.style) \(para.version)" # Unique Name
|
nameFont font UNIQUE_NAME "\(family) \(style) \(version)" # Unique Name
|
||||||
|
|
||||||
local fontfullName : if (para.style != 'Regular') (para.family + ' ' + para.style) para.family
|
local fontfullName : if (style != 'Regular') (family + ' ' + style) family
|
||||||
nameFont font FULL_NAME fontfullName # Full Name
|
nameFont font FULL_NAME fontfullName # Full Name
|
||||||
nameFont font POSTSCRIPT : fontfullName.replace [regex ' ' 'g'] '-' # Postscript
|
nameFont font POSTSCRIPT : fontfullName.replace [regex ' ' 'g'] '-' # Postscript
|
||||||
|
|
||||||
nameFont font VERSION para.version # Version
|
nameFont font VERSION version # Version
|
||||||
|
|
||||||
nameFont font COPYRIGHT para.copyright # Copyright
|
nameFont font COPYRIGHT para.copyright # Copyright
|
||||||
nameFont font MANUFACTURER para.manufacturer # Manufacturer
|
nameFont font MANUFACTURER para.manufacturer # Manufacturer
|
||||||
nameFont font DESIGNER para.designer # Designer
|
nameFont font DESIGNER para.designer # Designer
|
||||||
nameFont font DESCRIPTION para.description # Description
|
nameFont font DESCRIPTION para.description # Description
|
||||||
nameFont font LICENCE para.licence # Licence
|
nameFont font LICENCE para.licence # Licence
|
||||||
|
|
||||||
set font.name : font.name.sort : lambda [a b] : begin
|
set font.name : font.name.sort : lambda [a b] : begin
|
||||||
if (a.platformID != b.platformID) : return : a.platformID - b.platformID
|
if (a.platformID != b.platformID) : return : a.platformID - b.platformID
|
||||||
|
@ -72,18 +96,18 @@ export : define [assignFontNames para metrics font] : begin
|
||||||
return : a.nameID - b.nameID
|
return : a.nameID - b.nameID
|
||||||
|
|
||||||
# Weight, width and slantness
|
# Weight, width and slantness
|
||||||
set font.OS_2.usWeightClass para.weight
|
set font.OS_2.usWeightClass para.naming.weight
|
||||||
set font.OS_2.panose.3 9 # Monospaced
|
set font.OS_2.panose.3 9 # Monospaced
|
||||||
set font.OS_2.panose.2 : 1 + para.weight / 100
|
set font.OS_2.panose.2 : 1 + para.naming.weight / 100
|
||||||
set font.OS_2.fsSelection : object
|
set font.OS_2.fsSelection : object
|
||||||
oblique : not : not para.isOblique
|
oblique : not : not isOblique
|
||||||
bold : not : not para.isBold
|
bold : not : not isBold
|
||||||
italic : not : not (para.isItalic || para.isOblique)
|
italic : not : not (isItalic || isOblique)
|
||||||
regular : not : not ([not para.isBold] && [not para.isItalic] && [not para.isOblique])
|
regular : not : not ([not isBold] && [not isItalic] && [not isOblique])
|
||||||
useTypoMetrics true
|
useTypoMetrics true
|
||||||
set font.OS_2.sFamilyClass : 8 * 0x100 + 9
|
set font.OS_2.sFamilyClass : 8 * 0x100 + 9
|
||||||
set font.post.isFixedPitch true
|
set font.post.isFixedPitch true
|
||||||
set font.OS_2.xAvgCharWidth para.width
|
set font.OS_2.xAvgCharWidth para.width
|
||||||
set font.head.macStyle : object
|
set font.head.macStyle : object
|
||||||
bold : not : not para.isBold
|
bold : not : not isBold
|
||||||
italic : not : not (para.isItalic || para.isOblique)
|
italic : not : not (isItalic || isOblique)
|
||||||
|
|
|
@ -59,8 +59,8 @@ jbalance = 63
|
||||||
fbalance = 6
|
fbalance = 6
|
||||||
onebalance = 30
|
onebalance = 30
|
||||||
|
|
||||||
isBold = false # Mark the font as bold?
|
|
||||||
isItalic = false # Use italic shapes?
|
isItalic = false # Use italic shapes?
|
||||||
|
isOblique = false # Use oblique shapes?
|
||||||
|
|
||||||
lllcrowdedness = 3.33333333
|
lllcrowdedness = 3.33333333
|
||||||
|
|
||||||
|
@ -82,10 +82,7 @@ noCJKV = true
|
||||||
verbose = true
|
verbose = true
|
||||||
|
|
||||||
### Weights
|
### Weights
|
||||||
[w-thin]
|
[w-100]
|
||||||
weight = 100
|
|
||||||
style = 'Thin'
|
|
||||||
|
|
||||||
stroke = 18
|
stroke = 18
|
||||||
sb = 72
|
sb = 72
|
||||||
dotsize = 53
|
dotsize = 53
|
||||||
|
@ -97,10 +94,7 @@ vtipfine = 1
|
||||||
shoulderfine = 0.8
|
shoulderfine = 0.8
|
||||||
pbarpos = 0.5
|
pbarpos = 0.5
|
||||||
|
|
||||||
[w-extralight]
|
[w-200]
|
||||||
weight = 200
|
|
||||||
style = 'Extralight'
|
|
||||||
|
|
||||||
stroke = 36
|
stroke = 36
|
||||||
sb = 68
|
sb = 68
|
||||||
dotsize = 70
|
dotsize = 70
|
||||||
|
@ -111,10 +105,7 @@ cthinb = 0.75
|
||||||
vtipfine = 1
|
vtipfine = 1
|
||||||
pbarpos = 0.5
|
pbarpos = 0.5
|
||||||
|
|
||||||
[w-light]
|
[w-300]
|
||||||
weight = 300
|
|
||||||
style = 'Light'
|
|
||||||
|
|
||||||
stroke = 56
|
stroke = 56
|
||||||
sb = 64
|
sb = 64
|
||||||
dotsize = 100
|
dotsize = 100
|
||||||
|
@ -123,53 +114,39 @@ periodsize = 115
|
||||||
vtipfine = 0.9
|
vtipfine = 0.9
|
||||||
pbarpos = 0.51
|
pbarpos = 0.51
|
||||||
|
|
||||||
[w-book]
|
[w-400]
|
||||||
isBold = false
|
|
||||||
weight = 400 # "Weight" metadata.
|
|
||||||
style = ''
|
|
||||||
|
|
||||||
sb = 60 # Side bearing.
|
sb = 60 # Side bearing.
|
||||||
stroke = 72 # Stroke width of horizontal strokes.
|
stroke = 72 # Stroke width of horizontal strokes.
|
||||||
dotsize = 125 # "Visual" size of dots in /i.
|
dotsize = 125 # "Visual" size of dots in /i.
|
||||||
periodsize = 140 # "Visual" size of period.
|
periodsize = 140 # "Visual" size of period.
|
||||||
|
|
||||||
[w-medium]
|
[w-500]
|
||||||
weight = 500
|
|
||||||
style = 'Medium'
|
|
||||||
|
|
||||||
sb = 57
|
sb = 57
|
||||||
stroke = 81
|
stroke = 84
|
||||||
dotsize = 133
|
dotsize = 135
|
||||||
periodsize = 158
|
periodsize = 160
|
||||||
smooth = 200
|
smooth = 200
|
||||||
|
|
||||||
[w-semibold]
|
[w-600]
|
||||||
weight = 600
|
|
||||||
style = 'Semibold'
|
|
||||||
|
|
||||||
sb = 54
|
sb = 54
|
||||||
stroke = 92
|
stroke = 97
|
||||||
dotsize = 140
|
dotsize = 145
|
||||||
periodsize = 165
|
periodsize = 168
|
||||||
essx = 1.07
|
essx = 1.07
|
||||||
|
|
||||||
rbalance = 55
|
rbalance = 55
|
||||||
rbalance2 = 20
|
rbalance2 = 20
|
||||||
smooth = 203
|
smooth = 203
|
||||||
|
|
||||||
[w-bold]
|
[w-700]
|
||||||
isBold = true
|
|
||||||
weight = 700
|
|
||||||
style = 'Bold'
|
|
||||||
|
|
||||||
sb = 50
|
sb = 50
|
||||||
stroke = 102
|
stroke = 106
|
||||||
dotsize = 152
|
dotsize = 157
|
||||||
periodsize = 176
|
periodsize = 180
|
||||||
essx = 1.06
|
essx = 1.06
|
||||||
essxq = 1.10
|
essxq = 1.10
|
||||||
jut = 87
|
jut = 89
|
||||||
vjut = 155
|
vjut = 158
|
||||||
|
|
||||||
barpos = 0.51
|
barpos = 0.51
|
||||||
fivebarpos = 0.64
|
fivebarpos = 0.64
|
||||||
|
@ -178,32 +155,24 @@ rbalance2 = 23
|
||||||
rhook = 95
|
rhook = 95
|
||||||
smooth = 206
|
smooth = 206
|
||||||
|
|
||||||
[w-extrabold]
|
[w-800]
|
||||||
isBold = true
|
|
||||||
weight = 800
|
|
||||||
style = 'Extrabold'
|
|
||||||
|
|
||||||
sb = 45
|
sb = 45
|
||||||
stroke = 112
|
stroke = 116
|
||||||
dotsize = 164
|
dotsize = 167
|
||||||
periodsize = 184
|
periodsize = 188
|
||||||
essx = 1.05
|
essx = 1.05
|
||||||
essxq = 1.15
|
essxq = 1.15
|
||||||
jut = 94
|
jut = 96
|
||||||
vjut = 170
|
vjut = 172
|
||||||
|
|
||||||
barpos = 0.51
|
barpos = 0.51
|
||||||
fivebarpos = 0.64
|
fivebarpos = 0.64
|
||||||
rbalance = 50
|
rbalance = 50
|
||||||
rbalance2 = 25
|
rbalance2 = 25
|
||||||
rhook = 97
|
rhook = 97
|
||||||
smooth = 212
|
smooth = 210
|
||||||
|
|
||||||
[w-heavy]
|
|
||||||
isBold = true
|
|
||||||
weight = 900
|
|
||||||
style = 'Heavy'
|
|
||||||
|
|
||||||
|
[w-900]
|
||||||
sb = 42
|
sb = 42
|
||||||
stroke = 126
|
stroke = 126
|
||||||
dotsize = 180
|
dotsize = 180
|
||||||
|
@ -221,27 +190,16 @@ rhook = 105
|
||||||
smooth = 215
|
smooth = 215
|
||||||
|
|
||||||
### Slantness
|
### Slantness
|
||||||
[s-upright]
|
|
||||||
isItalic = false
|
|
||||||
|
|
||||||
[s-italic]
|
[s-italic]
|
||||||
isItalic = true
|
isItalic = true
|
||||||
slantAngle = 10
|
slantAngle = 10
|
||||||
jhook = 120
|
jhook = 120
|
||||||
|
|
||||||
[s-italic.adds]
|
|
||||||
style = " Italic"
|
|
||||||
|
|
||||||
[s-oblique]
|
[s-oblique]
|
||||||
isOblique = true
|
isOblique = true
|
||||||
isItalic = false
|
|
||||||
slantAngle = 10
|
slantAngle = 10
|
||||||
jhook = 120
|
jhook = 120
|
||||||
|
|
||||||
[s-oblique.adds]
|
|
||||||
style = " Oblique"
|
|
||||||
|
|
||||||
|
|
||||||
### Slab variant
|
### Slab variant
|
||||||
[slab]
|
[slab]
|
||||||
slab = true
|
slab = true
|
||||||
|
|
17
verdafile.js
|
@ -83,13 +83,13 @@ oracle(`o:suffixes`).def(async target => {
|
||||||
for (const w in weights) {
|
for (const w in weights) {
|
||||||
for (const s in slants) {
|
for (const s in slants) {
|
||||||
const suffix =
|
const suffix =
|
||||||
(w === "book" ? (s === "upright" ? "regular" : "") : w) +
|
(w === "regular" ? (s === "upright" ? "regular" : "") : w) +
|
||||||
(s === "upright" ? "" : s);
|
(s === "upright" ? "" : s);
|
||||||
mapping[suffix] = {
|
mapping[suffix] = {
|
||||||
hives: [`w-${w}`, `s-${s}`],
|
hives: [`w-${weights[w].shape}`, `s-${s}`],
|
||||||
weight: w,
|
weight: w,
|
||||||
slant: s,
|
slant: s,
|
||||||
cssWeight: weights[w],
|
cssWeight: weights[w].css,
|
||||||
cssStyle: slants[s]
|
cssStyle: slants[s]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -173,17 +173,22 @@ oracle("collection-parts-of:*").def(async (target, id) => {
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
file(`${BUILD}/*/*.ttf`).def(async (target, prefix, suffix) => {
|
file(`${BUILD}/*/*.ttf`).def(async (target, prefix, suffix) => {
|
||||||
const [{ hives, family }, version] = await target.need(`hives-of:${suffix}`, `o:version`);
|
const [{ hives, family, cssWeight, cssStyle }, version] = await target.need(
|
||||||
|
`hives-of:${suffix}`,
|
||||||
|
`o:version`
|
||||||
|
);
|
||||||
const otd = target.path.dir + "/" + target.path.name + ".otd";
|
const otd = target.path.dir + "/" + target.path.name + ".otd";
|
||||||
const charmap = target.path.dir + "/" + target.path.name + ".charmap";
|
const charmap = target.path.dir + "/" + target.path.name + ".charmap";
|
||||||
await target.need("scripts", "parameters.toml", `dir:${target.path.dir}`);
|
await target.need("scripts", "parameters.toml", `dir:${target.path.dir}`);
|
||||||
await run(
|
await run(
|
||||||
GENERATE,
|
GENERATE,
|
||||||
hives,
|
|
||||||
["-o", otd],
|
["-o", otd],
|
||||||
["--charmap", charmap],
|
["--charmap", charmap],
|
||||||
["--family", family],
|
["--family", family],
|
||||||
["--ver", version]
|
["--ver", version],
|
||||||
|
["--weight", cssWeight],
|
||||||
|
["--slant", cssStyle],
|
||||||
|
hives
|
||||||
);
|
);
|
||||||
await run("otfccbuild", otd, "-o", target.path.full, "-O3", "--keep-average-char-width");
|
await run("otfccbuild", otd, "-o", target.path.full, "-O3", "--keep-average-char-width");
|
||||||
await rm(otd);
|
await rm(otd);
|
||||||
|
|