Code cleanup: slant → slope
This commit is contained in:
parent
bbf73e9748
commit
3389ad5d66
14 changed files with 99 additions and 86 deletions
|
@ -114,16 +114,16 @@ Since version 2.0, Iosevka would no longer support building via `makefile`. To i
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
|
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
# Override default building slant sets
|
# Override default building slope sets
|
||||||
# Format: <upright|italic|oblique> = <"normal"|"italic"|"oblique">
|
# Format: <upright|italic|oblique> = <"normal"|"italic"|"oblique">
|
||||||
# When this section is absent, all slants would be built.
|
# When this section is absent, all slopes would be built.
|
||||||
|
|
||||||
[buildPlans.iosevka-custom.slants]
|
[buildPlans.iosevka-custom.slopes]
|
||||||
upright = "normal"
|
upright = "normal"
|
||||||
italic = "italic"
|
italic = "italic"
|
||||||
oblique = "oblique"
|
oblique = "oblique"
|
||||||
|
|
||||||
# End slant section
|
# End slope section
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
|
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
|
|
|
@ -536,7 +536,7 @@ from = ["iosevka-sparkle"]
|
||||||
[collectConfig]
|
[collectConfig]
|
||||||
distinguishWeights = true
|
distinguishWeights = true
|
||||||
distinguishWidths = false
|
distinguishWidths = false
|
||||||
distinguishSlant = false
|
distinguishSlope = false
|
||||||
|
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
# Weight mappings (style => shape weight, menu weight, CSS weight)
|
# Weight mappings (style => shape weight, menu weight, CSS weight)
|
||||||
|
@ -591,10 +591,10 @@ shape = 900
|
||||||
menu = 900
|
menu = 900
|
||||||
css = 900
|
css = 900
|
||||||
|
|
||||||
# Slant mappings (style => CSS)
|
# slope 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
|
||||||
# the webfont CSS. Change `params/parameters.toml` instead.
|
# the webfont CSS. Change `params/parameters.toml` instead.
|
||||||
[slants]
|
[slopes]
|
||||||
upright = "normal"
|
upright = "normal"
|
||||||
oblique = "oblique"
|
oblique = "oblique"
|
||||||
italic = "italic"
|
italic = "italic"
|
||||||
|
|
|
@ -43,7 +43,7 @@ function extractGlyfCmap(glyphList, font) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function regulateGlyphList(para, gs) {
|
function regulateGlyphList(para, gs) {
|
||||||
const skew = Math.tan(((para.slantAngle || 0) / 180) * Math.PI);
|
const skew = Math.tan(((para.slopeAngle || 0) / 180) * Math.PI);
|
||||||
|
|
||||||
const excludeUnicode = new Set();
|
const excludeUnicode = new Set();
|
||||||
excludeUnicode.add(0x80);
|
excludeUnicode.add(0x80);
|
||||||
|
|
|
@ -773,14 +773,14 @@ glyph-block CommonShapes : begin
|
||||||
local gs : buildGlyphs p shouldBuildList shouldBuildUnicodes
|
local gs : buildGlyphs p shouldBuildList shouldBuildUnicodes
|
||||||
return gs.glyphs
|
return gs.glyphs
|
||||||
|
|
||||||
define [Miniature] : params [glyphs crowd scale [slantAngle para.slantAngle] [sbscale (Width / UPM)] [mono false]] : begin
|
define [Miniature] : params [glyphs crowd scale [slopeAngle para.slopeAngle] [sbscale (Width / UPM)] [mono false]] : begin
|
||||||
local forkedPara : Object.create para
|
local forkedPara : Object.create para
|
||||||
forkedPara.stroke = [adviceBlackness crowd : Math.pow [clamp 0 1 (HalfUPM / Width)] 0.5] / scale
|
forkedPara.stroke = [adviceBlackness crowd : Math.pow [clamp 0 1 (HalfUPM / Width)] 0.5] / scale
|
||||||
forkedPara.ess = para.ess * forkedPara.stroke / para.stroke
|
forkedPara.ess = para.ess * forkedPara.stroke / para.stroke
|
||||||
forkedPara.dotsize = para.dotsize * forkedPara.stroke / para.stroke
|
forkedPara.dotsize = para.dotsize * forkedPara.stroke / para.stroke
|
||||||
forkedPara.periodsize = para.periodsize * forkedPara.stroke / para.stroke
|
forkedPara.periodsize = para.periodsize * forkedPara.stroke / para.stroke
|
||||||
forkedPara.sb = SB * sbscale
|
forkedPara.sb = SB * sbscale
|
||||||
forkedPara.slantAngle = slantAngle
|
forkedPara.slopeAngle = slopeAngle
|
||||||
if mono : begin
|
if mono : begin
|
||||||
forkedPara.diversityM = 1
|
forkedPara.diversityM = 1
|
||||||
return : Fork glyphs forkedPara
|
return : Fork glyphs forkedPara
|
||||||
|
|
|
@ -1651,9 +1651,9 @@ glyph-block Letter-Latin-Lower-Y : begin
|
||||||
include : yBaseSerif top bottom
|
include : yBaseSerif top bottom
|
||||||
|
|
||||||
define [SmallLambdaShape top bottom] : ReverseContours : glyph-construction
|
define [SmallLambdaShape top bottom] : ReverseContours : glyph-construction
|
||||||
set currentGlyph.gizmo : Italify (-para.slantAngle)
|
set currentGlyph.gizmo : Italify (-para.slopeAngle)
|
||||||
include : SmallYShape top bottom
|
include : SmallYShape top bottom
|
||||||
set currentGlyph.gizmo : Italify (+para.slantAngle)
|
set currentGlyph.gizmo : Italify (+para.slopeAngle)
|
||||||
# apply-transform : Upright
|
# apply-transform : Upright
|
||||||
apply-transform : Translate 0 (-[mix bottom top 0.5])
|
apply-transform : Translate 0 (-[mix bottom top 0.5])
|
||||||
apply-transform : Scale 1 (-1)
|
apply-transform : Scale 1 (-1)
|
||||||
|
@ -4593,7 +4593,7 @@ glyph-block Letter-Latin-Lower-F : begin
|
||||||
do "f ligatures"
|
do "f ligatures"
|
||||||
local shift (-(Width * 0.055 + SB * 0.5))
|
local shift (-(Width * 0.055 + SB * 0.5))
|
||||||
local barr RightSB
|
local barr RightSB
|
||||||
local hbarleft (SB + shift + Stroke * [if para.slantAngle 0.5 0.25])
|
local hbarleft (SB + shift + Stroke * [if para.slopeAngle 0.5 0.25])
|
||||||
|
|
||||||
sketch # f_i
|
sketch # f_i
|
||||||
include MarkSet.b
|
include MarkSet.b
|
||||||
|
|
|
@ -86,7 +86,7 @@ glyph-block Symbol-Math-Letter-Like : begin
|
||||||
glyphs -- {'eight.lnum' 'rotetedpropto'}
|
glyphs -- {'eight.lnum' 'rotetedpropto'}
|
||||||
crowd -- 4
|
crowd -- 4
|
||||||
scale -- s
|
scale -- s
|
||||||
slantAngle -- 0
|
slopeAngle -- 0
|
||||||
|
|
||||||
sketch # infty
|
sketch # infty
|
||||||
set-width MosaicWidth
|
set-width MosaicWidth
|
||||||
|
@ -694,13 +694,13 @@ glyph-block Symbol-Math-Logicals : begin
|
||||||
glyph-block Symbol-Math-Relation : begin
|
glyph-block Symbol-Math-Relation : begin
|
||||||
glyph-block-import CommonShapes
|
glyph-block-import CommonShapes
|
||||||
glyph-block-import Overmarks : TildeShape
|
glyph-block-import Overmarks : TildeShape
|
||||||
glyph-block-export dH lessSlantness
|
glyph-block-export dH LessSlope
|
||||||
glyph-block-export LessShape GreaterShape LigationLessShape LigationGreaterShape
|
glyph-block-export LessShape GreaterShape LigationLessShape LigationGreaterShape
|
||||||
glyph-block-export EqualShape EqualHole IdentShape IdentHole EqualHalfSpace
|
glyph-block-export EqualShape EqualHole IdentShape IdentHole EqualHalfSpace
|
||||||
|
|
||||||
define EqualHalfSpace : (operTop - operBot) * 2 * designParameters.equal_wideness
|
define EqualHalfSpace : (operTop - operBot) * 2 * designParameters.equal_wideness
|
||||||
define lessSlantness : (4 / 13) * (operTop - operBot) / (RightSB - SB)
|
define LessSlope : (4 / 13) * (operTop - operBot) / (RightSB - SB)
|
||||||
define dH : lessSlantness * (RightSB - SB)
|
define dH : LessSlope * (RightSB - SB)
|
||||||
define lessEqDist : Math.max [adviceBlackness 4] (XH * 0.16)
|
define lessEqDist : Math.max [adviceBlackness 4] (XH * 0.16)
|
||||||
|
|
||||||
define [EqualShape left right] : union
|
define [EqualShape left right] : union
|
||||||
|
|
|
@ -1307,11 +1307,11 @@ glyph-block Symbol-Other-I-Ching : begin
|
||||||
|
|
||||||
glyph-block Symbol-Other-Ligation : begin
|
glyph-block Symbol-Other-Ligation : begin
|
||||||
glyph-block-import CommonShapes
|
glyph-block-import CommonShapes
|
||||||
glyph-block-import Symbol-Math-Relation : lessSlantness
|
glyph-block-import Symbol-Math-Relation : LessSlope
|
||||||
|
|
||||||
local arrowheadsKern : (2 / 3) * [clamp 0 (Width * 0.4) (Width - OperatorStroke * 3)]
|
local arrowheadsKern : (2 / 3) * [clamp 0 (Width * 0.4) (Width - OperatorStroke * 3)]
|
||||||
|
|
||||||
define arrowheadSlope : 1 / lessSlantness
|
define arrowheadSlope : 1 / LessSlope
|
||||||
define [ArrowBarConfig extend kern join doubleBar] : begin
|
define [ArrowBarConfig extend kern join doubleBar] : begin
|
||||||
define cleft O
|
define cleft O
|
||||||
define cright (Width - O)
|
define cright (Width - O)
|
||||||
|
@ -1600,7 +1600,7 @@ glyph-block Symbol-Other-Ligation : begin
|
||||||
|
|
||||||
local trigLeft : mix SB RightSB (1/6)
|
local trigLeft : mix SB RightSB (1/6)
|
||||||
local trigRight : Width * 1.5 - OperatorStroke * 1.5 * HVContrast
|
local trigRight : Width * 1.5 - OperatorStroke * 1.5 * HVContrast
|
||||||
local dHTriangle : lessSlantness * (trigRight - trigLeft)
|
local dHTriangle : LessSlope * (trigRight - trigLeft)
|
||||||
|
|
||||||
define [TrigLeftShape shift] : LessShape (symbolMid + dHTriangle) (symbolMid - dHTriangle) (trigLeft + shift) (trigRight + shift)
|
define [TrigLeftShape shift] : LessShape (symbolMid + dHTriangle) (symbolMid - dHTriangle) (trigLeft + shift) (trigRight + shift)
|
||||||
define [TrigRightShape shift] : GreaterShape (symbolMid + dHTriangle) (symbolMid - dHTriangle) (Width - trigRight + shift) (Width - trigLeft + shift)
|
define [TrigRightShape shift] : GreaterShape (symbolMid + dHTriangle) (symbolMid - dHTriangle) (Width - trigRight + shift) (Width - trigLeft + shift)
|
||||||
|
|
|
@ -41,7 +41,7 @@ async function getParameters(argv) {
|
||||||
Parameters.apply(para, parametersData, argv.preHives);
|
Parameters.apply(para, parametersData, argv.preHives);
|
||||||
Parameters.apply(para, parametersData, ["shapeWeight"], { shapeWeight: argv.shape.weight });
|
Parameters.apply(para, parametersData, ["shapeWeight"], { shapeWeight: argv.shape.weight });
|
||||||
Parameters.apply(para, parametersData, ["shapeWidth"], { shapeWidth: argv.shape.width });
|
Parameters.apply(para, parametersData, ["shapeWidth"], { shapeWidth: argv.shape.width });
|
||||||
Parameters.apply(para, parametersData, [`s-${argv.shape.slant}`]);
|
Parameters.apply(para, parametersData, [`s-${argv.shape.slope}`]);
|
||||||
Parameters.apply(para, parametersData, [`diversity-${argv.shape.quasiProportionalDiversity}`]);
|
Parameters.apply(para, parametersData, [`diversity-${argv.shape.quasiProportionalDiversity}`]);
|
||||||
|
|
||||||
const variantsData = FormVariantData(rawVariantsData, para);
|
const variantsData = FormVariantData(rawVariantsData, para);
|
||||||
|
@ -65,7 +65,7 @@ async function getParameters(argv) {
|
||||||
version: argv.menu.version,
|
version: argv.menu.version,
|
||||||
weight: argv.menu.weight - 0,
|
weight: argv.menu.weight - 0,
|
||||||
width: argv.menu.width - 0,
|
width: argv.menu.width - 0,
|
||||||
slant: argv.menu.slant
|
slope: argv.menu.slope
|
||||||
};
|
};
|
||||||
return para;
|
return para;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,18 +34,18 @@ export : define [calculateMetrics para] : begin
|
||||||
|
|
||||||
# Transform constructors
|
# Transform constructors
|
||||||
define [Italify angle shift] : begin
|
define [Italify angle shift] : begin
|
||||||
local slope [Math.tan ([fallback angle para.slantAngle] / 180 * Math.PI)]
|
local slope [Math.tan ([fallback angle para.slopeAngle] / 180 * Math.PI)]
|
||||||
return : new Transform 1 slope 0 1 [fallback shift : -slope * symbolMid] 0
|
return : new Transform 1 slope 0 1 [fallback shift : -slope * symbolMid] 0
|
||||||
define [Upright angle shift] [Italify angle shift :.inverse]
|
define [Upright angle shift] [Italify angle shift :.inverse]
|
||||||
define [Scale sx sy] : new Transform sx 0 0 [fallback sy sx] 0 0
|
define [Scale sx sy] : new Transform sx 0 0 [fallback sy sx] 0 0
|
||||||
define [Translate x y] : new Transform 1 0 0 1 x y
|
define [Translate x y] : new Transform 1 0 0 1 x y
|
||||||
define [Rotate angle] : new Transform [Math.cos angle] (-[Math.sin angle]) [Math.sin angle] [Math.cos angle] 0 0
|
define [Rotate angle] : new Transform [Math.cos angle] (-[Math.sin angle]) [Math.sin angle] [Math.cos angle] 0 0
|
||||||
|
|
||||||
define globalTransform : Italify para.slantAngle
|
define globalTransform : Italify para.slopeAngle
|
||||||
define TanSlope globalTransform.yx
|
define TanSlope globalTransform.yx
|
||||||
define SINSLANT : Math.sin (para.slantAngle / 180 * Math.PI)
|
define SinSlope : Math.sin (para.slopeAngle / 180 * Math.PI)
|
||||||
define COSSLANT : Math.cos (para.slantAngle / 180 * Math.PI)
|
define CosSlope : Math.cos (para.slopeAngle / 180 * Math.PI)
|
||||||
define HVContrast : Contrast * COSSLANT + SINSLANT * TanSlope
|
define HVContrast : Contrast * CosSlope + SinSlope * TanSlope
|
||||||
|
|
||||||
# Orient parameters
|
# Orient parameters
|
||||||
define Upward : new Point (-HVContrast) 0
|
define Upward : new Point (-HVContrast) 0
|
||||||
|
@ -213,7 +213,7 @@ export : define [setFontMetrics para metrics fm] : begin
|
||||||
|
|
||||||
set fm.OS_2.sxHeight XH
|
set fm.OS_2.sxHeight XH
|
||||||
set fm.OS_2.sCapHeight CAP
|
set fm.OS_2.sCapHeight CAP
|
||||||
set fm.post.italicAngle (0 - para.slantAngle)
|
set fm.post.italicAngle (0 - para.slopeAngle)
|
||||||
|
|
||||||
|
|
||||||
export : define [compositeBaseAnchors] : begin
|
export : define [compositeBaseAnchors] : begin
|
||||||
|
|
|
@ -53,7 +53,7 @@ define widthToMenuStyleMap : object
|
||||||
7 "Extended"
|
7 "Extended"
|
||||||
8 "Extra-Extended"
|
8 "Extra-Extended"
|
||||||
9 "Ultra-Extended"
|
9 "Ultra-Extended"
|
||||||
define slantToMenuStyleMap : object
|
define slopeToMenuStyleMap : object
|
||||||
normal ""
|
normal ""
|
||||||
italic "Italic"
|
italic "Italic"
|
||||||
oblique "Oblique"
|
oblique "Oblique"
|
||||||
|
@ -79,33 +79,33 @@ define widthToMenuStyleMapShort : object
|
||||||
7 "Ex"
|
7 "Ex"
|
||||||
8 "XEx"
|
8 "XEx"
|
||||||
9 "UltEx"
|
9 "UltEx"
|
||||||
define slantToMenuStyleMapShort : object
|
define slopeToMenuStyleMapShort : object
|
||||||
normal ""
|
normal ""
|
||||||
italic "It"
|
italic "It"
|
||||||
oblique "Obl"
|
oblique "Obl"
|
||||||
|
|
||||||
define [getStyle weight width slant] : begin
|
define [getStyle weight width slope] : begin
|
||||||
define weightPart : fallback weightToMenuStyleMap.(weight) ('W' + weight)
|
define weightPart : fallback weightToMenuStyleMap.(weight) ('W' + weight)
|
||||||
define widthPart widthToMenuStyleMap.(width)
|
define widthPart widthToMenuStyleMap.(width)
|
||||||
define slantPart slantToMenuStyleMap.(slant)
|
define slopePart slopeToMenuStyleMap.(slope)
|
||||||
define rawName : weightPart + ' ' + widthPart + ' ' + slantPart
|
define rawName : weightPart + ' ' + widthPart + ' ' + slopePart
|
||||||
return : [[rawName.replace [regex ' +' 'g'] ' '].trim] || "Regular"
|
return : [[rawName.replace [regex ' +' 'g'] ' '].trim] || "Regular"
|
||||||
|
|
||||||
define [getShortStyle weight width slant] : begin
|
define [getShortStyle weight width slope] : begin
|
||||||
define weightPart : fallback weightToMenuStyleMapShort.(weight) ('W' + weight)
|
define weightPart : fallback weightToMenuStyleMapShort.(weight) ('W' + weight)
|
||||||
define widthPart widthToMenuStyleMapShort.(width)
|
define widthPart widthToMenuStyleMapShort.(width)
|
||||||
define slantPart slantToMenuStyleMapShort.(slant)
|
define slopePart slopeToMenuStyleMapShort.(slope)
|
||||||
define rawName : weightPart + ' ' + widthPart + ' ' + slantPart
|
define rawName : weightPart + ' ' + widthPart + ' ' + slopePart
|
||||||
return : [rawName.replace [regex ' ' 'g'] ''] || "Regular"
|
return : [rawName.replace [regex ' ' 'g'] ''] || "Regular"
|
||||||
|
|
||||||
define [isRBIBI weight slant] : (weight == 400 || weight == 700) && (slant == "normal" || slant == "italic")
|
define [isRBIBI weight slope] : (weight == 400 || weight == 700) && (slope == "normal" || slope == "italic")
|
||||||
|
|
||||||
define [getStyleLinkedStyles weight width slant] : begin
|
define [getStyleLinkedStyles weight width slope] : begin
|
||||||
local linkWeight weight
|
local linkWeight weight
|
||||||
local linkSlant slant
|
local linkSlope slope
|
||||||
local nameSuffixWeight 400
|
local nameSuffixWeight 400
|
||||||
local nameSuffixWidth width
|
local nameSuffixWidth width
|
||||||
local nameSuffixSlant "normal"
|
local nameSuffixSlope "normal"
|
||||||
|
|
||||||
# Not regular or bold
|
# Not regular or bold
|
||||||
if (linkWeight != 400 && linkWeight != 700) : begin
|
if (linkWeight != 400 && linkWeight != 700) : begin
|
||||||
|
@ -113,14 +113,14 @@ define [getStyleLinkedStyles weight width slant] : begin
|
||||||
linkWeight = 400
|
linkWeight = 400
|
||||||
|
|
||||||
# Not "normal" or italic
|
# Not "normal" or italic
|
||||||
if (linkSlant != "normal" && linkSlant != "italic") : begin
|
if (linkSlope != "normal" && linkSlope != "italic") : begin
|
||||||
nameSuffixSlant = linkSlant
|
nameSuffixSlope = linkSlope
|
||||||
linkSlant = "normal"
|
linkSlope = "normal"
|
||||||
|
|
||||||
return : list
|
return : list
|
||||||
getStyle linkWeight 5 linkSlant
|
getStyle linkWeight 5 linkSlope
|
||||||
getStyle nameSuffixWeight nameSuffixWidth nameSuffixSlant
|
getStyle nameSuffixWeight nameSuffixWidth nameSuffixSlope
|
||||||
getShortStyle nameSuffixWeight nameSuffixWidth nameSuffixSlant
|
getShortStyle nameSuffixWeight nameSuffixWidth nameSuffixSlope
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,11 +128,11 @@ export : define [assignFontNames para metrics font] : begin
|
||||||
set font.name {}
|
set font.name {}
|
||||||
|
|
||||||
define family : para.naming.family.trim
|
define family : para.naming.family.trim
|
||||||
define style : getStyle para.naming.weight para.naming.width para.naming.slant
|
define style : getStyle para.naming.weight para.naming.width para.naming.slope
|
||||||
define version : "Version " + para.naming.version
|
define version : "Version " + para.naming.version
|
||||||
|
|
||||||
define isItalic : para.naming.slant == "italic"
|
define isItalic : para.naming.slope == "italic"
|
||||||
define isOblique : para.naming.slant == "oblique"
|
define isOblique : para.naming.slope == "oblique"
|
||||||
define isBold : para.naming.weight > 650
|
define isBold : para.naming.weight > 650
|
||||||
|
|
||||||
nameFont font PREFERRED_FAMILY family # Preferred Family
|
nameFont font PREFERRED_FAMILY family # Preferred Family
|
||||||
|
@ -143,7 +143,7 @@ export : define [assignFontNames para metrics font] : begin
|
||||||
set font.name.preferredFamily family
|
set font.name.preferredFamily family
|
||||||
set font.name.preferredSubFamily style
|
set font.name.preferredSubFamily style
|
||||||
|
|
||||||
local {compatStyle compatFamilySuffix shortCompatFamilySuffix} : getStyleLinkedStyles para.naming.weight para.naming.width para.naming.slant
|
local {compatStyle compatFamilySuffix shortCompatFamilySuffix} : getStyleLinkedStyles para.naming.weight para.naming.width para.naming.slope
|
||||||
local compatFamily family
|
local compatFamily family
|
||||||
if (compatFamilySuffix != "Regular") : set compatFamily : family + ' ' + compatFamilySuffix
|
if (compatFamilySuffix != "Regular") : set compatFamily : family + ' ' + compatFamilySuffix
|
||||||
if (compatFamily.length >= 31) : set compatFamily : family + ' ' + shortCompatFamilySuffix
|
if (compatFamily.length >= 31) : set compatFamily : family + ' ' + shortCompatFamilySuffix
|
||||||
|
@ -171,7 +171,7 @@ export : define [assignFontNames para metrics font] : begin
|
||||||
if (a.languageID != b.languageID) : return : a.languageID - b.languageID
|
if (a.languageID != b.languageID) : return : a.languageID - b.languageID
|
||||||
return : a.nameID - b.nameID
|
return : a.nameID - b.nameID
|
||||||
|
|
||||||
# Weight, width and slantness
|
# Weight, width and slope
|
||||||
set font.OS_2.usWeightClass para.naming.weight
|
set font.OS_2.usWeightClass para.naming.weight
|
||||||
set font.OS_2.usWidthClass para.naming.width
|
set font.OS_2.usWidthClass para.naming.width
|
||||||
set font.OS_2.panose.2 : 1 + para.naming.weight / 100
|
set font.OS_2.panose.2 : 1 + para.naming.weight / 100
|
||||||
|
|
|
@ -29,7 +29,7 @@ arrowHeight = 1.50 # Height of arrows
|
||||||
|
|
||||||
contrast = 1.11111 # Stroke width contrast.
|
contrast = 1.11111 # Stroke width contrast.
|
||||||
|
|
||||||
slantAngle = 0 # Slant angle, in degrees.
|
slopeAngle = 0 # slope angle, in degrees.
|
||||||
|
|
||||||
accent = 155 # Height of accent marks.
|
accent = 155 # Height of accent marks.
|
||||||
accentx = 200 # Width of accent marks.
|
accentx = 200 # Width of accent marks.
|
||||||
|
@ -97,15 +97,15 @@ enableLigation = false
|
||||||
[no-cv-ss]
|
[no-cv-ss]
|
||||||
enableCvSs = false
|
enableCvSs = false
|
||||||
|
|
||||||
###### Slantness
|
###### Slopes
|
||||||
[s-italic]
|
[s-italic]
|
||||||
isItalic = true
|
isItalic = true
|
||||||
slantAngle = 10
|
slopeAngle = 10
|
||||||
jhook = 120
|
jhook = 120
|
||||||
|
|
||||||
[s-oblique]
|
[s-oblique]
|
||||||
isOblique = true
|
isOblique = true
|
||||||
slantAngle = 10
|
slopeAngle = 10
|
||||||
jhook = 120
|
jhook = 120
|
||||||
|
|
||||||
###### Diversity
|
###### Diversity
|
||||||
|
|
|
@ -33,16 +33,16 @@ css = 700
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
|
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
# Override default building slant sets
|
# Override default building slope sets
|
||||||
# Format: <upright|italic|oblique> = <"normal"|"italic"|"oblique">
|
# Format: <upright|italic|oblique> = <"normal"|"italic"|"oblique">
|
||||||
# When this section is absent, all slants would be built.
|
# When this section is absent, all slopes would be built.
|
||||||
|
|
||||||
[buildPlans.iosevka-custom.slants]
|
[buildPlans.iosevka-custom.slopes]
|
||||||
upright = "normal"
|
upright = "normal"
|
||||||
italic = "italic"
|
italic = "italic"
|
||||||
oblique = "oblique"
|
oblique = "oblique"
|
||||||
|
|
||||||
# End slant section
|
# End slope section
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
|
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
|
|
63
verdafile.js
63
verdafile.js
|
@ -121,14 +121,17 @@ const BuildPlans = computed("metadata:build-plans", async target => {
|
||||||
const fileNameToBpMap = {};
|
const fileNameToBpMap = {};
|
||||||
for (const prefix in rawBuildPlans) {
|
for (const prefix in rawBuildPlans) {
|
||||||
const bp = { ...rawBuildPlans[prefix] };
|
const bp = { ...rawBuildPlans[prefix] };
|
||||||
shimBuildPlans(bp, rp.weights, rp.slants, rp.widths);
|
validateAndShimBuildPlans(prefix, bp, rp.weights, rp.slopes, rp.widths);
|
||||||
|
|
||||||
bp.targets = [];
|
bp.targets = [];
|
||||||
const suffixMapping = getSuffixMapping(bp.weights, bp.slants, bp.widths);
|
const weights = bp.weights,
|
||||||
|
slopes = bp.slopes,
|
||||||
|
widths = bp.widths;
|
||||||
|
const suffixMapping = getSuffixMapping(weights, slopes, widths);
|
||||||
for (const suffix in suffixMapping) {
|
for (const suffix in suffixMapping) {
|
||||||
const sfi = suffixMapping[suffix];
|
const sfi = suffixMapping[suffix];
|
||||||
if (bp.weights && !bp.weights[sfi.weight]) continue;
|
if (weights && !weights[sfi.weight]) continue;
|
||||||
if (bp.slants && !bp.slants[sfi.slant]) continue;
|
if (slopes && !slopes[sfi.slope]) continue;
|
||||||
const fileName = [prefix, suffix].join("-");
|
const fileName = [prefix, suffix].join("-");
|
||||||
bp.targets.push(fileName);
|
bp.targets.push(fileName);
|
||||||
fileNameToBpMap[fileName] = { prefix, suffix };
|
fileNameToBpMap[fileName] = { prefix, suffix };
|
||||||
|
@ -138,7 +141,17 @@ const BuildPlans = computed("metadata:build-plans", async target => {
|
||||||
return { fileNameToBpMap, buildPlans: returnBuildPlans };
|
return { fileNameToBpMap, buildPlans: returnBuildPlans };
|
||||||
});
|
});
|
||||||
|
|
||||||
function shimBuildPlans(bp, dWeights, dSlants, dWidths) {
|
function validateAndShimBuildPlans(prefix, bp, dWeights, dSlopes, dWidths) {
|
||||||
|
if (!bp.family) {
|
||||||
|
fail(`Build plan for ${prefix} does not have a family name. Exit.`);
|
||||||
|
}
|
||||||
|
if (!bp.slopes && bp.slants) {
|
||||||
|
echo.warn(
|
||||||
|
`Build plan for ${prefix} uses legacy "slants" to define slopes. ` +
|
||||||
|
`Use "slopes" instead.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!bp.pre) bp.pre = {};
|
if (!bp.pre) bp.pre = {};
|
||||||
if (!bp.post) bp.post = {};
|
if (!bp.post) bp.post = {};
|
||||||
|
|
||||||
|
@ -153,7 +166,7 @@ function shimBuildPlans(bp, dWeights, dSlants, dWidths) {
|
||||||
if (!bp.post.italic) bp.post.italic = [];
|
if (!bp.post.italic) bp.post.italic = [];
|
||||||
|
|
||||||
bp.weights = bp.weights || dWeights;
|
bp.weights = bp.weights || dWeights;
|
||||||
bp.slants = bp.slants || dSlants;
|
bp.slopes = bp.slopes || bp.slants || dSlopes;
|
||||||
bp.widths = bp.widths || dWidths;
|
bp.widths = bp.widths || dWidths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,9 +192,9 @@ const FontInfoOf = computed.group("metadata:font-info-of", async (target, fileNa
|
||||||
const bp = buildPlans[fi0.prefix];
|
const bp = buildPlans[fi0.prefix];
|
||||||
if (!bp) fail(`Build plan for '${fileName}' not found.` + whyBuildPlanIsnNotThere(fileName));
|
if (!bp) fail(`Build plan for '${fileName}' not found.` + whyBuildPlanIsnNotThere(fileName));
|
||||||
|
|
||||||
const sfi = getSuffixMapping(bp.weights, bp.slants, bp.widths)[fi0.suffix];
|
const sfi = getSuffixMapping(bp.weights, bp.slopes, bp.widths)[fi0.suffix];
|
||||||
const preHives = [...bp.pre.design, ...bp.pre[sfi.slant]];
|
const preHives = [...bp.pre.design, ...bp.pre[sfi.slope]];
|
||||||
const postHives = [...bp.post.design, ...bp.post[sfi.slant]];
|
|
||||||
return {
|
return {
|
||||||
name: fileName,
|
name: fileName,
|
||||||
// Hives
|
// Hives
|
||||||
|
@ -189,7 +202,7 @@ const FontInfoOf = computed.group("metadata:font-info-of", async (target, fileNa
|
||||||
// Shape
|
// Shape
|
||||||
shape: {
|
shape: {
|
||||||
weight: sfi.shapeWeight,
|
weight: sfi.shapeWeight,
|
||||||
slant: sfi.slant,
|
slope: sfi.slope,
|
||||||
width: sfi.shapeWidth,
|
width: sfi.shapeWidth,
|
||||||
quasiProportionalDiversity: bp["quasiProportionalDiversity"] || 0
|
quasiProportionalDiversity: bp["quasiProportionalDiversity"] || 0
|
||||||
},
|
},
|
||||||
|
@ -198,7 +211,7 @@ const FontInfoOf = computed.group("metadata:font-info-of", async (target, fileNa
|
||||||
family: bp.family,
|
family: bp.family,
|
||||||
version: version,
|
version: version,
|
||||||
width: sfi.menuWidth,
|
width: sfi.menuWidth,
|
||||||
slant: sfi.menuSlant,
|
slope: sfi.menuSlope,
|
||||||
weight: sfi.menuWeight
|
weight: sfi.menuWeight
|
||||||
},
|
},
|
||||||
// CSS
|
// CSS
|
||||||
|
@ -214,12 +227,12 @@ const FontInfoOf = computed.group("metadata:font-info-of", async (target, fileNa
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
function getSuffixMapping(weights, slants, widths) {
|
function getSuffixMapping(weights, slopes, widths) {
|
||||||
const mapping = {};
|
const mapping = {};
|
||||||
for (const w in weights) {
|
for (const w in weights) {
|
||||||
validateRecommendedWeight(w, weights[w].menu, "Menu");
|
validateRecommendedWeight(w, weights[w].menu, "Menu");
|
||||||
validateRecommendedWeight(w, weights[w].css, "CSS");
|
validateRecommendedWeight(w, weights[w].css, "CSS");
|
||||||
for (const s in slants) {
|
for (const s in slopes) {
|
||||||
for (const wd in widths) {
|
for (const wd in widths) {
|
||||||
const suffix = makeSuffix(w, wd, s, "regular");
|
const suffix = makeSuffix(w, wd, s, "regular");
|
||||||
mapping[suffix] = {
|
mapping[suffix] = {
|
||||||
|
@ -236,9 +249,9 @@ function getSuffixMapping(weights, slants, widths) {
|
||||||
),
|
),
|
||||||
cssStretch: widths[wd].css || wd,
|
cssStretch: widths[wd].css || wd,
|
||||||
menuWidth: nValidate("Menu width of " + wd, widths[wd].menu, vlMenuWidth),
|
menuWidth: nValidate("Menu width of " + wd, widths[wd].menu, vlMenuWidth),
|
||||||
slant: s,
|
slope: s,
|
||||||
cssStyle: slants[s] || s,
|
cssStyle: slopes[s] || s,
|
||||||
menuSlant: slants[s] || s
|
menuSlope: slopes[s] || s
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,7 +348,7 @@ const CollectPlans = computed(`metadata:collect-plans`, async target => {
|
||||||
|
|
||||||
const StandardSuffixes = computed(`metadata:standard-suffixes`, async target => {
|
const StandardSuffixes = computed(`metadata:standard-suffixes`, async target => {
|
||||||
const [rp] = await target.need(RawPlans);
|
const [rp] = await target.need(RawPlans);
|
||||||
return getSuffixMapping(rp.weights, rp.slants, rp.widths);
|
return getSuffixMapping(rp.weights, rp.slopes, rp.widths);
|
||||||
});
|
});
|
||||||
|
|
||||||
async function getCollectPlans(target, rawCollectPlans, suffixMapping, config, fnFileName) {
|
async function getCollectPlans(target, rawCollectPlans, suffixMapping, config, fnFileName) {
|
||||||
|
@ -352,20 +365,20 @@ async function getCollectPlans(target, rawCollectPlans, suffixMapping, config, f
|
||||||
const [gri] = await target.need(BuildPlanOf(prefix));
|
const [gri] = await target.need(BuildPlanOf(prefix));
|
||||||
const ttfFileNameSet = new Set(gri.targets);
|
const ttfFileNameSet = new Set(gri.targets);
|
||||||
for (const suffix in suffixMapping) {
|
for (const suffix in suffixMapping) {
|
||||||
const gr = suffixMapping[suffix];
|
const sfi = suffixMapping[suffix];
|
||||||
const ttcFileName = fnFileName(
|
const ttcFileName = fnFileName(
|
||||||
config,
|
config,
|
||||||
collectPrefix,
|
collectPrefix,
|
||||||
gr.weight,
|
sfi.weight,
|
||||||
gr.width,
|
sfi.width,
|
||||||
gr.slant
|
sfi.slope
|
||||||
);
|
);
|
||||||
const glyfTtcFileName = fnFileName(
|
const glyfTtcFileName = fnFileName(
|
||||||
{ ...config, distinguishWidths: true },
|
{ ...config, distinguishWidths: true },
|
||||||
collectPrefix,
|
collectPrefix,
|
||||||
gr.weight,
|
sfi.weight,
|
||||||
gr.width,
|
sfi.width,
|
||||||
gr.slant
|
sfi.slope
|
||||||
);
|
);
|
||||||
|
|
||||||
const ttfTargetName = `${prefix}-${suffix}`;
|
const ttfTargetName = `${prefix}-${suffix}`;
|
||||||
|
@ -388,7 +401,7 @@ function fnStandardTtc(collectConfig, prefix, w, wd, s) {
|
||||||
const ttcSuffix = makeSuffix(
|
const ttcSuffix = makeSuffix(
|
||||||
collectConfig.distinguishWeights ? w : "regular",
|
collectConfig.distinguishWeights ? w : "regular",
|
||||||
collectConfig.distinguishWidths ? wd : "normal",
|
collectConfig.distinguishWidths ? wd : "normal",
|
||||||
collectConfig.distinguishSlant ? s : "upright",
|
collectConfig.distinguishSlope ? s : "upright",
|
||||||
"regular"
|
"regular"
|
||||||
);
|
);
|
||||||
return `${prefix}-${ttcSuffix}`;
|
return `${prefix}-${ttcSuffix}`;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue