summaryrefslogtreecommitdiff
path: root/fonts/elvish/tengdev.mf
blob: c1b2d56e7f8680b66a61c49279b97e9a4ba86fe8 (plain)
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350

 def draw_refl_luva(suffix i,j,k,l)
 (expr luva_type,bow_stem_y,bow_arch_x,
       bow_side_y,bow_end_x) =
 y.i = bow_stem_y * ex ;
 x.j - x.i = bow_arch_x * (x.k - x.i) ;
 y.k = (if (luva_type = "calma") or (luva_type = "quesse"): 1 - fi bow_side_y) * ex ;
 x.l - x.i = bow_end_x * (x.k - x.i) ;
 numeric x.luva_serif,y.luva_serif ;
 z.luva_serif = z.l + 0.03em *
   if luva_type = "tinco": dir 135 else: dir 315 fi ;
 
 path luva_path ;
 luva_path = z.i{dir( if (luva_type = "tinco") or (luva_type = "parma"):
                  180-penangle else: -penangle fi)}
      .. z.j{if (luva_type = "tinco") or (luva_type = "parma"):
                   left else: right fi}
     .. z.k ..
      if (luva_type = "parma") or (luva_type = "quesse"): {curl 0.3}z.l
      else: z.l .. {curl 2}z.luva_serif fi ;
 draw luva_path ;
 labels(i,j,k,l)
 enddef ;
 
def draw_refl_parma_luva(suffix i,j,k,l) =
 % this draws a complete reflected parma luva
 rt x.i = w - straight_sidebar ; % intersection with stem
 top y.j = round(ex + o) ; % top
 lft x.k = round (x.i - luva_width) ; % right
 y.l = 0 ;% bottom
 draw_refl_luva(i,j,k,l)("parma",tp_bow_stem_y,
                            pq_bow_arch_x,
                            pq_bow_side_y,
                            pq_bow_end_x )
 enddef ;
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
beginchar("0",.8tinco_width#,ex#,0); "The tengwa number zero";
 pickup main_nib ;
 lft x1 = curve_sidebar = w - rt x3 ; x2 = .5[x1,x3 ] ;
 x4 = .2w ;
 top y2 = h ;
 y1 = .7h ; y3 = .55h ; y4 = 0 ;
 z1' = z1 + .03em*dir(penangle-90) ;
 draw z1'{dir(penangle+90)} .. z1 .. z2{right} .. z3{down} .. z4 ;
endchar ;
 
beginchar("1",.9tinco_width#,ex#,0) ; "The tengwa number one" ;
 pickup main_nib ;
 lft x1 = straight_sidebar = w - rt x2 ; top y1 = h = top y2 ;
 draw_bar(1,2,"r") ;
 x3 = x1 ; y3 = .4h = y5 ;
 x4 = .4w ; bot y4 = 0 - o ;
 rt x5 = .75w ;
 z5' = z5 + 0.05em*dir140 ;
 draw_telco(1,3,"t") ;
 draw z3{down} .. z4{right} .. z5 %%%.. z5' ;
endchar ;
 
beginchar("2",1.4tinco_width#,ex#,0) ; "The tengwa number two" ;
 pickup main_nib ;
 lft x1 = straight_sidebar = w - rt x3 ; top y1 = top y2 = top y3 = h ;
 draw_bar(1,3,"r") ;
 rt x2 = round(.9*.75tinco_width) ; x2 = x6 ;
 y4 = y6 = y8 = .4h ;
 bot y5 = bot y7 = 0 ;
 x8 - x6 = x6 - x4 ;
 x5 = .4*.9tinco_width ;  x4 = x1 ;
 x5 - x4 = x7 - x6 ;
 z8' = z8 + 0.05em*dir140 ;
 draw_telco(1,4,"t") ; draw z2 -- z6 ;
 draw z4{down} .. z5{right} .. z6 ;
 draw z6{down} .. z7{right} .. z8 %%%.. z8' ;
endchar ;
 
beginchar("3",1.9tinco_width#,ex#,0) ; "The tengwa number three" ;
 pickup main_nib ;
 lft x1 = straight_sidebar = w - rt x3 ;
 top y1 = top y2 = top y2' = top y3 = h ;
 draw_bar(1,3,"r") ;
 rt x2 = round(.9*.75tinco_width) ; x2 = x6 ;
 x2' = x8 ;
 y4 = y6 = y8 = y10 = .4h ;
 bot y5 = bot y7 = bot y9 = 0 ;
 x8 - x6 = x6 - x4 = x10 - x8 ;
 x5 = .4*.9tinco_width ;  x4 = x1 ;
 x5 - x4 = x7 - x6 = x9 - x8 ;
 z10' = z10 + 0.05em*dir140 ;
 draw_telco(1,4,"t") ; draw z2 -- z6 ; draw z2' -- z8 ;
 draw z4{down} .. z5{right} .. z6 ;
 draw z6{down} .. z7{right} .. z8 ;
 draw z8{down} .. z9{right} .. z10 %%%.. z10' ;
endchar ;
 
beginchar("4",.9tinco_width#,asc#,desc#) ; "The tengwa number four" ;
 pickup main_nib ;
 lft x1 = straight_sidebar = w - rt x2 ; top y1 = round ex = top y2 ;
 x1' = x1 ; top y1' = h ;
 %%draw_bar(1,2,"r") ;
 x3 = x1 ; top y3 = 0 = y5 ;
 x4 = .4w ; bot y4 = vround(-.7d-o) ;
 rt x5 = .85w ;
 z5' = z5 + 0.05em*dir140 ;
 draw_telco(1',3,"t") ;
 draw z3{down} .. z4{right} .. z5 %%%%.. z5' ;
endchar ;
 
beginchar("5",1.4tinco_width#,asc#,desc#) ; "The tengwa number five" ;
 pickup main_nib ;
 lft x1 = straight_sidebar = w - rt x3 ;
 x1' = x1 ; top y1' = h ;
 top y1 = top y2 = top y3 = round ex ;
 draw_bar(1,3,"r") ;
 rt x2 = round(.9*.75tinco_width) ; x2 = x6 ;
 top y4 = -.1d ; y6 = y8 = .4ex ;
 bot y5 = vround(-.7d-o) ; bot y7 = 0 ;
 x8 - x6 = x6 - x4 ;
 x5 = .4*.9tinco_width ;  x4 = x1 ;
 x5 - x4 = x7 - x6 ; x5' = .5[x4,x7] ; y5' = y5 ;
 z8' = z8 + 0.05em*dir140 ;
 draw_telco(1',4,"t") ; draw z2 -- z6 ;
 draw z4{down} .. z5'{right} ... z7 ;
 draw z6{down} .. z7{right} .. z8 %%%.. z8' ;
endchar ;
 
beginchar("6",1.9tinco_width#,asc#,desc#) ; "The tengwa number six" ;
 pickup main_nib ;
 lft x1 = straight_sidebar = w - rt x3 ;
 x1' = x1 ; top y1' = h ;
 top y1 = top y2 = top y3 = round ex ;
 draw_bar(1,3,"r") ;
 rt x2 = round(.9*.75tinco_width) ; x2 = x6 ;
 x2' - x2 = x2 - x1 ; y2' = y2 ;
 top y4 = -.1d ; y6 = y8 = y10 = .4ex ;
 bot y5 = vround(-.7d-o) ; bot y7 = bot y9 = 0 ;
 x8 - x6 = x6 - x4 = x10 - x8 ;
 x5 = .4*.9tinco_width ;  x4 = x1 ;
 x5 - x4 = x7 - x6 = x9 - x8 ; x5' = .5[x4,x7] ; y5' = y5 ;
 z8' = z8 + 0.05em*dir140 ;
 draw_telco(1',4,"t") ; draw z2 -- z6 ; draw z2' -- z8 ;
 draw z4{down} .. z5'{right} ... z7 ;
 draw z6{down} .. z7{right} .. z8 ; %%%.. z8' ;
 draw z8{down} .. z9{right} .. z10 ;
endchar ;
 
beginchar("7",.9parma_width#,ex#,desc#); "The tengwa number 7";
 pickup main_nib ;
 lft x1 = straight_sidebar ;
 x5 = x1+hround(.6parma_width) ;  top y5 = asc ; % top of stem
 x6 = x5 ; y6 = 0 ; % bottom of stem
 draw_telco(5,6)("t") ;
 lft x9 = curve_sidebar ; top y9 = -.3d ;
 x10 = .5[x6,x9] ; bot y10 = vround(-d-o) ;
 x6' = x6 ; y6' = -.3d ;
 draw z6 .. z6'{down} .. z10{left} .. z9 ;
 endchar ;
 
 
def draw_number_luva(suffix i,j,k,l) =
 % this draws a complete number luva
 lft x.i = hround(.6parma_width) + straight_sidebar ; % intersection with stem
 top y.j = round(ex + o) ; % top
 rt x.k = round (x.i + luva_width) ; % right
 y.l = 0 ;% bottom
 draw_luva(i,j,k,l)("parma",tp_bow_stem_y,
                            pq_bow_arch_x,
                            pq_bow_side_y,
                            pq_bow_end_x )
 enddef ;
 
beginchar("8",1.6parma_width#,ex#,desc#); "The tengwa number 8";
 pickup main_nib ;
 draw_number_luva(1,2,3,4) ;
 x5 = x1 ;  top y5 = asc ; % top of stem
 x6 = x5 ; y6 = 0 ; % bottom of stem
 draw_telco(5,6)("t") ;
 x7 = x5 ; y7 = good.y o = y8 ; x8 = x3 + 0.05em ; % N.B. praps bot y7 = bot y8 = 0
 draw_bar(7,8)("r") ;
 lft x9 = curve_sidebar ; top y9 = -.1d ;
 x10 = .5[x5,x9] ; bot y10 = vround(-d-o) ;
 x6' = x6 ; y6' = -.3d ;
 draw z6 .. z6'{down} .. z10{left} .. z9 ;
 endchar ;
 
def draw_double_number_luva(suffix i,j,k,l,ii,jj,kk,ll) =
 % this draws a complete umbar luva
 % first bow
 lft x.i = hround(.6parma_width)+straight_sidebar ; % intersection with stem
 top y.j = round(ex + o) ; % top
 rt x.k = round (x.i + luva_width) ; % right
 y.l = 0 ;% bottom
 draw_luva(i,j,k,l)("parma",tp_bow_stem_y,
                            pq_bow_arch_x,
                            pq_bow_side_y,
                            pq_bow_end_x ) ;
 %second bow
 z.second = ( (x.i+pt,y.i) .. (infinity,y.i) ) intersectionpoint luva_path ;
 x.ii = good.x (xpart z.second) ;
 y.jj = y.j ;
 rt x.kk = round (x.ii + luva_width) ; % right
 y.ll = y.l ;
 draw_luva(ii,jj,kk,ll)("parma",tp_bow_stem_y,
                            pq_bow_arch_x,
                            pq_bow_side_y,
                            pq_bow_end_x )
 enddef ;
 
beginchar("9",2.25parma_width#,ex#,desc#); "The tengwa number 9";
 pickup main_nib ;
 draw_double_number_luva(1,2,3,4,9,10,11,12) ;
 x5 = x1 ;  top y5 = asc ; % top of stem
 x6 = x5 ; y6 = 0 ; % bottom of stem
 draw_telco(5,6)("t") ;
 x7 = x5 ; y7 = good.y o = y8 ; x8 = x11 + 0.05em ;
 draw_bar(7,8)("r") ;
 lft x13 = curve_sidebar ; top y13 = -.1d ;
 x14 = .5[x5,x13] ; bot y14 = vround(-d-o) ;
 x6 = x6' ; y6' = -.3d ;
 draw z6 .. z6'{down} .. z14{left} .. z13 ;
 endchar ;
 
beginchar("+",0.9*tinco_width#,asc#,0) ; "The tengwa number 10" ;
 pickup main_nib ;
 rt x4 = w - curve_sidebar ; y4 = 0.65ex ; % right side of bow
 bot y3 = round(-o) ; x3 = good.x 0.5w ; % bottom
 x2 = w - x4 ; y2 = 0.45ex ; % left side of bow
 x1 = good.x 0.3w ; y1 = 0.7ex ; % end of bow
 z1' = z1 + 0.03em*dir(10) ; % serif
 x5 = 0.25w ; y5 = 0.95asc ; % top end of letter
 z6 = z5 + 0.05em*(dir(penangle+80)) ; % for serif
 draw z1'{dir(180+penangle)} .. z1 .. z2 .. z3
   .. z4{up} .. tension 0.9 and 3 .. z5 ;
 labels(1,1',2,3,4,5,6) ;
endchar ;
 
beginchar("-",0.85tinco_width#,asc#,desc#) ; "The tengwa number" ;
 pickup main_nib ;
 numeric t[] ;
 % top bow first - make a path for later use
 x1 = 0.25w ; y1 = 0.95asc ; % top
 z1' = z1 + 0.05em*dir(penangle+80) ; % serif
 rt x2 = w - curve_sidebar ; y2 = 0.5h ; % right side of top bow ;
 x3 = 0.5w ; y3 = good.y 0.2h ; % bottom of top bow
 x4 = 0.3w ; y4 = 0.5h ; % end of bow
 z4' = z4 + 0.03em*dir(10) ; % serif
 path p ;
 p = z4'{dir(penangle+180)} .. z4 .. z3{right} .. z2{up} ..
       tension 0.9 and 2.5 .. z1 ;
 draw p ;
 x5' = x1 ; y5'-y7 = y1-y3 ; % top of bottom bow
 x6 = x2 ; y6 - y7 = y2 - y3 ; % side
 x7 = x3 ; bot y7 = round(-0.9desc) ; % bottom
 z8 - z7 = z4 - z3 ; % end
 z8' - z8 = z4' - z4 ;
 path pa ;
 pa = z8'{dir(penangle+180)} .. z8 .. z7{right} .. z6{up} ..
        tension 0.9 and 1.3 .. z5' ;
 (t1,t2) = p intersectiontimes pa ;
 draw subpath(0,t2) of pa ;
 labels(1,2,3,4,5,6,7,8) ;
endchar ;
 
beginchar("/",0.9*tinco_width#,ex#,desc#); "The tengwa number 12";
 pickup main_nib ;
 lft x2 = curve_sidebar ; y2 = 0.6 ex ; % left
 top y3 = round(ex+o) ; x3 = 0.55w ; % top
 rt x4 = w - curve_sidebar ; y4 = 0.4 ex ;
 x1 = x2 + 0.45w ; y1 = 0.2 ex ; % curly end
 x5 = x2 ; y5 = -0.9desc ;
 draw z1{dir(penangle+180)} .. z2{up} .. z3{right} ..
        z4{down} .. tension 3 .. z5 ;
 labels(1,2,3,4,5) ;
endchar ;
 
beginchar("{",0.2em#,1.5ex#,0) ; "The circle-over tehta" ;
 pickup tehta_nib ;
 x1 = x3 = good.x .5w ; bot y3 = vround(1.3ex) ;
 y1 = y3 + vround .45ex ; y1 - y3 = x2 - x4 ;
 y2 = y4 = .5[y1,y3] ; x1 = .5[x2,x4] ;
 draw z1 .. z2 .. z3 .. z4 .. cycle ;
endchar ;
 
beginchar("}",0.2em#,0,desc#) ; "The circle-over tehta" ;
 pickup tehta_nib ;
 x1 = x3 = good.x .5w ; top y1 = vround -.3ex ;
 y1 = y3 + vround .45ex ; y1 - y3 = x2 - x4 ;
 y2 = y4 = .5[y1,y3] ; x1 = .5[x2,x4] ;
 draw z1 .. z2 .. z3 .. z4 .. cycle ;
endchar ;
 
 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
beginchar(28,parma_width#,ex#,desc#); "Reflected parma"; % ^^\
 pickup main_nib ;
 draw_refl_parma_luva(1,2,3,4) ;
 x5 = x1 ;  top y5 = ex ; % top of stem
 x6 = x5 ; bot y6 = -desc ; % bottom of stem
 draw_telco(5,6)("tb") ;
 x7 = x5 ; y7 = good.y o = y8 ; x8 = x3 - 0.05em ; % N.B. praps bot y7 = bot y8 = 0
 draw_bar(7,8)("r") ;
 endchar ;
 
beginchar(29,parma_width#,ex#,0); "Reflected formen";
 pickup main_nib ;
 draw_refl_parma_luva(1,2,3,4) ;
 x5 = x1 ;  top y5 = asc ; % top of stem
 x6 = x5 ; y6 = 0 ; % bottom of stem
 draw_telco(5,6)("t") ;
 x7 = x5 ; y7 = good.y o = y8 ; x8 = x3 - 0.05em ; % N.B. praps bot y7 = bot y8 = 0
 draw_bar(7,8)("r") ;
 endchar ;
 
beginchar("(",0.4em#,asc#,0) ; "Left paren" ;
 pickup main_nib ;
 top y1 = round asc ; bot y3 = 0 ; y2 = 1/2[y1,y3] ;
 lft x2 = straight_sidebar = w - rt x1 = w - rt x3 ;
 draw z1 .. z2 .. z3 ;
endchar ;
 
beginchar(")",0.4em#,asc#,0) ; "Right paren" ;
 pickup main_nib ;
 top y1 = round asc ; bot y3 = 0 ; y2 = 1/2[y1,y3] ;
 lft x1 = lft x3 = straight_sidebar = w - rt x2 ;
 draw z1 .. z2 .. z3 ;
endchar ;
 
beginchar("`",0.5em#,ex#,0) ; "Left guillemet" ;
 pickup tehta_nib ;
 y2 = 0.6ex = 1/2[y1,y3] ;
 y1 - y3 = 0.4ex ;
 lft x2 = straight_sidebar = w - rt x1 - 0.2em ; x1 = x3 ;
 draw z1 .. z2 .. z3 ;
 forsuffixes i=1,2,3: x.i' = x.i + round(0.2em) ; y.i' = y.i ; endfor ;
 draw z1' .. z2' .. z3' ;
endchar ;
 
beginchar("'",0.5em#,ex#,0) ; "Right guillemet" ;
 pickup tehta_nib ;
 y2 = 0.6ex = 1/2[y1,y3] ;
 y1 - y3 = 0.4ex ;
 rt x2 = w - straight_sidebar = w - lft x1 + 0.2em ; x1 = x3 ;
 draw z1 .. z2 .. z3 ;
 forsuffixes i=1,2,3: x.i' = x.i - round(0.2em) ; y.i' = y.i ; endfor ;
 draw z1' .. z2' .. z3' ;
endchar ;
 
end.