-
Notifications
You must be signed in to change notification settings - Fork 561
/
v.ptl
226 lines (199 loc) · 8.87 KB
/
v.ptl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
$$include '../../../meta/macros.ptl'
import [mix linreg clamp fallback] from '../../../support/utils'
import [Dotless CvDecompose MathSansSerif] from "../../../support/gr"
glyph-module
glyph-block Letter-Latin-V : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-export VShape VShapeOutline
glyph-block-import Letter-Shared-Shapes : DiagonalTailInnerRadius SerifFrame
glyph-block-import Letter-Blackboard : BBS BBD
define VCornerHalfWidth : HalfStroke * HVContrast * 1.15
define VCurviness 0.3
define VShapeFine : Math.max
Stroke * [if SLAB para.vtipfineSlab para.vtipfine]
VCornerHalfWidth * 1.2
define VShapeFineStraight : Stroke * CThin * 1.15
define pInktrap : 2 / 3
define VShapeMiddleWidth : Math.min [mix Stroke VShapeFineStraight pInktrap] [AdviceStroke 3]
define StraightSbShrink : mix 1 (DesignParameters.straightVShapeSbShrink * [StrokeWidthBlend 1 0.75]) : if SLAB 0.75 1
define [VShapeTopFlat top] : if SLAB [Math.min (top - Stroke) (top * 0.9)] (top * 0.9)
define [VShapeOutline] : params [df top [sw Stroke] barStraight] : glyph-proc
define fine : [if barStraight VShapeFineStraight VShapeFine] * sw / Stroke
define cornerHW : VCornerHalfWidth * sw / Stroke
define dgCor : DiagCor top (Width / 2) 0 (sw * 2)
define clearance : 0 - OX
if barStraight : do
define vxStartL : df.leftSB * StraightSbShrink + clearance
define vxEndL : df.middle - cornerHW + clearance
define vxStartR : df.width - df.leftSB * StraightSbShrink - clearance
define vxEndR : df.middle + cornerHW - clearance
include : spiro-outline
flat [mix vxStartL vxEndL 0] [mix top 0 0]
curl [mix vxStartL vxEndL pInktrap] [mix top 0 pInktrap]
corner [mix vxStartL vxEndL 1] [mix top 0 1]
corner [mix vxStartR vxEndR 1] [mix top 0 1]
flat [mix vxStartR vxEndR pInktrap] [mix top 0 pInktrap]
curl [mix vxStartR vxEndR 0] [mix top 0 0]
: else : do
define vxStartL : df.leftSB + clearance
define vxEndL : df.middle - cornerHW + clearance
define vxStartR : df.width - df.leftSB - clearance
define vxEndR : df.middle + cornerHW - clearance
include : spiro-outline
flat vxStartL top
curl vxStartL [VShapeTopFlat top]
quadControls 0 VCurviness 9 unimportant
corner vxEndL 0
corner vxEndR 0
quadControls 1 (1 - VCurviness) 9 unimportant
flat vxStartR [VShapeTopFlat top]
curl vxStartR top
define [VBottomCapShape df barStraight sw] : begin
define cornerHW : VCornerHalfWidth * sw / Stroke
return : spiro-outline
corner (df.middle + cornerHW) 0
corner (df.middle - cornerHW) 0
corner df.middle [Math.min sw : if barStraight VShapeFineStraight VShapeFine]
define [VShape] : params [df top [sw Stroke] barStraight] : glyph-proc
define cornerHW : VCornerHalfWidth * sw / Stroke
define fine : Math.min sw : if barStraight VShapeFineStraight VShapeFine
define dgCor : DiagCor (2 * top) Width 0 (2 * sw)
if barStraight : do
define vxStartL : df.leftSB * StraightSbShrink
define vxEndL : df.middle - cornerHW
define vxStartR : df.width - df.leftSB * StraightSbShrink
define vxEndR : df.middle + cornerHW
define midSW : dgCor * VShapeMiddleWidth / Stroke * sw
include : tagged 'strokeDown' : dispiro
widths.lhs (sw * dgCor)
flat [mix vxStartL vxEndL 0] [mix top 0 0] [heading Downward]
curl [mix vxStartL vxEndL pInktrap] [mix top 0 pInktrap] [widths.lhs.heading midSW Downward]
g4 [mix vxStartL vxEndL 1] [mix top 0 1] [widths.lhs.heading fine Downward]
include : tagged 'strokeUp' : dispiro
widths.rhs (sw * dgCor)
flat [mix vxStartR vxEndR 0] [mix top 0 0] [heading Downward]
curl [mix vxStartR vxEndR pInktrap] [mix top 0 pInktrap] [widths.rhs.heading midSW Downward]
g4 [mix vxStartR vxEndR 1] [mix top 0 1] [widths.rhs.heading fine Downward]
: else : do
include : tagged 'strokeDown' : dispiro
widths.lhs sw
flat df.leftSB top [heading Downward]
curl df.leftSB [VShapeTopFlat top] [heading Downward]
quadControls 0 VCurviness 9 unimportant
g4 (df.middle - cornerHW) 0 [widths.lhs fine]
include : tagged 'strokeUp' : dispiro
widths.rhs sw
flat df.rightSB top [heading Downward]
curl df.rightSB [VShapeTopFlat top] [heading Downward]
quadControls 0 VCurviness 9 unimportant
g4 (df.middle + cornerHW) 0 [widths.rhs fine]
#bottom cap
include : VBottomCapShape df barStraight sw
define [VCursiveShapeBarPos k] : mix SB RightSB k
define [VCursiveShape] : params [k top [sw Stroke]] : glyph-proc
define xBar : VCursiveShapeBarPos k
define xArcRight : RightSB - OX
define yArcRight : [mix 0 top 0.6] - sw * 0.2
define xArcEnd : [mix SB RightSB 0.8] + sw * 0.375
define yArcEnd : top - O
define rInY : DiagonalTailInnerRadius
include : dispiro
widths.lhs sw
flat xBar top [heading Downward]
curl xBar ((sw + rInY) * (1 + TanSlope))
arcvh
g2.right.mid (xBar + sw * HVContrast + rInY * HVContrast + TanSlope * sw) O
archv.superness 2
g4 xArcRight yArcRight
g4 xArcEnd yArcEnd
define [VHooktopShape df barStraight top] : glyph-proc
include : VShape df top Stroke barStraight
eject-contour 'strokeUp'
include : VBottomCapShape df barStraight Stroke
include : dispiro
widths.rhs
straight.left.start (RightSB + HookX / 3) (top - Stroke)
g4 (RightSB - HookX / 3) (top - HalfStroke - Hook)
quadControls 0.4 0.75 64 unimportant
g4 (Middle + VCornerHalfWidth) 0 [widths.rhs VShapeFine]
define [VSerifs top] : let [sf : SerifFrame top 0 SB RightSB] : begin
NeedSlab SLAB : composite-proc sf.lt.full sf.rt.full
define [VMotionSerifs top] : let [sf : SerifFrame top 0 SB RightSB] : begin
composite-proc sf.lt.outer
define VStandardConfig : object
straight { VSerifs true }
curly { VSerifs false }
straightMotionSerifed { VMotionSerifs true }
curlyMotionSerifed { VMotionSerifs false }
foreach { suffix { Serifs fStraightBar }} [Object.entries VStandardConfig] : do
create-glyph "V.\(suffix)" : glyph-proc
include : MarkSet.capital
include : VShape [DivFrame 1] CAP Stroke fStraightBar
include : Serifs CAP
create-glyph "v.\(suffix)" : glyph-proc
include : MarkSet.e
include : VShape [DivFrame 1] XH Stroke fStraightBar
include : Serifs XH
create-glyph "VHookTop.\(suffix)" : glyph-proc
include : MarkSet.capital
include : VHooktopShape [DivFrame 1] fStraightBar CAP
include : Serifs CAP
eject-contour 'serifRT'
create-glyph "vHookTop.\(suffix)" : glyph-proc
include : MarkSet.e
include : VHooktopShape [DivFrame 1] fStraightBar XH
include : Serifs XH
eject-contour 'serifRT'
create-glyph 'v.cursive' : glyph-proc
include : MarkSet.e
include : VCursiveShape 0 XH Stroke
create-glyph 'v.cursiveMotionSerifed' : glyph-proc
local pxBar : 1 / 16
include : MarkSet.e
include : VCursiveShape pxBar XH Stroke
include : tagged 'serifLT' : LeftwardTopSerif [VCursiveShapeBarPos pxBar] XH (SideJut + [VCursiveShapeBarPos pxBar] - SB)
select-variant 'V' 'V'
link-reduced-variant 'V/sansSerif' 'V' MathSansSerif
select-variant 'v' 'v'
link-reduced-variant 'v/sansSerif' 'v' MathSansSerif
select-variant 'smcpV' 0x1D20 (shapeFrom -- 'v') (follow -- 'V')
select-variant 'vHookTop' 0x2C71 (follow -- 'vHookTop')
select-variant 'cyrl/Izhitsa' 0x474 (follow -- 'VHookTop') (shapeFrom -- 'VHookTop')
alias 'cyrl/izhitsa' 0x475 'vHookTop'
turned 'turnv.straight' nothing 'v.straight' Middle (XH / 2)
turned 'turnv.curly' nothing 'v.curly' Middle (XH / 2)
select-variant 'turnv' 0x28C (follow -- 'grek/Lambda')
glyph-block-export BBVShape BBVInnerMaskShape BBVOuterMaskShape
define [BBVShape l r kd ks top] : glyph-proc
local m : mix l r 0.5
local bbd : BBD * kd
local bbs : BBS * ks
local kDiag : DiagCorDs top ((r - l) / 2) (bbd / 2)
include : intersection
Rect top 0 (-Width) (2 * Width)
union
ExtLineCenter 1 bbs l top (m - kDiag * bbd / 2) 0
ExtLineCenter 1 bbs (l + kDiag * bbd) top (m + kDiag * bbd / 2) 0
ExtLineCenter 1 bbs r top (m + kDiag * bbd / 2) 0
include : HBarTop l (l + kDiag * bbd) top bbs
include : HBarBottom (m - kDiag * bbd / 2) (m + kDiag * bbd / 2) 0 bbs
define [BBVInnerMaskShape l r kd ks top] : glyph-proc
local m : mix l r 0.5
local bbd : BBD * kd
local kDiag : DiagCorDs top ((r - l) / 2) (bbd / 2)
include : spiro-outline
corner (l + kDiag * bbd) top
corner r top
corner (m + kDiag * bbd / 2) 0
define [BBVOuterMaskShape l r kd ks top] : glyph-proc
local m : mix l r 0.5
local bbd : BBD * kd
local kDiag : DiagCorDs top ((r - l) / 2) (bbd / 2)
include : spiro-outline
corner l top
corner r top
corner (m + kDiag * bbd / 2) 0
corner (m - kDiag * bbd / 2) 0
create-glyph 'mathbb/V' 0x1D54D : composite-proc [MarkSet.capital] [BBVShape SB RightSB 1 1 CAP]
create-glyph 'mathbb/v' 0x1D567 : composite-proc [MarkSet.e] [BBVShape SB RightSB 1 1 XH]