summaryrefslogtreecommitdiff
path: root/fonts/elvish/tengmacs.mf
blob: b28eb37aa9c90b209c04f749a72193d1150b307a (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
autorounding := 1 ;
mode_setup;
define_pixels(em,asc,desc,ex);
define_blacker_pixels(penwidth,penthickness) ;
define_blacker_pixels(tehta_penwidth) ;
define_corrected_pixels(o);
define_whole_pixels(straight_sidebar,curve_sidebar) ;
 
define_pixels(fudge, tinco_width, parma_width, romen_width) ;
define_pixels(luva_width) ;
pickup pencircle xscaled penwidth yscaled penthickness rotated penangle;
main_nib := savepen ;
pickup pencircle xscaled tehta_penwidth yscaled penthickness rotated penangle;
tehta_nib := savepen ;
 
def draw_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"):
                  penangle else: penangle+180 fi)}
      .. z.j{if (luva_type = "tinco") or (luva_type = "parma"):
                   right else: left 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_tinco_luva(suffix i,j,k,l) =
 % this draws a complete tinco luva, using the four given suffices
 % for the control points. ALL the information about the control
 % points is determined within the macro; they are provided only for
 % information and later use.
 lft x.i = straight_sidebar ; % intersection with stem
 top y.j = round(ex + o + tinco_fudge) ; % top
 rt x.k = round (x.i + luva_width) ; % right
 bot y.l = 0; % round (- o) ; % bottom, with fudge factor
 draw_luva(i,j,k,l)("tinco",tp_bow_stem_y,
                            tc_bow_arch_x,
                            tc_bow_side_y,
                            tc_bow_end_x )
 
 enddef ;
 
def draw_ando_luva(suffix i,j,k,l,ii,jj,kk,ll) =
 % this draws a complete ando luva
 % first bow
 lft x.i = straight_sidebar ; % intersection with stem
 top y.j = round(ex + o + tinco_fudge) ; % top
 rt x.k = round (x.i + luva_width) ; % right
 bot y.l =  round (- o) ; % bottom, with fudge factor
 draw_luva(i,j,k,l)("tinco",tp_bow_stem_y,
                            tc_bow_arch_x,
                            tc_bow_side_y,
                            tc_bow_end_x )    ;
 % now the second luva
 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)("tinco",tp_bow_stem_y,
                            tc_bow_arch_x,
                            tc_bow_side_y,
                            tc_bow_end_x )
 enddef ;
 
def draw_parma_luva(suffix i,j,k,l) =
 % this draws a complete parma luva
 lft x.i = straight_sidebar ; % intersection with stem
 top y.j = round(ex + o) ; % top
 rt x.k = round (x.i + luva_width) ; % right
 bot 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 ;
 
def draw_umbar_luva(suffix i,j,k,l,ii,jj,kk,ll) =
 % this draws a complete umbar luva
 % first bow
 lft x.i = straight_sidebar ; % intersection with stem
 top y.j = round(ex + o) ; % top
 rt x.k = round (x.i + luva_width) ; % right
 bot 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 ;
 
def draw_calma_luva(suffix i,j,k,l) =
 % this draws a complete calma luva
 rt x.i = w - straight_sidebar ; % intersection with stem
 y.j = good.y 0 ; % bottom
 lft x.k = round (x.i - luva_width) ; % left
 top y.l = round(ex - fudge) ; % top
 draw_luva(i,j,k,l)("calma",cq_bow_stem_y,
                            tc_bow_arch_x,
                            tc_bow_side_y,
                            tc_bow_end_x )
 enddef ;
 
def draw_anga_luva(suffix i,j,k,l,ii,jj,kk,ll) =
 % this draws a complete anga luva
 % first bow
 rt x.i = w - straight_sidebar ; % intersection with stem
 y.j = good.y 0 ; % bottom
 lft x.k = round (x.i - luva_width) ; % left
 top y.l = round(ex - fudge) ; % top
 draw_luva(i,j,k,l)("calma",cq_bow_stem_y,
                            tc_bow_arch_x,
                            tc_bow_side_y,
                            tc_bow_end_x )  ;
 % now the second luva
 z.second = ( (x.i-pt,y.i) .. (-infinity,y.i) ) intersectionpoint luva_path ;
 x.ii = good.x (xpart z.second) ;
 y.jj = y.j ;
 lft x.kk = round (x.ii - luva_width) ; % left
 y.ll = y.l ;
 draw_luva(ii,jj,kk,ll)("calma",cq_bow_stem_y,
                            tc_bow_arch_x,
                            tc_bow_side_y,
                            tc_bow_end_x )
 enddef ;
 
def draw_quesse_luva(suffix i,j,k,l) =
 % this draws a complete quesse luva
 rt x.i = w - straight_sidebar ; % intersection with stem
 y.j = good.y 0 ; % bottom
 lft x.k = round (x.i - luva_width) ; % left
 top y.l = round(ex) ; % top
 draw_luva(i,j,k,l)("quesse",cq_bow_stem_y,
                            pq_bow_arch_x,
                            pq_bow_side_y,
                            pq_bow_end_x )
 enddef ;
 
def draw_ungwe_luva(suffix i,j,k,l,ii,jj,kk,ll) =
 % this draws a complete ungwe luva
 % first bow
 rt x.i = w - straight_sidebar ; % intersection with stem
 y.j = good.y 0 ; % bottom
 lft x.k = round (x.i - luva_width) ; % left
 top y.l = round(ex) ; % top
 draw_luva(i,j,k,l)("quesse",cq_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 ;
 lft x.kk = round (x.ii - luva_width) ; % left
 y.ll = y.l ;
 draw_luva(ii,jj,kk,ll)("quesse",cq_bow_stem_y,
                            pq_bow_arch_x,
                            pq_bow_side_y,
                            pq_bow_end_x )
 enddef ;
 
 
 
def draw_telco(suffix i,j)(expr serifs)  = % serifs = t,b,tb for Top & Bottom
 z.i.$ = z.i + 0.05em * dir(penangle+180) ;
 z.i.$$ = z.i + 0.1em * down ;
 z.j.$ = z.j + 0.05em * dir(penangle) ;
 z.j.$$ = z.j + 0.1em * up ;
 draw z.i .. z.j ;
 if (serifs = "t") or (serifs = "tb"):
  filldraw z.i -- z.i.${dir(penangle-90)}
   .. {down}z.i.$$ & z.i.$$ .. z.i & cycle ; fi
 if (serifs = "b") or (serifs = "tb"):
  filldraw z.j -- z.j.${dir(penangle+90)}
   .. {up}z.j.$$ & z.j.$$ .. z.j & cycle ; fi
 labels(i,j)
 enddef ;
 
def draw_bar(suffix i,j)(expr serifs) = % serifs = r,l,rl for Right/Left
 z.right_serif1 = z.j + 0.04em * left ;
 z.right_serif2 = z.j + 0.04em * dir penangle ;
 z.left_serif1 = z.i + 0.04em * right ;
 z.left_serif2 = z.i + 0.04em * dir(penangle+180) ;
 draw if (serifs = "l") or (serifs = "rl"):
         z.left_serif2{dir penangle} .. z.left_serif1 else: z.i fi
      ---
      if (serifs = "r") or (serifs = "rl"):
         z.right_serif1 .. {dir penangle}z.right_serif2 else: z.j fi ;
labels(i,j)
 enddef ;
 
 
def draw_dot(suffix i) =
 % calculate width of pen
 numeric penwdth ;
 1.1penwdth = (pen_rt - pen_lft) ++ (pen_top - pen_bot) ;
 z.i.$ = z.i + 1/2penwdth*dir(penangle+90) ;
 z.i.$$ = z.i + 1/2penwidth*dir(penangle-90) ;
 draw z.i.$$ -- z.i.$ ; drawdot z.i.$$ ; drawdot z.i.$ ;
enddef ;