diff --git a/build-plans.toml b/build-plans.toml index 14133b910..e30af4c14 100644 --- a/build-plans.toml +++ b/build-plans.toml @@ -173,20 +173,45 @@ from = [ "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 -# NOTE: This mapping does NOT affect the font's metadata, only affects -# the webfont CSS. Change `parameters.toml` instead. -[weights] -thin = 100 -extralight = 200 -light = 300 -book = 400 -medium = 500 -semibold = 600 -bold = 700 -extrabold = 800 -heavy = 900 +[weights.thin] +shape = 100 +css = 100 + +[weights.extralight] +shape = 200 +css = 200 + +[weights.light] +shape = 300 +css = 300 + +[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) # NOTE: This mapping does NOT affect the font's metadata, only affects diff --git a/gen/generator.js b/gen/generator.js index 1a03c0e35..1e8f84a8c 100644 --- a/gen/generator.js +++ b/gen/generator.js @@ -108,8 +108,14 @@ function getParameters(argv) { para.variants = variantsData; para.variantSelector = parameters.build(variantsData, argv._); 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; } diff --git a/images/charvars.png b/images/charvars.png index 3dd49dbbf..78e4c1970 100644 Binary files a/images/charvars.png and b/images/charvars.png differ diff --git a/images/download-options.png b/images/download-options.png index b80b0699c..80843b55c 100644 Binary files a/images/download-options.png and b/images/download-options.png differ diff --git a/images/family.png b/images/family.png index 132bc8657..a56e2f9e6 100644 Binary files a/images/family.png and b/images/family.png differ diff --git a/images/languages.png b/images/languages.png index ff0abe2bb..0dd1fe2ea 100644 Binary files a/images/languages.png and b/images/languages.png differ diff --git a/images/ligations.png b/images/ligations.png index a55a57699..2f1ab0134 100644 Binary files a/images/ligations.png and b/images/ligations.png differ diff --git a/images/matrix.png b/images/matrix.png index 1d76cea7a..029fb39f5 100644 Binary files a/images/matrix.png and b/images/matrix.png differ diff --git a/images/preview-all.png b/images/preview-all.png index d9d38b831..1a6832f14 100644 Binary files a/images/preview-all.png and b/images/preview-all.png differ diff --git a/images/stylesets.png b/images/stylesets.png index 3b8d6a7fd..18adfd3cf 100644 Binary files a/images/stylesets.png and b/images/stylesets.png differ diff --git a/images/variants.png b/images/variants.png index d2f820932..6fb38f7ea 100644 Binary files a/images/variants.png and b/images/variants.png differ diff --git a/images/weights.png b/images/weights.png index f9e401454..6c5b814a9 100644 Binary files a/images/weights.png and b/images/weights.png differ diff --git a/meta/naming.ptl b/meta/naming.ptl index 1ed4ae129..6632c2d22 100644 --- a/meta/naming.ptl +++ b/meta/naming.ptl @@ -29,41 +29,65 @@ define [nameFont font nameid str] : begin nameID nameid 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 set font.name {} - set para.family [para.family.trim] - set para.style : [para.style.trim] || "Regular" + define family : para.naming.family.trim + define style : getStyle para.naming.weight para.naming.slant + define version para.naming.version - nameFont font PREFERRED_FAMILY para.family # Preferred Family - nameFont font PREFERRED_STYLE para.style # Preferred Style - nameFont font WWS_PREFERRED_FAMILY para.family # WWS Preferred Family - nameFont font WWS_PREFERRED_STYLE para.style # WWS Preferred Style + define isItalic : para.naming.slant == "italic" + define isOblique : para.naming.slant == "oblique" + define isBold : para.naming.weight > 650 - set font.name.preferredFamily para.family - set font.name.preferredSubFamily para.style - if (para.style == 'Regular' || para.style == 'Bold' || para.style == 'Italic' || para.style == "Bold Italic") : then - nameFont font FAMILY para.family # Family - nameFont font STYLE para.style # Style + nameFont font PREFERRED_FAMILY family # Preferred Family + nameFont font PREFERRED_STYLE style # Preferred Style + nameFont font WWS_PREFERRED_FAMILY family # WWS Preferred Family + nameFont font WWS_PREFERRED_STYLE style # WWS Preferred 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 - local compatFamilySuffix : para.style.replace [regex ' Italic$'] '' :.replace [regex ' Extra'] 'X' - local compatStyle : if [[regex ' Italic$'].test para.style] 'Italic' 'Regular' - nameFont font FAMILY : para.family + ' ' + compatFamilySuffix + local compatFamilySuffix : style.replace [regex ' Italic$'] '' :.replace [regex ' Extra'] 'X' + local compatStyle : if [[regex ' Italic$'].test style] 'Italic' 'Regular' + nameFont font FAMILY : family + ' ' + compatFamilySuffix 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 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 DESIGNER para.designer # Designer - nameFont font DESCRIPTION para.description # Description - nameFont font LICENCE para.licence # Licence + nameFont font DESIGNER para.designer # Designer + nameFont font DESCRIPTION para.description # Description + nameFont font LICENCE para.licence # Licence set font.name : font.name.sort : lambda [a b] : begin 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 # 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.2 : 1 + para.weight / 100 + set font.OS_2.panose.2 : 1 + para.naming.weight / 100 set font.OS_2.fsSelection : object - oblique : not : not para.isOblique - bold : not : not para.isBold - italic : not : not (para.isItalic || para.isOblique) - regular : not : not ([not para.isBold] && [not para.isItalic] && [not para.isOblique]) + oblique : not : not isOblique + bold : not : not isBold + italic : not : not (isItalic || isOblique) + regular : not : not ([not isBold] && [not isItalic] && [not isOblique]) useTypoMetrics true set font.OS_2.sFamilyClass : 8 * 0x100 + 9 set font.post.isFixedPitch true set font.OS_2.xAvgCharWidth para.width set font.head.macStyle : object - bold : not : not para.isBold - italic : not : not (para.isItalic || para.isOblique) \ No newline at end of file + bold : not : not isBold + italic : not : not (isItalic || isOblique) diff --git a/parameters.toml b/parameters.toml index 9d8e46cbf..86ce41e4c 100644 --- a/parameters.toml +++ b/parameters.toml @@ -59,8 +59,8 @@ jbalance = 63 fbalance = 6 onebalance = 30 -isBold = false # Mark the font as bold? isItalic = false # Use italic shapes? +isOblique = false # Use oblique shapes? lllcrowdedness = 3.33333333 @@ -82,10 +82,7 @@ noCJKV = true verbose = true ### Weights -[w-thin] -weight = 100 -style = 'Thin' - +[w-100] stroke = 18 sb = 72 dotsize = 53 @@ -97,10 +94,7 @@ vtipfine = 1 shoulderfine = 0.8 pbarpos = 0.5 -[w-extralight] -weight = 200 -style = 'Extralight' - +[w-200] stroke = 36 sb = 68 dotsize = 70 @@ -111,10 +105,7 @@ cthinb = 0.75 vtipfine = 1 pbarpos = 0.5 -[w-light] -weight = 300 -style = 'Light' - +[w-300] stroke = 56 sb = 64 dotsize = 100 @@ -123,53 +114,39 @@ periodsize = 115 vtipfine = 0.9 pbarpos = 0.51 -[w-book] -isBold = false -weight = 400 # "Weight" metadata. -style = '' - +[w-400] sb = 60 # Side bearing. stroke = 72 # Stroke width of horizontal strokes. dotsize = 125 # "Visual" size of dots in /i. periodsize = 140 # "Visual" size of period. -[w-medium] -weight = 500 -style = 'Medium' - +[w-500] sb = 57 -stroke = 81 -dotsize = 133 -periodsize = 158 +stroke = 84 +dotsize = 135 +periodsize = 160 smooth = 200 -[w-semibold] -weight = 600 -style = 'Semibold' - +[w-600] sb = 54 -stroke = 92 -dotsize = 140 -periodsize = 165 +stroke = 97 +dotsize = 145 +periodsize = 168 essx = 1.07 rbalance = 55 rbalance2 = 20 smooth = 203 -[w-bold] -isBold = true -weight = 700 -style = 'Bold' - +[w-700] sb = 50 -stroke = 102 -dotsize = 152 -periodsize = 176 +stroke = 106 +dotsize = 157 +periodsize = 180 essx = 1.06 essxq = 1.10 -jut = 87 -vjut = 155 +jut = 89 +vjut = 158 barpos = 0.51 fivebarpos = 0.64 @@ -178,32 +155,24 @@ rbalance2 = 23 rhook = 95 smooth = 206 -[w-extrabold] -isBold = true -weight = 800 -style = 'Extrabold' - +[w-800] sb = 45 -stroke = 112 -dotsize = 164 -periodsize = 184 +stroke = 116 +dotsize = 167 +periodsize = 188 essx = 1.05 essxq = 1.15 -jut = 94 -vjut = 170 +jut = 96 +vjut = 172 barpos = 0.51 fivebarpos = 0.64 rbalance = 50 rbalance2 = 25 rhook = 97 -smooth = 212 - -[w-heavy] -isBold = true -weight = 900 -style = 'Heavy' +smooth = 210 +[w-900] sb = 42 stroke = 126 dotsize = 180 @@ -221,27 +190,16 @@ rhook = 105 smooth = 215 ### Slantness -[s-upright] -isItalic = false - [s-italic] isItalic = true slantAngle = 10 jhook = 120 -[s-italic.adds] -style = " Italic" - [s-oblique] isOblique = true -isItalic = false slantAngle = 10 jhook = 120 -[s-oblique.adds] -style = " Oblique" - - ### Slab variant [slab] slab = true diff --git a/verdafile.js b/verdafile.js index d0f243a14..b1f83b36f 100644 --- a/verdafile.js +++ b/verdafile.js @@ -83,13 +83,13 @@ oracle(`o:suffixes`).def(async target => { for (const w in weights) { for (const s in slants) { const suffix = - (w === "book" ? (s === "upright" ? "regular" : "") : w) + + (w === "regular" ? (s === "upright" ? "regular" : "") : w) + (s === "upright" ? "" : s); mapping[suffix] = { - hives: [`w-${w}`, `s-${s}`], + hives: [`w-${weights[w].shape}`, `s-${s}`], weight: w, slant: s, - cssWeight: weights[w], + cssWeight: weights[w].css, cssStyle: slants[s] }; } @@ -173,17 +173,22 @@ oracle("collection-parts-of:*").def(async (target, id) => { /////////////////////////////////////////////////////////// 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 charmap = target.path.dir + "/" + target.path.name + ".charmap"; await target.need("scripts", "parameters.toml", `dir:${target.path.dir}`); await run( GENERATE, - hives, ["-o", otd], ["--charmap", charmap], ["--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 rm(otd);