Add dollar/cent with slanted stroke. (#2408) (#2474)

* Use variants-buildup mechanism for dollar and cent variants

* Add Dollar/cent with slanted stroke (#2408)
This commit is contained in:
Belleve 2024-08-19 01:01:38 -10:00 committed by GitHub
parent 304183d434
commit 67f7a43014
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 204 additions and 130 deletions

View file

@ -1,6 +1,6 @@
$$include '../../meta/macros.ptl'
import [mix linreg clamp fallback] from "@iosevka/util"
import [mix linreg clamp fallback SuffixCfg] from "@iosevka/util"
import [DependentSelector MathSansSerif] from "@iosevka/glyph/relation"
glyph-module
@ -371,51 +371,61 @@ glyph-block Letter-Latin-C : begin
CShapeT spiro-outline 0.1 [DivFrame 1] SLAB-NONE SLAB-NONE XH 0 SmallArchDepthA SmallArchDepthB Hook BBS
VBar.l (SB + BBD + OX) 0 CAP BBS
define CentBarConfig : object
open { (Descender / 2) (XH - Descender / 2) 0 "std" }
through { (Descender / 2) (XH - Descender / 2) 1 "std" }
interrupted { (Descender / 2) (XH - Descender / 2) 2 "std" }
openCap { 0 CAP 0 "cap" }
throughCap { 0 CAP 1 "cap" }
interruptedCap { 0 CAP 2 "cap" }
define CentConfig : SuffixCfg.weave
object # slope
"" 0
"slanted" 0.08
object # body
open 0
through 1
interrupted 2
object # height
"" { 0 XH (Descender / 2) (XH - Descender / 2) "std" }
"cap" { (CAP / 2 - XH / 2) (CAP / 2 + XH / 2) 0 CAP "cap" }
foreach { suffix { sl fillType { bMask tMask bot top selector }}} [pairs-of CentConfig] : do
define [xBot df] : mix df.leftSB df.rightSB (0.5 - sl)
define [xTop df] : mix df.leftSB df.rightSB (0.5 + sl)
define swBarThick : AdviceStroke 3
define swBarFine : AdviceStroke [StrokeWidthBlend 3 5.5]
define [FullBar df sw] : dispiro
flat [xBot df] bot [widths.center.heading sw Downward]
curl [xTop df] top [widths.center.heading sw Downward]
define [InterruptBar df] : begin
local cofine : AdviceStroke 4
return : union
dispiro
flat [xTop df] top [widths.center.heading cofine Downward]
curl df.middle [mix top bot 0.5] [widths.center.heading swBarFine Downward]
dispiro
flat [xBot df] bot [widths.center.heading cofine Upward]
curl df.middle [mix bot top 0.5] [widths.center.heading swBarFine Upward]
define [OutlineMask df] : spiro-outline
curl (df.leftSB + 0.5 * Stroke) (post@ <-> SmallArchDepthA)
arch.rhs (sw -- Stroke) (tMask - 0.5 * Stroke)
flat (df.rightSB - 0.5 * Stroke) (pre@ <-> SmallArchDepthB)
curl pre@ (post@ <+> SmallArchDepthA)
arch.rhs (sw -- Stroke) (bMask + 0.5 * Stroke)
flat post@ (pre@ <+> SmallArchDepthB)
define [InterruptMask df] : begin
define gap : Math.max (XH / 8) [AdviceStroke2 6 6 XH]
return : HBar.m 0 df.width [mix bot top 0.5] gap
foreach { suffix { bot top fillType selector } } [Object.entries CentBarConfig] : do
create-glyph "cent/bar.\(suffix)" : glyph-proc
define w : AdviceStroke 3
define fine : AdviceStroke [StrokeWidthBlend 3 5.5]
local yMid : mix bot top 0.5
local fillBottom : yMid - XH / 2 + HalfStroke
local fillTop : yMid + XH / 2 - HalfStroke
set-base-anchor 'cvDecompose' Middle yMid
# Draw the outside subbars
include : dispiro
flat Middle fillTop [widths.center w]
curl Middle top [heading Upward]
include : dispiro
flat Middle fillBottom [widths.center w]
curl Middle bot [heading Downward]
include : match fillType
[Just 1] : VBar.m Middle fillBottom fillTop fine
[Just 2] : begin
define cofine : AdviceStroke 4
define gap : Math.max (XH / 8) [AdviceStroke2 6 6 XH]
union
dispiro
flat Middle fillTop [widths.center.heading cofine Downward]
curl Middle (yMid + gap / 2) [widths.center.heading fine Downward]
dispiro
flat Middle fillBottom [widths.center.heading cofine Upward]
curl Middle (yMid - gap / 2) [widths.center.heading fine Upward]
__ : no-shape
local df : include : DivFrame 1
set-base-anchor 'cvDecompose' df.middle [mix bot top 0.5]
DependentSelector.set currentGlyph selector
include : difference [FullBar df swBarThick] [OutlineMask df]
if (fillType === 1) : include : intersection [FullBar df swBarFine] [OutlineMask df]
if (fillType === 2) : include : intersection [InterruptBar df]
difference [OutlineMask df] [InterruptMask df]
select-variant 'cent/bar' (follow -- 'cent')
CreateDependentComposite 'cent/centSign' 0xA2 "cent/bar" : object

View file

@ -1,6 +1,6 @@
$$include '../../meta/macros.ptl'
import [mix linreg clamp fallback] from "@iosevka/util"
import [mix linreg clamp fallback SuffixCfg] from "@iosevka/util"
import [DependentSelector MathSansSerif] from "@iosevka/glyph/relation"
glyph-module
@ -461,53 +461,72 @@ glyph-block Letter-Latin-S : begin
.y ([if (sign < 0) 0.25 0.375] * sign * BBD * [Math.cos theta])
}
define DollarConfig : SuffixCfg.weave
object # slope
"" 0
"slanted" 0.08
object # body
open 0
through 1
interrupted 2
object # height
"" { 0.05 0.95 (Descender / 2) "std" }
"cap" { 0.12 0.88 0 "cap" }
foreach { suffix { sl fillType { kBot kTop overflow selector } } } [pairs-of DollarConfig] : do
define [xBot df] : mix df.leftSB df.rightSB (0.5 - sl)
define [xTop df] : mix df.leftSB df.rightSB (0.5 + sl)
define bot : CAP * kBot
define top : CAP * kTop
define DollarConfig : object
open { 0.95 0.05 (Descender / 2) 0 "std" }
through { 0.95 0.05 (Descender / 2) 1 "std" }
interrupted { 0.95 0.05 (Descender / 2) 2 "std" }
openCap { 0.88 0.12 0 0 "cap" }
throughCap { 0.88 0.12 0 1 "cap" }
interruptedCap { 0.88 0.12 0 2 "cap" }
define swBarThick : AdviceStroke 3
define swBarFine : AdviceStroke [StrokeWidthBlend 3 5.5]
define [FullBar df sw] : dispiro
flat [xBot df] (0 + overflow) [widths.center.heading sw Downward]
curl [xTop df] (CAP - overflow) [widths.center.heading sw Downward]
define [InterruptBar df] : begin
local cofine : AdviceStroke 4
return : union
dispiro
flat [xTop df] (CAP - overflow) [widths.center.heading cofine Downward]
curl df.middle [mix top bot 0.5] [widths.center.heading swBarFine Downward]
dispiro
flat [xBot df] (0 + overflow) [widths.center.heading cofine Upward]
curl df.middle [mix bot top 0.5] [widths.center.heading swBarFine Upward]
define [DollarMask df stroke] : begin
define archDepthA : AdviceSArchDepth (top - bot) (-1) stroke
define archDepthB : AdviceSArchDepth (top - bot) (+1) stroke
return : spiro-outline
curl (df.leftSB + 0.5 * stroke) (post@ <-> archDepthA)
arch.rhs (sw -- stroke) (top - 0.5 * stroke)
flat (df.rightSB - 0.5 * stroke) (pre@ <-> archDepthB)
curl pre@ (post@ <+> archDepthA)
arch.rhs (sw -- stroke) (bot + 0.5 * stroke)
flat post@ (pre@ <+> archDepthB)
define [InterruptMask df] : begin
local gap : (swBarThick / Stroke * EssUpper) + [Math.max ((top - bot) / 6) [AdviceStroke2 3 3 (top - bot)]]
local yMid : mix bot top 0.5
local yTermLeft : mix yMid (top - [AdviceSArchDepth (top - bot) (-1) swBarThick]) 0.5
local yTermRight : mix yMid (bot + [AdviceSArchDepth (top - bot) (-1) swBarThick]) 0.5
return : dispiro [corner 0 yTermLeft : widths.center gap] [corner Width yTermRight]
foreach { suffix { kTop kBot overflow fillType selector } } [Object.entries DollarConfig] : do
create-glyph "dollar/bar.\(suffix)" : glyph-proc
define top : CAP * kTop
define bot : CAP * kBot
define w : AdviceStroke 3
define fine : AdviceStroke [StrokeWidthBlend 3 5.5]
set-base-anchor 'cvDecompose' Middle (CAP / 2)
include : dispiro
widths.center w
flat Middle (top - HalfStroke)
curl Middle (CAP - overflow) [heading Upward]
include : dispiro
widths.center w
flat Middle overflow [heading Upward]
curl Middle (bot + HalfStroke)
if (fillType === 1) : include : VBar.m Middle (bot + HalfStroke) (top - HalfStroke) fine
if (fillType === 2) : begin
local cofine : AdviceStroke 4
local gap : (w / Stroke * EssUpper) + [Math.max ((top - bot) / 6) [AdviceStroke2 3 3 (top - bot)]]
local yMid : mix bot top 0.5
local yTermLeft : mix yMid (top - [AdviceSArchDepth (top - bot) (-1) w]) 0.5
local yTermRight : mix yMid (bot + [AdviceSArchDepth (top - bot) (-1) w]) 0.5
include : difference
union
dispiro
flat Middle (top - HalfStroke) [widths.center.heading cofine Downward]
curl Middle [mix bot top 0.5] [widths.center.heading fine Downward]
dispiro
flat Middle (bot + HalfStroke) [widths.center.heading cofine Upward]
curl Middle [mix bot top 0.5] [widths.center.heading fine Upward]
dispiro [corner 0 yTermLeft : widths.center gap] [corner Width yTermRight]
local df : include : DivFrame 1
set-base-anchor 'cvDecompose' df.middle (CAP / 2)
DependentSelector.set currentGlyph selector
local [outlineMask] : DollarMask df [AdviceStroke2 2 3 CAP]
include : difference [FullBar df swBarThick] [outlineMask]
if (fillType === 1) : include : intersection [FullBar df swBarFine] [outlineMask]
if (fillType === 2) : include : intersection [InterruptBar df]
difference [outlineMask] [InterruptMask df]
select-variant 'dollar/bar' (follow -- 'dollar')
CreateDependentComposite 'dollar' '$' "dollar/bar" : object

View file

@ -7713,8 +7713,8 @@ selector.punctuationDot = "square"
[prime.braille-dot]
sampler = "⠭⠽ "
hotChars = "⠭⠽"
sampler = "⣝⣑ "
hotChars = "⣝⣑"
samplerExplain = "Dot shape in braille"
tagKind = "dot"
@ -8125,71 +8125,114 @@ selectorAffix.at = "tall"
sampler = "$"
tagKind = "symbol"
[prime.dollar.variants.open]
[prime.dollar.variants-buildup]
entry = "height"
descriptionLeader = "Dollar symbol (`$`)"
[prime.dollar.variants-buildup.stages.height."*"]
next = "shape"
[prime.dollar.variants-buildup.stages.height.normal]
rank = 1
description = "Dollar symbol with open contour"
selector.dollar = "open"
keyAffix = ""
descriptionAffix = "normal height"
selectorAffix.dollar = ""
[prime.dollar.variants.through]
[prime.dollar.variants-buildup.stages.height.cap]
rank = 2
description = "Dollar symbol with strike-through vertical bar"
selector.dollar = "through"
descriptionAffix = "cap height"
selectorAffix.dollar = "cap"
[prime.dollar.variants.interrupted]
[prime.dollar.variants-buildup.stages.shape."*"]
next = "bar-slope"
mode = "prepend"
[prime.dollar.variants-buildup.stages.shape.open]
rank = 1
descriptionAffix = "open contour"
selectorAffix.dollar = "open"
[prime.dollar.variants-buildup.stages.shape.through]
rank = 2
descriptionAffix = "strike-through vertical bar"
selectorAffix.dollar = "through"
[prime.dollar.variants-buildup.stages.shape.interrupted]
rank = 3
description = "Dollar symbol with interrupted strike-through vertical bar"
selector.dollar = "interrupted"
descriptionAffix = "interrupted strike-through vertical bar"
selectorAffix.dollar = "interrupted"
[prime.dollar.variants.open-cap]
rank = 4
description = "Dollar symbol with open contour, sized not exceeding baseline and ascender"
selector.dollar = "openCap"
[prime.dollar.variants-buildup.stages.bar-slope."*"]
mode = "prepend"
[prime.dollar.variants.through-cap]
rank = 5
description = "Dollar symbol with strike-through vertical bar, sized not exceeding baseline and ascender"
selector.dollar = "throughCap"
[prime.dollar.variants.interrupted-cap]
rank = 6
description = "Dollar symbol with interrupted strike-through vertical bar, sized not exceeding baseline and ascender"
selector.dollar = "interruptedCap"
[prime.dollar.variants-buildup.stages.bar-slope.vertical]
rank = 1
keyAffix = ""
descriptionAffix = "vertical bar"
selectorAffix.dollar = ""
[prime.dollar.variants-buildup.stages.bar-slope.slanted]
rank = 2
nonBreakingVariantAdditionPriority = 100
descriptionAffix = "slanted bar"
selectorAffix.dollar = "slanted"
[prime.cent]
sampler = "¢"
tagKind = "symbol"
[prime.cent.variants.open]
[prime.cent.variants-buildup]
entry = "height"
descriptionLeader = "Cent sign (`¢`)"
[prime.cent.variants-buildup.stages.height."*"]
next = "shape"
[prime.cent.variants-buildup.stages.height.normal]
rank = 1
description = "Cent sign (`¢`) with open contour"
selector.cent = "open"
keyAffix = ""
descriptionAffix = "normal height"
selectorAffix.cent = ""
[prime.cent.variants.through]
[prime.cent.variants-buildup.stages.height.cap]
rank = 2
description = "Cent sign (`¢`) with vertical bar all through the `c` part"
selector.cent = "through"
descriptionAffix = "cap height"
selectorAffix.cent = "cap"
[prime.cent.variants.bar-interrupted]
[prime.cent.variants-buildup.stages.shape."*"]
mode = "prepend"
next = "bar-slope"
[prime.cent.variants-buildup.stages.shape.open]
rank = 1
descriptionAffix = "open contour"
selectorAffix.cent = "open"
[prime.cent.variants-buildup.stages.shape.through]
rank = 2
descriptionAffix = "vertical bar all through the `c` part"
selectorAffix.cent = "through"
[prime.cent.variants-buildup.stages.shape.bar-interrupted]
rank = 3
description = "Cent sign (`¢`) with vertical bar breaks at center"
selector.cent = "interrupted"
descriptionAffix = "vertical bar breaks at center"
selectorAffix.cent = "interrupted"
[prime.cent.variants.open-cap]
rank = 4
description = "Cent sign (`¢`) with open contour, sized not exceeding baseline and ascender"
selector.cent = "openCap"
[prime.cent.variants-buildup.stages.bar-slope."*"]
mode = "prepend"
[prime.cent.variants.through-cap]
rank = 5
description = "Cent sign (`¢`) with vertical bar all through the `c` part, sized not exceeding baseline and ascender"
selector.cent = "throughCap"
[prime.cent.variants-buildup.stages.bar-slope.vertical]
rank = 1
keyAffix = ""
descriptionAffix = "vertical bar"
selectorAffix.cent = ""
[prime.cent.variants.bar-interrupted-cap]
rank = 6
description = "Cent sign (`¢`) with vertical bar breaks at center, sized not exceeding baseline and ascender"
selector.cent = "interruptedCap"
[prime.cent.variants-buildup.stages.bar-slope.slanted]
rank = 2
nonBreakingVariantAdditionPriority = 100
descriptionAffix = "slanted bar"
selectorAffix.cent = "slanted"
@ -9097,7 +9140,8 @@ brace = "straight"
guillemet = "straight"
number-sign = "slanted"
at = "fourfold"
cent = "through-cap"
dollar = "slanted-through"
cent = "slanted-through-cap"
percent = "rings-continuous-slash"
question = "corner-flat-hooked"
micro-sign = "tailed-serifless"
@ -9857,6 +9901,7 @@ underscore = "low"
guillemet = "straight"
at = "threefold"
dollar = "through-cap"
cent = "slanted-through"
percent = "rings-continuous-slash"
pilcrow = "low"
micro-sign = "toothless-rounded-serifless"