11$$include '../meta/macros.ptl'
22
33import [mix linreg clamp fallback] from "@iosevka/util"
4+ import [Box] from "@iosevka/geometry/box"
45
56glyph-module
67
@@ -9,32 +10,35 @@ glyph-block Digits-Eight : begin
910 glyph-block-import Common-Derivatives
1011 glyph-block-import Digits-Shared : CodeLnum CodeOnum
1112 glyph-block-import Letter-Blackboard : BBS BBD
13+ glyph-block-import Letter-Latin-S : AdviceSArchDepth
1214
1315 local EightPr : StrokeWidthBlend 0.85 0.925
14- define [EightShape top] : begin
15- local stroke : AdviceStroke2 2 3 CAP
16- local p 0.96
17- local l (SB + OX)
18- local r (RightSB - OX)
19- return : dispiro
20- widths.rhs stroke
21- arch.rhs.centerAt.ltr.t Middle top (sw -- stroke)
16+ define [EightShape sw box p archDepthFactor _gizmo] : glyph-proc
17+ local archDepth : (box.height / CAP) * ArchDepth * EightPr * archDepthFactor
18+ local archDepthRefWidth : box.width + 2 * OX + 2 * SB
19+ local adaTop : ArchDepthAOf (archDepth * p) archDepthRefWidth
20+ local adbTop : ArchDepthBOf (archDepth * p) archDepthRefWidth
21+ local adaBot : ArchDepthAOf archDepth archDepthRefWidth
22+ local adbBot : ArchDepthBOf archDepth archDepthRefWidth
23+ include : dispiro
24+ arch.rhs.centerAt.rtl.b box.xMid box.bot (sw -- sw)
2225 archv
23- g4 [mix l r p] (top - [ArchDepthBOf (ArchDepth * EightPr * p) Width])
24- alsoThru.g2 0.5 0.5 [widths.center stroke ]
25- g4 (l) [ArchDepthBOf (ArchDepth * EightPr) Width] [widths.lhs stroke ]
26+ g4 box.left (box.bot + adbBot) [widths.rhs sw]
27+ alsoThru.g2 0.5 0.5 [widths.center sw ]
28+ g4 [box.xp p] (box.top - adbTop) [widths.lhs sw ]
2629 arcvh
27- arch.lhs.centerAt.ltr.b Middle 0 (sw -- stroke )
30+ arch.lhs.centerAt.rtl.t box.xMid box.top (sw -- sw )
2831 archv
29- g4 (r) [ArchDepthAOf (ArchDepth * EightPr) Width] [widths.lhs stroke ]
30- alsoThru.g2 0.5 0.5 [widths.center stroke ]
31- g4 [mix r l p] (top - [ArchDepthAOf (ArchDepth * EightPr * p) Width]) [widths.rhs stroke ]
32+ g4 [box.xp (1 - p)] (box.top - adaTop) [widths.lhs sw ]
33+ alsoThru.g2 0.5 0.5 [widths.center sw ]
34+ g4 box.right (box.bot + adaBot) [widths.rhs sw ]
3235 arcvh
3336 close
3437
3538 create-glyph 'eight.lnum.crossing' : glyph-proc
3639 include : MarkSet.capital
37- include : EightShape CAP
40+ local box : new Box CAP 0 (SB + OX) (RightSB - OX)
41+ include : EightShape [AdviceStroke2 2 3 CAP] box 0.96 1
3842
3943 define [EightCirclesShape stroke top] : begin
4044 local pShrink 1.00
@@ -137,25 +141,77 @@ glyph-block Digits-Eight : begin
137141 select-variant 'eight.lnum' [CodeLnum '8'] (follow -- 'eight')
138142 alias 'eight.onum' [CodeOnum '8'] 'eight.lnum'
139143
144+ define [PropToShape sw box p archDepthFactor _gizmo] : glyph-proc
145+ local py 0.42
146+ local archDepth : (box.height / CAP) * ArchDepth * EightPr * archDepthFactor
147+ local archDepthRefWidth : box.width + 2 * OX + 2 * SB
148+ local adaTop : ArchDepthAOf (archDepth * p) archDepthRefWidth
149+ local adbTop : ArchDepthBOf (archDepth * p) archDepthRefWidth
150+ include : dispiro
151+ straight.up.start box.left box.bot [widths.rhs.heading sw Upward]
152+ alsoThru.g2 0.5 (1 - py) [widths.center sw]
153+ g4 [box.xp p] (box.top - adbTop) [widths.lhs sw]
154+ arcvh
155+ arch.lhs.centerAt.rtl.t box.xMid box.top (sw -- sw) # [widths.lhs sw]
156+ archv
157+ g4 [box.xp (1 - p)] (box.top - adaTop) [widths.lhs sw]
158+ alsoThru.g2 0.5 py [widths.center sw]
159+ straight.down.end box.right box.bot [widths.rhs.heading sw Downward]
140160
141- # There is an "eight without lower contour" shape used for /propto
142- create-glyph 'rotatedPropto' : glyph-proc # rotatedPropto
143- local p 0.96
144- local py 0.4
145- local l (SB + OX)
146- local r (RightSB - OX)
161+ define [InvLazySShape sw box p archDepthFactor _gizmo] : glyph-proc
162+ local archDepth : AdviceSArchDepth box.height (+1) sw
163+ # (box.height / CAP) * ArchDepth * EightPr * archDepthFactor
164+ local archDepthRefWidth : box.width + 2 * OX + 2 * SB
165+ local adaTop : ArchDepthAOf (archDepth * p) archDepthRefWidth
166+ local adbTop : ArchDepthBOf (archDepth * p) archDepthRefWidth
167+ local adaBot : ArchDepthAOf archDepth archDepthRefWidth
168+ local adbBot : ArchDepthBOf archDepth archDepthRefWidth
147169 include : dispiro
148- widths.lhs
149- straight.up.start r 0 [heading Upward]
150- alsoThru 0.5 (1 - py) [widths (Stroke * py) (Stroke * (1 - py))]
151- g4 [mix r l p] (CAP - ArchDepthA * p * EightPr) [widths.rhs]
170+ g4.down.start box.right (box.bot + adaBot) [widths.rhs.heading sw Downward]
152171 arcvh
153- g4 [ arch.adjust-x.top Middle] (CAP - O )
172+ arch.rhs.centerAt.rtl.b box.xMid box.bot (sw -- sw )
154173 archv
155- g4 [mix l r p] (CAP - ArchDepthB * p * EightPr)
156- alsoThru 0.5 py [widths (Stroke * py) (Stroke * (1 - py))]
157- straight.down.end l 0 [widths.heading Stroke 0 Downward]
174+ g4 box.left (box.bot + adbBot) [widths.rhs sw]
175+ alsoThru.g2 0.5 0.5 [widths.center sw]
176+ g4 [box.xp p] (box.top - adbTop) [widths.lhs sw]
177+ arcvh
178+ arch.lhs.centerAt.rtl.t box.xMid box.top (sw -- sw)
179+ archv
180+ g4.down.end [box.xp (1 - p)] (box.top - adaTop) [widths.lhs.heading sw Downward]
181+
182+ for-width-kinds WideWidth1 : do
183+ define xSF : 1 / [Math.pow (2 / MosaicWidthScalar) 0.6]
184+ define xSS : 1 / [Math.pow (2 / MosaicWidthScalar) 0.3]
185+ define xl : mix (MosaicWidth / 2) (MosaicWidthScalar * SB) (1 / xSF)
186+ define xr : mix (MosaicWidth / 2) (MosaicWidth - MosaicWidthScalar * SB) (1 / xSF)
187+ define yt : mix SymbolMid OperTop 0.75
188+ define yb : mix SymbolMid OperBot 0.75
189+ create-glyph [MangleName 'infty'] [MangleUnicode 0x221E] : glyph-proc
190+ set-width MosaicWidth
191+ include : PointingTo xr yt xr yb : function [] : glyph-proc
192+ set currentGlyph.gizmo : Italify para.slopeAngle
193+ local box : new Box (xr - xl) 0 0 (yt - yb)
194+ include : EightShape (OperatorStroke / xSS) box 1 0.9
195+ include : Italify (-para.slopeAngle)
196+ include : ScaleAround (MosaicUnitWidth / 2) SymbolMid xSF xSF
197+
198+ create-glyph [MangleName 'propto'] [MangleUnicode 0x221D] : glyph-proc
199+ set-width MosaicWidth
200+ include : PointingTo xr yt xr yb : function [] : glyph-proc
201+ set currentGlyph.gizmo : Italify para.slopeAngle
202+ local box : new Box (xr - xl) 0 0 (yt - yb)
203+ include : PropToShape (OperatorStroke / xSS) box 1 0.9
204+ include : Italify (-para.slopeAngle)
205+ include : ScaleAround (MosaicUnitWidth / 2) SymbolMid xSF xSF
158206
207+ create-glyph [MangleName 'invLazyS'] [MangleUnicode 0x223E] : glyph-proc
208+ set-width MosaicWidth
209+ include : PointingTo xr yt xr yb : function [] : glyph-proc
210+ set currentGlyph.gizmo : Italify para.slopeAngle
211+ local box : new Box (xr - xl) 0 0 (yt - yb)
212+ include : InvLazySShape (OperatorStroke / xSS) box 1 0.9
213+ include : Italify (-para.slopeAngle)
214+ include : ScaleAround (MosaicUnitWidth / 2) SymbolMid xSF xSF
159215
160216 define [BBEightSd] : with-params [top swStart swEnd kTop sign OffsetLT OffsetRB OffsetC] : begin
161217 define stroke : Math.max swStart swEnd
0 commit comments