-
Notifications
You must be signed in to change notification settings - Fork 561
/
lower-m.ptl
308 lines (277 loc) · 13 KB
/
lower-m.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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
$$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-Lower-M : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Letter-Shared-Shapes : RightwardTailedBar DToothlessRise DMBlend
glyph-block-import Letter-Shared-Shapes : nShoulder nShoulderMask CyrDescender
define [SmallMSmooth df] : df.div * (0.5 * SmallSmooth + 0.375 * Stroke)
define [SmallMShoulderSpiro] : params [left right top bottom width fine df coBottom] : glyph-proc
local fix : TanSlope * Stroke * HVContrast * width / Stroke
local sm : [SmallMSmooth df] + fix / 2
include : spiro-outline
corner (right - width * HVContrast) [Math.min (top - sm - 0.1) bottom]
curl (right - width * HVContrast) (top - sm + fix)
arcvh 8
g2 [mix left (right - width * HVContrast) 0.5] (top - O - width)
archv 8
flat left (top - sm - fix)
corner left (top - sm - fix - 1)
if (coBottom != nothing)
list [corner left coBottom] [corner (left - fine) coBottom]
list
corner (left - fine) (top - sm - 1)
curl (left - fine) (top - sm)
arcvh 8
g2 [mix (left - fine * HVContrast) right 0.5] (top - O)
archv 8
flat right (top - sm)
corner right [Math.min (top - sm - 0.1) bottom]
close
define [RevSmallMShoulderSpiro] : params [left right top bottom width fine df coBottom] : glyph-proc
local fix : TanSlope * Stroke * HVContrast * width / Stroke
local sm : [SmallMSmooth df] - fix / 2
include : spiro-outline
corner (left + width * HVContrast) [Math.min (top - sm - 0.1) bottom]
curl (left + width * HVContrast) (top - sm - fix)
arcvh 8
g2 [mix right (left + width * HVContrast) 0.5] (top - O - width)
archv 8
flat right (top - sm - fix)
corner right (top - sm - fix - 1)
if (coBottom != nothing)
list [corner right coBottom] [corner (right + fine) coBottom]
list
corner (right + fine) (top - sm - 1)
curl (right + fine) (top - sm)
arcvh 8
g2 [mix (right + fine * HVContrast) left 0.5] (top - O)
archv 8
flat left (top - sm)
corner left [Math.min (top - sm - 0.1) bottom]
close
define [SmallMTopLeftSerif df top lbot] : glyph-proc
if (df.width > para.refJut * 7) : begin
include : tagged 'serifLT' : intersection
CenterTopSerif (df.leftSB + 0.5 * df.mvs * HVContrast) top Jut df.mvs
Rect top lbot 0 (df.leftSB - O)
: else : begin
include : tagged 'serifLT' : LeftwardTopSerif df.leftSB top SideJut df.mvs
define [SmallMBottomLeftSerif df top lbot] : glyph-proc
if (df.width > para.refJut * 7) : begin
include : tagged 'serifLB' : begin
CenterBottomSerif (df.leftSB + 0.5 * df.mvs * HVContrast) lbot Jut df.mvs
: else : begin
include : tagged 'serifLB' : begin
LeftwardBottomSerif df.leftSB lbot SideJut df.mvs
define [SmallMBottomMiddleSerif df top mbot] : glyph-proc
if (df.width > para.refJut * 7) : begin
include : tagged 'serifMB' : begin
CenterBottomSerif df.middle mbot Jut df.mvs
define [SmallMBottomRightSerif df top rbot] : glyph-proc
if (df.width > para.refJut * 7) : begin
if para.isItalic : begin
include : tagged 'serifRB' : intersection
CenterBottomSerif (df.rightSB - 0.5 * df.mvs * HVContrast) rbot Jut df.mvs
Rect top rbot (df.rightSB + O) df.width
: else : begin
include : tagged 'serifRB' : begin
CenterBottomSerif (df.rightSB - 0.5 * df.mvs * HVContrast) rbot Jut df.mvs
: else : begin
include : tagged 'serifRB' : RightwardBottomSerif df.rightSB rbot SideJut df.mvs
define [SmallMBottomMotionRightSerif df top rbot] : glyph-proc
include : tagged 'serifRB' : RightwardBottomSerif df.rightSB rbot SideJut df.mvs
define [AutoSerifs df top lbot mbot rbot tailed earless] : glyph-proc
if SLAB : begin
if [not earless] : include : SmallMTopLeftSerif df top lbot
if [not para.isItalic] : include : SmallMBottomLeftSerif df top lbot
if [not para.isItalic] : include : SmallMBottomMiddleSerif df top mbot
if [not tailed] : include : SmallMBottomRightSerif df top rbot
define [LtSerifs df top lbot mbot rbot tailed earless] : glyph-proc
include : SmallMTopLeftSerif df top lbot
define [LtRbSerifs df top lbot mbot rbot tailed earless] : glyph-proc
include : SmallMTopLeftSerif df top lbot
include : SmallMBottomMotionRightSerif df top rbot
define [dfM] : DivFrame para.diversityM 3
define [SmallMArches top lbot mbot rbot df] : glyph-proc
include : SmallMShoulderSpiro
df -- df
left -- (df.leftSB + df.mvs * HVContrast)
right -- (df.middle + df.mvs / 2 * HVContrast)
top -- top
bottom -- mbot
width -- df.mvs
fine -- (df.mvs * ShoulderFine / Stroke)
include : SmallMShoulderSpiro
df -- df
left -- (df.middle + df.mvs * 0.5 * HVContrast)
right -- df.rightSB
top -- top
bottom -- rbot
width -- df.mvs
fine -- (df.mvs * ShoulderFine / Stroke)
include : tagged 'barL' : VBarLeft df.leftSB lbot top df.mvs
glyph-block-export SmallMSmoothHeight
define [SmallMShortLegHeight df] : (XH - df.mvs) * 0.45
define [SmallMSmoothHeight df] : XH - [SmallMSmooth df] - TanSlope * Stroke
define [EarlessCornerDoubleArchSmallMShape top lbot mbot rbot df] : glyph-proc
include : dispiro
widths.rhs df.mvs
g4 df.leftSB (top - DToothlessRise)
g4.right.mid [mix df.leftSB (df.middle + df.mvs / 2 * HVContrast) 0.5] (top - O) [heading Rightward]
g4 (df.middle + df.mvs / 2 * HVContrast) (top - DToothlessRise)
include : dispiro
widths.rhs df.mvs
g4 (df.middle - df.mvs / 2 * HVContrast) (top - DToothlessRise)
g4.right.mid [mix df.rightSB (df.middle - df.mvs / 2 * HVContrast) 0.5] (top - O) [heading Rightward]
archv
flat df.rightSB (top - [SmallMSmooth df]) [heading Downward]
curl df.rightSB rbot [heading Downward]
include : tagged 'barL' : VBarLeft df.leftSB lbot (top - DToothlessRise) df.mvs
include : tagged 'barM' : VBar df.middle mbot (top - DToothlessRise) df.mvs
define [EarlessRoundedDoubleArchSmallMShape top lbot mbot rbot df] : glyph-proc
include : union
RevSmallMShoulderSpiro
df -- df
left -- df.leftSB
right -- (df.middle - df.mvs / 2 * HVContrast)
top -- top
bottom -- lbot
coBottom -- mbot
width -- df.mvs
fine -- (df.mvs * CThin)
SmallMShoulderSpiro
df -- df
left -- (df.middle + df.mvs * 0.5 * HVContrast)
right -- df.rightSB
top -- top
bottom -- rbot
coBottom -- mbot
width -- df.mvs
fine -- (df.mvs * CThin)
define [EarlessSingleArchSmallMShape top lbot mbot rbot df] : glyph-proc
include : tagged 'barL' : VBarLeft df.leftSB lbot (top - DToothlessRise) df.mvs
include : tagged 'barM' : VBar df.middle mbot top df.mvs
include : dispiro
widths.rhs df.mvs
g4 df.leftSB (top - DToothlessRise)
g4 (df.middle - CorrectionOMidS) (top - O)
archv
flat df.rightSB [Math.max (top - [SmallMSmooth df]) (rbot + 0.1)]
curl df.rightSB rbot [heading Downward]
define SmallMConfig : object
normal { SmallMArches AutoSerifs 0 0 0 }
tailed { SmallMArches AutoSerifs 1 0 0 }
shortLeg { SmallMArches AutoSerifs 0 1 0 }
shortLegTailed { SmallMArches AutoSerifs 1 1 0 }
topLeftSerifed { SmallMArches LtSerifs 0 0 0 }
tailedTopLeftSerifed { SmallMArches LtSerifs 1 0 0 }
shortLegTopLeftSerifed { SmallMArches LtSerifs 0 1 0 }
shortLegTopLeftSerifedTailed { SmallMArches LtSerifs 1 1 0 }
topLeftAndBottomRightSerifed { SmallMArches LtRbSerifs 0 0 0 }
shortLegTopLeftAndBottomRightSerifed { SmallMArches LtRbSerifs 0 1 0 }
normal { SmallMArches AutoSerifs 0 0 0 }
tailed { SmallMArches AutoSerifs 1 0 0 }
shortLeg { SmallMArches AutoSerifs 0 1 0 }
shortLegTailed { SmallMArches AutoSerifs 1 1 0 }
earlessCornerDoubleArch { EarlessCornerDoubleArchSmallMShape AutoSerifs 0 0 1 }
earlessCornerDoubleArchTailed { EarlessCornerDoubleArchSmallMShape AutoSerifs 1 0 1 }
earlessCornerDoubleArchShortLeg { EarlessCornerDoubleArchSmallMShape AutoSerifs 0 1 1 }
earlessCornerDoubleArchShortLegTailed { EarlessCornerDoubleArchSmallMShape AutoSerifs 1 1 1 }
earlessRoundedDoubleArch { EarlessRoundedDoubleArchSmallMShape AutoSerifs 0 0 1 }
earlessRoundedDoubleArchTailed { EarlessRoundedDoubleArchSmallMShape AutoSerifs 1 0 1 }
earlessRoundedDoubleArchShortLeg { EarlessRoundedDoubleArchSmallMShape AutoSerifs 0 1 1 }
earlessRoundedDoubleArchShortLegTailed { EarlessRoundedDoubleArchSmallMShape AutoSerifs 1 1 1 }
earlessSingleArch { EarlessSingleArchSmallMShape AutoSerifs 0 0 1 }
earlessSingleArchTailed { EarlessSingleArchSmallMShape AutoSerifs 1 0 1 }
earlessSingleArchShortLeg { EarlessSingleArchSmallMShape AutoSerifs 0 1 1 }
earlessSingleArchShortLegTailed { EarlessSingleArchSmallMShape AutoSerifs 1 1 1 }
foreach { suffix { Body Serifs tailed shortLeg earless } } [Object.entries SmallMConfig] : do
create-glyph "m.\(suffix)" : glyph-proc
local df : dfM
set-width df.width
include : df.markSet.e
include : Body XH 0 [if shortLeg [SmallMShortLegHeight df] 0] [if tailed ([SmallMSmoothHeight df] + O) 0] df
if tailed : include : RightwardTailedBar df.rightSB 0 [SmallMSmoothHeight df] (sw -- df.mvs)
include : Serifs df XH 0 [if shortLeg [SmallMShortLegHeight df] 0] 0 tailed earless
create-glyph "capitalSmallM.\(suffix)" : glyph-proc
local df : dfM
set-width df.width
include : df.markSet.capital
include : Body CAP 0 [if shortLeg [SmallMShortLegHeight df] 0] [if tailed ([SmallMSmoothHeight df] + O) 0] df
if tailed : include : RightwardTailedBar df.rightSB 0 [SmallMSmoothHeight df] (sw -- df.mvs)
include : Serifs df CAP 0 [if shortLeg [SmallMShortLegHeight df] 0] 0 tailed earless
create-glyph "mLTail.\(suffix)" : glyph-proc
local df : dfM
set-width df.width
include : df.markSet.p
include [refer-glyph "m.\(suffix)"]
eject-contour 'serifRB'
include : VerticalHook (df.rightSB - df.mvs / 2 * HVContrast) 0 (-HookX) Hook df.mvs
create-glyph "turnmLeg.\(suffix)" : glyph-proc
local df : dfM
set-width df.width
include : df.markSet.p
include [refer-glyph "m.\(suffix)"]
eject-contour 'serifLT'
include : FlipAround df.middle (XH / 2)
include : VBarRight df.rightSB Descender XH df.mvs
if (SLAB && Serifs === AutoSerifs) : begin
include : union
LeftwardBottomSerif (df.rightSB - HalfStroke * HVContrast) Descender MidJutSide
RightwardBottomSerif (df.rightSB - HalfStroke * HVContrast) Descender Jut
if (Serifs === LtRbSerifs || Serifs === LtSerifs) : begin
include : RightwardBottomSerif df.rightSB Descender SideJut
select-variant 'm' 'm'
select-variant 'capitalSmallM' (follow -- 'm')
link-reduced-variant 'm/sansSerif' 'm' MathSansSerif
select-variant 'cyrl/te.italic' (shapeFrom -- 'm')
alias 'cyrl/te.BGR' null 'cyrl/te.italic'
derive-composites 'cyrl/teDescender.italic' null 'cyrl/te.italic'
CyrDescender [DivFrame para.diversityM 3].rightSB
select-variant 'mLTail' 0x271
select-variant 'turnmLeg' 0x270 (follow -- 'm')
turned 'turnm' 0x26F 'm' [dfM].middle (XH / 2)
turned 'capitalTurnm' 0x19C 'capitalSmallM' [dfM].middle (CAP / 2)
glyph-block-import Letter-Blackboard : BBS BBD BBBarLeft
create-glyph 'mathbb/m' 0x1D55E : glyph-proc
local df : DivFrame 1 3
local bbs : AdviceStroke 8
local bbd : BBD * [Math.min (3 / 4) (bbs / BBS)]
define xMid : mix (df.leftSB + bbd + bbs * HVContrast) df.rightSB 0.5
set-width df.width
include : df.markSet.e
include : BBBarLeft df.leftSB 0 XH (bbd -- bbd) (bbs -- bbs)
include : union
HBarBottom (xMid - bbd) xMid 0 bbs
nShoulder
stroke -- bbs
left -- (df.leftSB + bbd + bbs * HVContrast)
right -- xMid
fine -- ShoulderFine
intersection
VBarRight (xMid - bbd) 0 XH bbs
nShoulderMask
stroke -- bbs
left -- (df.leftSB + bbd + bbs * HVContrast + 1)
right -- (xMid - 1)
top -- (XH - 1)
fine -- ShoulderFine
include : union
HBarBottom (df.rightSB - bbd) df.rightSB 0 bbs
nShoulder
leftY0 -- 0
stroke -- bbs
left -- xMid
right -- df.rightSB
fine -- ShoulderFine
intersection
VBarRight (df.rightSB - bbd) 0 XH bbs
nShoulderMask
stroke -- bbs
left -- (xMid + 1)
right -- (df.rightSB - 1)
top -- (XH - 1)
fine -- ShoulderFine