Debian Codegraph @

texmf-dist/fonts/source/public/elvish/tengmacs.mf

raw
1 autorounding := 1 ;
2 mode_setup;
3 define_pixels(em,asc,desc,ex);
4 define_blacker_pixels(penwidth,penthickness) ;
5 define_blacker_pixels(tehta_penwidth) ;
6 define_corrected_pixels(o);
7 define_whole_pixels(straight_sidebar,curve_sidebar) ;
8
9 define_pixels(fudge, tinco_width, parma_width, romen_width) ;
10 define_pixels(luva_width) ;
11 pickup pencircle xscaled penwidth yscaled penthickness rotated penangle;
12 main_nib := savepen ;
13 pickup pencircle xscaled tehta_penwidth yscaled penthickness rotated penangle;
14 tehta_nib := savepen ;
15
16 def draw_luva(suffix i,j,k,l)
17 (expr luva_type,bow_stem_y,bow_arch_x,
18 bow_side_y,bow_end_x) =
19 y.i = bow_stem_y * ex ;
20 x.j - x.i = bow_arch_x * (x.k - x.i) ;
21 y.k = (if (luva_type = "calma") or (luva_type = "quesse"): 1 - fi bow_side_y) * ex ;
22 x.l - x.i = bow_end_x * (x.k - x.i) ;
23 numeric x.luva_serif,y.luva_serif ;
24 z.luva_serif = z.l + 0.03em *
25 if luva_type = "tinco": dir 135 else: dir 315 fi ;
26
27 path luva_path ;
28 luva_path = z.i{dir( if (luva_type = "tinco") or (luva_type = "parma"):
29 penangle else: penangle+180 fi)}
30 .. z.j{if (luva_type = "tinco") or (luva_type = "parma"):
31 right else: left fi}
32 .. z.k ..
33 if (luva_type = "parma") or (luva_type = "quesse"): {curl 0.3}z.l
34 else: z.l .. {curl 2}z.luva_serif fi ;
35 draw luva_path ;
36 labels(i,j,k,l)
37 enddef ;
38
39 def draw_tinco_luva(suffix i,j,k,l) =
40 % this draws a complete tinco luva, using the four given suffices
41 % for the control points. ALL the information about the control
42 % points is determined within the macro; they are provided only for
43 % information and later use.
44 lft x.i = straight_sidebar ; % intersection with stem
45 top y.j = round(ex + o + tinco_fudge) ; % top
46 rt x.k = round (x.i + luva_width) ; % right
47 bot y.l = 0; % round (- o) ; % bottom, with fudge factor
48 draw_luva(i,j,k,l)("tinco",tp_bow_stem_y,
49 tc_bow_arch_x,
50 tc_bow_side_y,
51 tc_bow_end_x )
52
53 enddef ;
54
55 def draw_ando_luva(suffix i,j,k,l,ii,jj,kk,ll) =
56 % this draws a complete ando luva
57 % first bow
58 lft x.i = straight_sidebar ; % intersection with stem
59 top y.j = round(ex + o + tinco_fudge) ; % top
60 rt x.k = round (x.i + luva_width) ; % right
61 bot y.l = round (- o) ; % bottom, with fudge factor
62 draw_luva(i,j,k,l)("tinco",tp_bow_stem_y,
63 tc_bow_arch_x,
64 tc_bow_side_y,
65 tc_bow_end_x ) ;
66 % now the second luva
67 z.second = ( (x.i+pt,y.i) .. (infinity,y.i) ) intersectionpoint luva_path ;
68 x.ii = good.x (xpart z.second) ;
69 y.jj = y.j ;
70 rt x.kk = round (x.ii + luva_width) ; % right
71 y.ll = y.l ;
72 draw_luva(ii,jj,kk,ll)("tinco",tp_bow_stem_y,
73 tc_bow_arch_x,
74 tc_bow_side_y,
75 tc_bow_end_x )
76 enddef ;
77
78 def draw_parma_luva(suffix i,j,k,l) =
79 % this draws a complete parma luva
80 lft x.i = straight_sidebar ; % intersection with stem
81 top y.j = round(ex + o) ; % top
82 rt x.k = round (x.i + luva_width) ; % right
83 bot y.l = 0 ;% bottom
84 draw_luva(i,j,k,l)("parma",tp_bow_stem_y,
85 pq_bow_arch_x,
86 pq_bow_side_y,
87 pq_bow_end_x )
88 enddef ;
89
90 def draw_umbar_luva(suffix i,j,k,l,ii,jj,kk,ll) =
91 % this draws a complete umbar luva
92 % first bow
93 lft x.i = straight_sidebar ; % intersection with stem
94 top y.j = round(ex + o) ; % top
95 rt x.k = round (x.i + luva_width) ; % right
96 bot y.l = 0 ;% bottom
97 draw_luva(i,j,k,l)("parma",tp_bow_stem_y,
98 pq_bow_arch_x,
99 pq_bow_side_y,
100 pq_bow_end_x ) ;
101 %second bow
102 z.second = ( (x.i+pt,y.i) .. (infinity,y.i) ) intersectionpoint luva_path ;
103 x.ii = good.x (xpart z.second) ;
104 y.jj = y.j ;
105 rt x.kk = round (x.ii + luva_width) ; % right
106 y.ll = y.l ;
107 draw_luva(ii,jj,kk,ll)("parma",tp_bow_stem_y,
108 pq_bow_arch_x,
109 pq_bow_side_y,
110 pq_bow_end_x )
111 enddef ;
112
113 def draw_calma_luva(suffix i,j,k,l) =
114 % this draws a complete calma luva
115 rt x.i = w - straight_sidebar ; % intersection with stem
116 y.j = good.y 0 ; % bottom
117 lft x.k = round (x.i - luva_width) ; % left
118 top y.l = round(ex - fudge) ; % top
119 draw_luva(i,j,k,l)("calma",cq_bow_stem_y,
120 tc_bow_arch_x,
121 tc_bow_side_y,
122 tc_bow_end_x )
123 enddef ;
124
125 def draw_anga_luva(suffix i,j,k,l,ii,jj,kk,ll) =
126 % this draws a complete anga luva
127 % first bow
128 rt x.i = w - straight_sidebar ; % intersection with stem
129 y.j = good.y 0 ; % bottom
130 lft x.k = round (x.i - luva_width) ; % left
131 top y.l = round(ex - fudge) ; % top
132 draw_luva(i,j,k,l)("calma",cq_bow_stem_y,
133 tc_bow_arch_x,
134 tc_bow_side_y,
135 tc_bow_end_x ) ;
136 % now the second luva
137 z.second = ( (x.i-pt,y.i) .. (-infinity,y.i) ) intersectionpoint luva_path ;
138 x.ii = good.x (xpart z.second) ;
139 y.jj = y.j ;
140 lft x.kk = round (x.ii - luva_width) ; % left
141 y.ll = y.l ;
142 draw_luva(ii,jj,kk,ll)("calma",cq_bow_stem_y,
143 tc_bow_arch_x,
144 tc_bow_side_y,
145 tc_bow_end_x )
146 enddef ;
147
148 def draw_quesse_luva(suffix i,j,k,l) =
149 % this draws a complete quesse luva
150 rt x.i = w - straight_sidebar ; % intersection with stem
151 y.j = good.y 0 ; % bottom
152 lft x.k = round (x.i - luva_width) ; % left
153 top y.l = round(ex) ; % top
154 draw_luva(i,j,k,l)("quesse",cq_bow_stem_y,
155 pq_bow_arch_x,
156 pq_bow_side_y,
157 pq_bow_end_x )
158 enddef ;
159
160 def draw_ungwe_luva(suffix i,j,k,l,ii,jj,kk,ll) =
161 % this draws a complete ungwe luva
162 % first bow
163 rt x.i = w - straight_sidebar ; % intersection with stem
164 y.j = good.y 0 ; % bottom
165 lft x.k = round (x.i - luva_width) ; % left
166 top y.l = round(ex) ; % top
167 draw_luva(i,j,k,l)("quesse",cq_bow_stem_y,
168 pq_bow_arch_x,
169 pq_bow_side_y,
170 pq_bow_end_x ) ;
171 % second bow
172 z.second = ( (x.i-pt,y.i) .. (-infinity,y.i) ) intersectionpoint luva_path ;
173 x.ii = good.x (xpart z.second) ;
174 y.jj = y.j ;
175 lft x.kk = round (x.ii - luva_width) ; % left
176 y.ll = y.l ;
177 draw_luva(ii,jj,kk,ll)("quesse",cq_bow_stem_y,
178 pq_bow_arch_x,
179 pq_bow_side_y,
180 pq_bow_end_x )
181 enddef ;
182
183
184
185 def draw_telco(suffix i,j)(expr serifs) = % serifs = t,b,tb for Top & Bottom
186 z.i.$ = z.i + 0.05em * dir(penangle+180) ;
187 z.i.$$ = z.i + 0.1em * down ;
188 z.j.$ = z.j + 0.05em * dir(penangle) ;
189 z.j.$$ = z.j + 0.1em * up ;
190 draw z.i .. z.j ;
191 if (serifs = "t") or (serifs = "tb"):
192 filldraw z.i -- z.i.${dir(penangle-90)}
193 .. {down}z.i.$$ & z.i.$$ .. z.i & cycle ; fi
194 if (serifs = "b") or (serifs = "tb"):
195 filldraw z.j -- z.j.${dir(penangle+90)}
196 .. {up}z.j.$$ & z.j.$$ .. z.j & cycle ; fi
197 labels(i,j)
198 enddef ;
199
200 def draw_bar(suffix i,j)(expr serifs) = % serifs = r,l,rl for Right/Left
201 z.right_serif1 = z.j + 0.04em * left ;
202 z.right_serif2 = z.j + 0.04em * dir penangle ;
203 z.left_serif1 = z.i + 0.04em * right ;
204 z.left_serif2 = z.i + 0.04em * dir(penangle+180) ;
205 draw if (serifs = "l") or (serifs = "rl"):
206 z.left_serif2{dir penangle} .. z.left_serif1 else: z.i fi
207 ---
208 if (serifs = "r") or (serifs = "rl"):
209 z.right_serif1 .. {dir penangle}z.right_serif2 else: z.j fi ;
210 labels(i,j)
211 enddef ;
212
213
214 def draw_dot(suffix i) =
215 % calculate width of pen
216 numeric penwdth ;
217 1.1penwdth = (pen_rt - pen_lft) ++ (pen_top - pen_bot) ;
218 z.i.$ = z.i + 1/2penwdth*dir(penangle+90) ;
219 z.i.$$ = z.i + 1/2penwidth*dir(penangle-90) ;
220 draw z.i.$$ -- z.i.$ ; drawdot z.i.$$ ; drawdot z.i.$ ;
221 enddef ;