Add width naming; fixes #356

This commit is contained in:
Belleve Invis 2019-09-27 23:01:34 -07:00
parent e69a98cdff
commit 710a8a077f
7 changed files with 97 additions and 35 deletions

View file

@ -155,7 +155,7 @@ The current available styles for `design`/`upright`/`italic`/`oblique` options a
* `powerline-shift-y-n500`, `powerline-shift-y-n450`, `powerline-shift-y-n400`, `powerline-shift-y-n350`, `powerline-shift-y-n300`, `powerline-shift-y-n250`, `powerline-shift-y-n200`, `powerline-shift-y-n150`, `powerline-shift-y-n100`, `powerline-shift-y-n50`, `powerline-shift-y-0`, `powerline-shift-y-p50`, `powerline-shift-y-p100`, `powerline-shift-y-p150`, `powerline-shift-y-p200`, `powerline-shift-y-p250`, `powerline-shift-y-p300`, `powerline-shift-y-p350`, `powerline-shift-y-p400`, `powerline-shift-y-p450`, `powerline-shift-y-p500`: Shift the Powerline symbols vertically, from -0.5em to +0.5em. * `powerline-shift-y-n500`, `powerline-shift-y-n450`, `powerline-shift-y-n400`, `powerline-shift-y-n350`, `powerline-shift-y-n300`, `powerline-shift-y-n250`, `powerline-shift-y-n200`, `powerline-shift-y-n150`, `powerline-shift-y-n100`, `powerline-shift-y-n50`, `powerline-shift-y-0`, `powerline-shift-y-p50`, `powerline-shift-y-p100`, `powerline-shift-y-p150`, `powerline-shift-y-p200`, `powerline-shift-y-p250`, `powerline-shift-y-p300`, `powerline-shift-y-p350`, `powerline-shift-y-p400`, `powerline-shift-y-p450`, `powerline-shift-y-p500`: Shift the Powerline symbols vertically, from -0.5em to +0.5em.
* `powerline-shift-x-n500`, `powerline-shift-x-n450`, `powerline-shift-x-n400`, `powerline-shift-x-n350`, `powerline-shift-x-n300`, `powerline-shift-x-n250`, `powerline-shift-x-n200`, `powerline-shift-x-n150`, `powerline-shift-x-n100`, `powerline-shift-x-n50`, `powerline-shift-x-0`, `powerline-shift-x-p50`, `powerline-shift-x-p100`, `powerline-shift-x-p150`, `powerline-shift-x-p200`, `powerline-shift-x-p250`, `powerline-shift-x-p300`, `powerline-shift-x-p350`, `powerline-shift-x-p400`, `powerline-shift-x-p450`, `powerline-shift-x-p500`: Shift the Powerline symbols horizontally, from -0.5em to +0.5em. * `powerline-shift-x-n500`, `powerline-shift-x-n450`, `powerline-shift-x-n400`, `powerline-shift-x-n350`, `powerline-shift-x-n300`, `powerline-shift-x-n250`, `powerline-shift-x-n200`, `powerline-shift-x-n150`, `powerline-shift-x-n100`, `powerline-shift-x-n50`, `powerline-shift-x-0`, `powerline-shift-x-p50`, `powerline-shift-x-p100`, `powerline-shift-x-p150`, `powerline-shift-x-p200`, `powerline-shift-x-p250`, `powerline-shift-x-p300`, `powerline-shift-x-p350`, `powerline-shift-x-p400`, `powerline-shift-x-p450`, `powerline-shift-x-p500`: Shift the Powerline symbols horizontally, from -0.5em to +0.5em.
* Styles for changing the width: * Styles for changing the width:
* `expanded`: Expand the width by 10%; * `extended`: Expand the width by 10%;
* `compressed`: Compress the width by 10%. * `compressed`: Compress the width by 10%.
* NOTE: these styles are highly experimental. Handle with extreme care. * NOTE: these styles are highly experimental. Handle with extreme care.
* Styles for individual characters. They are easy-to-understand names of the `cv##` styles, including: * Styles for individual characters. They are easy-to-understand names of the `cv##` styles, including:

View file

@ -129,7 +129,7 @@ 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'] oblique = ["v-i-line", "v-l-line", 'v-f-narrow', 'v-t-narrow']
[buildPlans.iosevka-aile.post] [buildPlans.iosevka-aile.post]
design = ['wd-expanded', "diversity-2"] design = ['wd-extended', "diversity-2"]
[buildPlans.iosevka-etoile] [buildPlans.iosevka-etoile]
family = "Iosevka Etoile" family = "Iosevka Etoile"
@ -139,11 +139,18 @@ italic = ['v-i-italic', 'v-l-italic']
oblique = ['v-i-serifed', 'v-l-serifed'] oblique = ['v-i-serifed', 'v-l-serifed']
[buildPlans.iosevka-extended] [buildPlans.iosevka-extended]
family = "Iosevka Extended" family = "Iosevka"
design = ["shape-straight-bar"] design = ["shape-straight-bar"]
[buildPlans.iosevka-extended.post] [buildPlans.iosevka-extended.post]
design = ['wd-expanded'] design = ['wd-extended', 'menu-name-extended']
[buildPlans.iosevka-slab-extended]
family = "Iosevka Slab"
design = ["slab", "shape-straight-bar"]
[buildPlans.iosevka-slab-extended.post]
design = ['wd-extended', 'menu-name-extended']
# Export plans # Export plans
# This mapping affects the process of creating ZIP archives only # This mapping affects the process of creating ZIP archives only

View file

@ -2819,7 +2819,7 @@ export : define [apply] : begin
include : VBarLeft df.leftSB bot top df.mvs include : VBarLeft df.leftSB bot top df.mvs
if SLAB : begin if SLAB : begin
local jut : JUT * df.mvs / STROKE + O local jut : JUT * df.mvs / STROKE + O
if (WIDTH * df.div > jut * 3.5) : begin if (df.width > jut * 7) : begin
include : intersection include : intersection
CenterTopSerif (df.leftSB + 0.5 * df.mvs * HVCONTRAST) top jut df.mvs CenterTopSerif (df.leftSB + 0.5 * df.mvs * HVCONTRAST) top jut df.mvs
spiro-outline spiro-outline
@ -2830,7 +2830,9 @@ export : define [apply] : begin
tag-contour 'serifLT' tag-contour 'serifLT'
if (!para.isItalic) : begin if (!para.isItalic) : begin
include : CenterBottomSerif (df.leftSB + 0.5 * df.mvs * HVCONTRAST) bot jut df.mvs include : CenterBottomSerif (df.leftSB + 0.5 * df.mvs * HVCONTRAST) bot jut df.mvs
tag-contour 'serifLB'
include : CenterBottomSerif df.middle bot jut df.mvs include : CenterBottomSerif df.middle bot jut df.mvs
tag-contour 'serifMB'
include : CenterBottomSerif (df.rightSB - 0.5 * df.mvs * HVCONTRAST) bot jut df.mvs include : CenterBottomSerif (df.rightSB - 0.5 * df.mvs * HVCONTRAST) bot jut df.mvs
tag-contour 'serifRB' tag-contour 'serifRB'
: else : begin : else : begin
@ -2849,18 +2851,19 @@ export : define [apply] : begin
include : RightwardBottomSerif df.rightSB bot SIDEJUT df.mvs include : RightwardBottomSerif df.rightSB bot SIDEJUT df.mvs
tag-contour 'serifRB' tag-contour 'serifRB'
sketch # m sketch # m.longleg
local df : dfM local df : dfM
set-width df.width set-width df.width
include df.markSet.e include df.markSet.e
include : SmallMShape XH 0 0 df include : SmallMShape XH 0 0 df
save 'm.longleg' save 'm.longleg'
save 'cyrte.italic' save 'cyrte.italic'
sketch # m sketch # m.shortleg
local df : dfM local df : dfM
set-width df.width set-width df.width
include df.markSet.e include df.markSet.e
include : SmallMShape XH 0 [XH * 0.2] df include : SmallMShape XH 0 [XH * 0.2] df
eject-contour 'serifMB'
save 'm.shortleg' save 'm.shortleg'
select-variant 'm' 'm' select-variant 'm' 'm'
composite 'cyrtedescender.italic' glyphs.'cyrte.italic' [CyrDescender (WIDTH * para.diversityM - SB)] markset.e composite 'cyrtedescender.italic' glyphs.'cyrte.italic' [CyrDescender (WIDTH * para.diversityM - SB)] markset.e

View file

@ -1170,7 +1170,7 @@ export : define [apply] : begin
include : tagged 'serifRB' : RightwardBottomSerif df.rightSB 0 SIDEJUT include : tagged 'serifRB' : RightwardBottomSerif df.rightSB 0 SIDEJUT
local jut : JUT * df.mvs / STROKE + O local jut : JUT * df.mvs / STROKE + O
if (WIDTH * df.div > jut * 3.5) : begin if (df.width > jut * 7) : begin
include : tagged 'serifLT' include : tagged 'serifLT'
CenterTopSerif (df.leftSB + 0.5 * df.mvs * HVCONTRAST) top jut df.mvs CenterTopSerif (df.leftSB + 0.5 * df.mvs * HVCONTRAST) top jut df.mvs
include : tagged 'serifMT' include : tagged 'serifMT'

View file

@ -375,8 +375,11 @@ export : define [apply] : begin
local light : adviceBlackness 3.5 local light : adviceBlackness 3.5
local heavy : Math.max (light * 2) (WIDTH * 0.15) local heavy : Math.max (light * 2) (WIDTH * 0.15)
local midx : MosaicWidth / 2 local midx : MosaicWidth / 2
local topy top
local boty bottom # Add a little overshoot to the lines to make them join vertically
local verticalOvershoot 1.02
local topy : mix bottom top verticalOvershoot
local boty : mix top bottom verticalOvershoot
local midy : mix boty topy 0.5 local midy : mix boty topy 0.5
define [boxdraw unicode u d l r] : sketch define [boxdraw unicode u d l r] : sketch
@ -386,8 +389,8 @@ export : define [apply] : begin
local stopV : [Math.max l r] / 2 local stopV : [Math.max l r] / 2
if l : include : HBar 0 (midx + stopH) midy l if l : include : HBar 0 (midx + stopH) midy l
if r : include : HBar (midx - stopH) MosaicWidth midy r if r : include : HBar (midx - stopH) MosaicWidth midy r
if d : include : VBar midx bottom (midy + stopV) d if d : include : VBar midx boty (midy + stopV) d
if u : include : VBar midx (midy - stopV) top u if u : include : VBar midx (midy - stopV) topy u
save [BdGlyphName unicode] [MangleUnicode unicode] save [BdGlyphName unicode] [MangleUnicode unicode]
@ -405,11 +408,11 @@ export : define [apply] : begin
include : HBar (midx + stopH) MosaicWidth (midy + (r - light)) light include : HBar (midx + stopH) MosaicWidth (midy + (r - light)) light
if (r > light) : include : HBar (midx + stopH) MosaicWidth (midy - (r - light)) light if (r > light) : include : HBar (midx + stopH) MosaicWidth (midy - (r - light)) light
if d : begin if d : begin
include : VBar (midx + (d - light)) bottom (midy - stopV) light include : VBar (midx + (d - light)) boty (midy - stopV) light
if (d > light) : include : VBar (midx - (d - light)) bottom (midy - stopV) light if (d > light) : include : VBar (midx - (d - light)) boty (midy - stopV) light
if u : begin if u : begin
include : VBar (midx + (u - light)) (midy + stopV) top light include : VBar (midx + (u - light)) (midy + stopV) topy light
if (u > light) : include : VBar (midx - (u - light)) (midy + stopV) top light if (u > light) : include : VBar (midx - (u - light)) (midy + stopV) topy light
if (stopH > 0 && [not u]) : include : HBar (midx - stopH - light * HVCONTRAST) (midx + stopH + light * HVCONTRAST) (midy + capV) light if (stopH > 0 && [not u]) : include : HBar (midx - stopH - light * HVCONTRAST) (midx + stopH + light * HVCONTRAST) (midy + capV) light
if (stopH > 0 && [not d]) : include : HBar (midx - stopH - light * HVCONTRAST) (midx + stopH + light * HVCONTRAST) (midy - capV) light if (stopH > 0 && [not d]) : include : HBar (midx - stopH - light * HVCONTRAST) (midx + stopH + light * HVCONTRAST) (midy - capV) light
if (stopV > 0 && [not l]) : include : VBar (midx - capH) (midy - stopV - light) (midy + stopV + light) light if (stopV > 0 && [not l]) : include : VBar (midx - capH) (midy - stopV - light) (midy + stopV + light) light
@ -503,7 +506,11 @@ export : define [apply] : begin
define [vDashed unicode segments weight] : sketch define [vDashed unicode segments weight] : sketch
set-width MosaicWidth set-width MosaicWidth
include : ForceUpright include : ForceUpright
foreach j [range 0 segments] : include : VBar midx [mix [mix bottom top (j / segments)] [mix bottom top ((j + 1) / segments)] 0.2] [mix [mix bottom top (j / segments)] [mix bottom top ((j + 1) / segments)] 0.8] weight foreach j [range 0 segments] : include : VBar
begin midx
mix [mix boty topy (j / segments)] [mix boty topy ((j + 1) / segments)] 0.2
mix [mix boty topy (j / segments)] [mix boty topy ((j + 1) / segments)] 0.8
begin weight
save [BdGlyphName unicode] [MangleUnicode unicode] save [BdGlyphName unicode] [MangleUnicode unicode]
@ -575,8 +582,8 @@ export : define [apply] : begin
include : ForceUpright include : ForceUpright
include : dispiro include : dispiro
widths.center light widths.center light
flat MosaicWidth top flat MosaicWidth topy
curl 0 bottom curl 0 boty
save [BdGlyphName 0x2571] [MangleUnicode 0x2571] save [BdGlyphName 0x2571] [MangleUnicode 0x2571]
sketch # bd2572 sketch # bd2572
@ -584,8 +591,8 @@ export : define [apply] : begin
include : ForceUpright include : ForceUpright
include : dispiro include : dispiro
widths.center light widths.center light
flat 0 top flat 0 topy
curl MosaicWidth bottom curl MosaicWidth boty
save [BdGlyphName 0x2572] [MangleUnicode 0x2572] save [BdGlyphName 0x2572] [MangleUnicode 0x2572]
sketch # bd2573 sketch # bd2573

View file

@ -39,20 +39,43 @@ define weightToMenuStyleMap : object
700 "Bold" 700 "Bold"
800 "Extrabold" 800 "Extrabold"
900 "Heavy" 900 "Heavy"
define widthToMenuStyleMap : object
5 ""
7 "Extended"
define slantToMenuStyleMap : object define slantToMenuStyleMap : object
normal "" normal ""
italic "Italic" italic "Italic"
oblique "Oblique" oblique "Oblique"
define [getStyle weight slant] : [(weightToMenuStyleMap.(weight) + " " + slantToMenuStyleMap.(slant)).trim] || "Regular" define weightToMenuStyleMapShort : object
100 "Th"
200 "XLt"
300 "Lt"
400 ""
500 "Md"
600 "SmBd"
700 "Bd"
800 "XBd"
900 "Xv"
define widthToMenuStyleMapShort : object
5 ""
7 "Ex"
define slantToMenuStyleMapShort : object
normal ""
italic "It"
oblique "Obl"
define [getStyle weight width slant] : [[(weightToMenuStyleMap.(weight) + " " + widthToMenuStyleMap.(width) + " " + slantToMenuStyleMap.(slant)).replace [regex ' +' 'g'] ' '].trim] || "Regular"
define [getShortStyle weight width slant] : [(weightToMenuStyleMapShort.(weight) + " " + widthToMenuStyleMapShort.(width) + " " + slantToMenuStyleMapShort.(slant)).replace [regex ' ' 'g'] ''] || "Regular"
define [isRBIBI style] : style == 'Regular' || style == 'Bold' || style == 'Italic' || style == "Bold Italic"
export : define [assignFontNames para metrics font] : begin 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.slant define style : getStyle para.naming.weight para.menuWidth para.naming.slant
define version para.naming.version define version para.naming.version
define isItalic : para.naming.slant == "italic" define isItalic : para.naming.slant == "italic"
@ -66,14 +89,30 @@ 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
if (style == 'Regular' || style == 'Bold' || style == 'Italic' || style == "Bold Italic") : then
nameFont font FAMILY family # Family local compatFamily family
nameFont font STYLE style # Style local compatStyle style
: else
local compatFamilySuffix : style.replace [regex ' Italic$'] '' :.replace [regex ' Extra'] 'X' if [not : isRBIBI style] : begin
local compatStyle : if [[regex ' Italic$'].test style] 'Italic' 'Regular' if isItalic : begin
nameFont font FAMILY : family + ' ' + compatFamilySuffix set compatStyle slantToMenuStyleMap.italic
nameFont font STYLE compatStyle set compatFamily : family + ' ' + [getStyle para.naming.weight para.menuWidth 'normal']
: else : begin
set compatStyle 'Regular'
set compatFamily : family + ' ' + style
# Sometimes compatibility family will grow too large.
if (compatFamily.length >= 31) : begin
if isItalic : begin
set compatStyle slantToMenuStyleMap.italic
set compatFamily : family + ' ' + [getShortStyle para.naming.weight para.menuWidth 'normal']
: else : begin
local shortStyle : getShortStyle para.naming.weight para.menuWidth para.naming.slant
set compatStyle 'Regular'
set compatFamily : family + ' ' + shortStyle
nameFont font FAMILY compatFamily # Family
nameFont font STYLE compatStyle # Style
nameFont font UNIQUE_NAME "\(family) \(style) \(version)" # Unique Name nameFont font UNIQUE_NAME "\(family) \(style) \(version)" # Unique Name
@ -97,6 +136,7 @@ export : define [assignFontNames para metrics font] : begin
# Weight, width and slantness # Weight, width and slantness
set font.OS_2.usWeightClass para.naming.weight set font.OS_2.usWeightClass para.naming.weight
set font.OS_2.usWidthClass para.menuWidth
set font.OS_2.panose.2 : 1 + para.naming.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 isOblique oblique : not : not isOblique

View file

@ -72,6 +72,8 @@ lllcrowdedness = 3.33333333
spacing = 1 # Spacing indicator spacing = 1 # Spacing indicator
menuWidth = 5 # Menu width
# Powerline-specific parameters # Powerline-specific parameters
powerlineScaleY = 1 # Vertical scale powerlineScaleY = 1 # Vertical scale
powerlineScaleX = 1 # Horizontal scale powerlineScaleX = 1 # Horizontal scale
@ -244,11 +246,14 @@ spacing = 3
# NOTE: this section is highly experimental # NOTE: this section is highly experimental
# HANDLE WITH EXTREME CARE # HANDLE WITH EXTREME CARE
# Expanded : I heard someone want it being wider... # Expanded : I heard someone want it being wider...
[wd-expanded.multiplies] [wd-extended.multiplies]
width = 1.152 # 576mem for normal char width = 1.152 # 576mem for normal char
sb = 1.375 sb = 1.375
[expanded] [extended]
inherits = ['wd-expanded'] inherits = ['wd-extended']
[menu-name-extended]
menuWidth = 7
# Compressed : And someone else want it being narrower # Compressed : And someone else want it being narrower
[wd-compressed.multiplies] [wd-compressed.multiplies]