forked from be5invis/Iosevka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeometry.ptl
176 lines (151 loc) · 6.67 KB
/
geometry.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
$$include '../../meta/macros.ptl'
import [mix linreg clamp fallback] from "@iosevka/util"
glyph-module
glyph-block Symbol-Math-Geometry : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Shared-Symbol-Shapes : VZigzag
local kBox : 2 / 3
local leftBox : SB * kBox
local rightBox : Width - SB * kBox
local radiusBox : (rightBox - leftBox) / 2
local topBox : SymbolMid + radiusBox
local bottomBox : SymbolMid - radiusBox
create-glyph 'mathRightTriangle' 0x22BF : glyph-proc
include : intersection
spiro-outline
corner leftBox bottomBox
corner rightBox bottomBox
corner rightBox topBox
union
dispiro [widths.lhs GeometryStroke] [flat leftBox bottomBox] [curl rightBox bottomBox]
dispiro [widths.lhs GeometryStroke] [flat rightBox bottomBox] [curl rightBox topBox]
dispiro [widths.lhs GeometryStroke] [flat rightBox topBox] [curl leftBox bottomBox]
create-glyph 'angle' 0x2220 : glyph-proc
include : intersection
spiro-outline
corner leftBox bottomBox
corner rightBox bottomBox
corner rightBox topBox
union
dispiro [widths.lhs GeometryStroke] [flat leftBox bottomBox] [curl rightBox bottomBox]
dispiro [widths.lhs GeometryStroke] [flat rightBox topBox] [curl leftBox bottomBox]
turned 'turnAngle' 0x29A2 'angle' Middle SymbolMid
create-glyph 'revAngle' 0x29A3 : glyph-proc
include : intersection
spiro-outline
corner leftBox topBox
corner leftBox bottomBox
corner rightBox bottomBox
union
dispiro [widths.lhs GeometryStroke] [flat leftBox bottomBox] [curl rightBox bottomBox]
dispiro [widths.rhs GeometryStroke] [flat leftBox topBox] [curl rightBox bottomBox]
create-glyph 'measuredAngle' 0x2221 : glyph-proc
include [refer-glyph 'angle'] AS_BASE ALSO_METRICS
include : intersection
spiro-outline
corner leftBox (bottomBox - [Math.tan (15 / 180 * Math.PI)] * radiusBox)
corner rightBox (bottomBox - [Math.tan (15 / 180 * Math.PI)] * radiusBox)
corner rightBox (bottomBox + 2 * [Math.tan (60 / 180 * Math.PI)] * radiusBox)
corner leftBox bottomBox
RingStrokeAt leftBox bottomBox (1.2 * radiusBox + GeometryStroke) GeometryStroke
create-glyph 'sphericalAngle' 0x2222 : glyph-proc
include : intersection
spiro-outline
corner leftBox SymbolMid
corner rightBox bottomBox
corner rightBox topBox
union
dispiro [widths.lhs GeometryStroke] [flat leftBox SymbolMid] [curl rightBox bottomBox]
dispiro [widths.lhs GeometryStroke] [flat rightBox topBox] [curl leftBox SymbolMid]
include : intersection
spiro-outline
corner leftBox SymbolMid
corner rightBox (SymbolMid - 2 * [Math.tan (45 / 180 * Math.PI)] * radiusBox)
corner rightBox (SymbolMid + 2 * [Math.tan (45 / 180 * Math.PI)] * radiusBox)
RingStrokeAt leftBox SymbolMid (1.2 * radiusBox + GeometryStroke) GeometryStroke
create-glyph 'rightAngle' 0x221F : glyph-proc
include : intersection
spiro-outline
corner leftBox bottomBox
corner rightBox bottomBox
corner rightBox topBox
corner leftBox topBox
union
dispiro [widths.lhs GeometryStroke] [flat leftBox bottomBox] [curl rightBox bottomBox]
dispiro [widths.lhs GeometryStroke] [flat leftBox topBox] [curl leftBox bottomBox]
create-glyph 'rightAngleWithArc' 0x22BE : glyph-proc
include [refer-glyph 'rightAngle'] AS_BASE ALSO_METRICS
include : intersection
spiro-outline
corner leftBox bottomBox
corner rightBox bottomBox
corner rightBox topBox
corner leftBox topBox
RingStrokeAt leftBox bottomBox (1.2 * radiusBox + GeometryStroke) GeometryStroke
create-glyph 'revRightAngle' 0x2BFE : glyph-proc
include : intersection
spiro-outline
corner leftBox bottomBox
corner rightBox bottomBox
corner rightBox topBox
corner leftBox topBox
union
dispiro [widths.lhs GeometryStroke] [flat leftBox bottomBox] [curl rightBox bottomBox]
dispiro [widths.rhs GeometryStroke] [flat rightBox topBox] [curl rightBox bottomBox]
WithDotVariants 'pullback' 0x27D3 : function [DrawAt kr ov] : glyph-proc
include [refer-glyph 'revRightAngle'] AS_BASE ALSO_METRICS
local offset : mix 0 GeometryStroke 0.5
include : DrawAt (Middle - offset) (SymbolMid + offset) (DotRadius * kr * [AdviceStroke 4] / Stroke - ov)
turned 'pushout' 0x27D4 'pullback' Middle SymbolMid
create-glyph 'sineWave' 0x223F : glyph-proc
define N 64
local knots {}
define [Wave x] : [Math.sin x] + 0.05 * [Math.sin (3 * x)]
foreach t [range 0 till N] : begin
knots.push : g2
mix leftBox rightBox (t / N)
mix bottomBox topBox : 0.5 + 0.5 * [Wave : 2 * Math.PI * t / N]
include : dispiro [widths.center GeometryStroke] knots
create-glyph 'wavyLine' 0x2307 : glyph-proc
define N 64
local knots {}
define [Wave x] : [Math.sin x] + 0.05 * [Math.sin (3 * x)]
foreach t [range 0 till N] : begin
knots.push : g2
mix leftBox rightBox : 0.5 + 0.1 * [Wave : 4 * Math.PI * t / N]
mix TackBot TackTop (t / N)
include : dispiro [widths.center GeometryStroke] knots
create-glyph 'wigglyLine' 0x2E3E : glyph-proc
define N 4
local knots {}
local stroke : AdviceStroke2 4 11 (ParenTop - ParenBot)
local halfSw : 0.5 * stroke
local halfVSw : HSwToV halfSw
local bot : ParenBot + halfSw
local top : ParenTop - halfSw
local left : Middle - [Math.max (radiusBox / 4) (halfVSw * 1.1)] - halfVSw
local right : Middle + [Math.max (radiusBox / 4) (halfVSw * 1.1)] + halfVSw
foreach t [range 0 N] : begin
knots.push : list
g4 [mix right left 0.5] [mix bot top (t / N)]
g4.up.mid (right - halfVSw) [mix bot top ((t + 0.25) / N)]
g4 [mix right left 0.5] [mix bot top ((t + 0.5) / N)]
g4.up.mid (left + halfVSw) [mix bot top ((t + 0.75) / N)]
include : dispiro
widths.center stroke
straight.right.start left bot
* knots
g4 [mix right left 0.5] top
straight.right.end right top
do 'Zigzags'
create-glyph 'zigzag' 0x299A : VZigzag Middle ParenBot ParenTop (radiusBox / 4) 9 0 GeometryStroke
create-glyph 'wigglyFenceLeft' 0x29D8 : VZigzag Middle ParenBot ParenTop (radiusBox / 4) 10 1 GeometryStroke
create-glyph 'wigglyFenceRight' 0x29D9 : VZigzag Middle ParenBot ParenTop (radiusBox / 4) 10 0 GeometryStroke
define space : (rightBox - leftBox - [HSwToV GeometryStroke] * 2) / 3
create-glyph 'doubleWigglyFenceLeft' 0x29DA : glyph-proc
include : with-transform [ApparentTranslate space 0] : refer-glyph 'wigglyFenceLeft'
include : with-transform [ApparentTranslate (-space) 0] : refer-glyph 'wigglyFenceLeft'
create-glyph 'doubleWigglyFenceRight' 0x29DB : glyph-proc
include : with-transform [ApparentTranslate space 0] : refer-glyph 'wigglyFenceRight'
include : with-transform [ApparentTranslate (-space) 0] : refer-glyph 'wigglyFenceRight'