Debian Codegraph @

texmf-dist/fonts/source/public/bookhands/pgothtitle.mf

raw
1 %%
2 %% This is file `pgothtitle.mf',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% pgothic.dtx (with options: `mfd')
8 %%
9 %% Copyright 1999 Peter R. Wilson
10 %%
11 %% This program is provided under the terms of the
12 %% LaTeX Project Public License distributed from CTAN
13 %% archives in directory macros/latex/base/lppl.txt.
14 %%
15 %% Author: Peter Wilson (CUA)
16 %% now at: [email protected]
17 %%
18 def makebox(text rule) =
19 for y=0,half_height,cap_height,body_height,x_height,-desc_depth,-body_depth:
20 rule((l,y)t_,(r,y)t_); endfor % horizontals
21 for x=l,r: rule((x,-body_depth)t_,(x,body_height)t_); endfor % verticals
22 for x=u*(1+floor(1/u)) step u until r-1:
23 rule((x,-body_depth)t_,(x,body_height)t_); endfor % more verticals
24 if charic<>0:
25 rule((r+charic*pt,h.o_),(r+charic*pt,.5h.o_)); fi % italic correction
26 enddef;
27
28
29 def proofpcbb(suffix $)(expr xoff, yoff) =
30 if proofing > 0:
31 x$bl = x$ - xoff; y$bl = y$ - yoff; % Bottom Left Hand Corner
32 z$br = (x$bl+side, y$bl); % BRHC
33 z$tr = (x$bl+side, y$bl+side); % TRHC
34 z$tl = (x$bl, y$bl+side); % TLHC
35 z$bc = 1/2[z$bl,z$br]; z$tc = 1/2[z$tl,z$tr]; % horizontal mid points
36 pair hc, vc;
37 hc = (2u,0); vc = (0,2u);
38 pickup pensquare scaled 2;
39 for s = z$bl, z$br, z$tr, z$tl, z$bc, z$tc:
40 draw s-hc--s+hc;
41 draw s-vc--s+vc;
42 endfor
43 fi
44 enddef;
45
46
47 def pgothic_font_setup= % contains special stuff for pgothic fonts
48 define_pixels(side,half_height,carol_height,comma_width);
49 define_pixels(u,dot_size,letter_size,cap_height,width_adj,serif_fit,
50 cap_serif_fit,jut,clubjut,cap_jut,trijut);
51 define_pixels(fig_width);
52 define_whole_pixels(letter_fit,sb,cap_sb);
53 define_whole_vertical_pixels(body_height,asc_height,cap_height,x_height,
54 desc_depth,body_depth,fig_height);
55 define_corrected_pixels(o);
56 define_blacker_pixels(thick,thin);
57 define_pixels(stem_width);
58 define_pixels(perpdec,angdec);
59 let adjust_fit = normal_adjust_fit;
60 pickup pencircle scaled thin;
61 stylus:=savepen;
62 pickup pencircle scaled (1.5thin);
63 thickstylus:=savepen;
64 pickup pencircle xscaled thick yscaled thin rotated pangle;
65 quill:=savepen;
66
67 pickup pencircle xscaled 3/4thick yscaled thin rotated pangle;
68 threequarterquill := savepen;
69
70 pickup pencircle xscaled 1/2thick yscaled thin rotated pangle;
71 halfquill := savepen;
72
73 pickup pencircle xscaled 1/4thick yscaled thin rotated pangle;
74 quarterquill := savepen;
75
76 numeric pcshiftx#; % x value of LHS of box wrt origin of char box
77 define_pixels(pcshiftx);
78 numeric sqxside#; % x size of the square
79 numeric sqyside#; % y size of the square
80 define_pixels(sqxside,sqyside);
81
82 enddef; % end of pgothic_font_setup
83
84 boolean ductus;
85 ductus:=false;
86 numeric qhor, qvert;
87 qhor:=cosd(pangle); qvert:=sind(pangle);
88 pair pdir; pdir=dir(pangle);
89 pair ppdir; ppdir=dir(pangle+90);
90
91 def draw_upforkstem(suffix $, $$)=
92 pen oldpen; oldpen:=currentpen;
93 x$a=x$; top y$a = bot y$; % top of straight stem
94 draw z$a--z$$; % straight part
95 z$b = (rt x$, y$); z$c = (x$b, top y$a);
96 z$d = (lft x$, bot y$a); z$e = (x$d, y$);
97 pickup stylus;
98 rt x$cc = x$c; y$cc = y$c;
99 lft x$bb = x$b; y$bb = y$b;
100 lft x$dd = x$d; y$dd = y$d;
101 rt x$ee = x$e; y$ee = y$e;
102 filldraw z$a--z$bb..z$cc--cycle; % fork
103 filldraw z$a--z$dd..z$ee--cycle;
104 pickup oldpen;
105 labels($a,$b,$c,$d,$e);
106 enddef; % end of draw_upforkstem
107
108
109 def draw_downforkstem(suffix $, $$)=
110 pen oldpen; oldpen:=currentpen;
111 x$$a=x$$; bot y$$a = top y$$; % bottom of straight stem
112 draw z$--z$$a; % straight part
113 z$$b = (rt x$$, y$$); z$$c = (x$$b, top y$$a);
114 z$$d = (lft x$$, bot y$$a); z$$e = (x$$d, y$$);
115 pickup stylus;
116 rt x$$cc = x$$c; y$$cc = y$$c;
117 lft x$$bb = x$$b; y$$bb = y$$b;
118 lft x$$dd = x$$d; y$$dd = y$$d;
119 rt x$$ee = x$$e; y$$ee = y$$e;
120 filldraw z$$a--z$$bb..z$$cc--cycle; % fork
121 filldraw z$$a--z$$dd..z$$ee--cycle;
122 pickup oldpen;
123 labels($$a,$$b,$$c,$$d,$$e);
124 enddef; % end of draw_downforkstem
125
126
127 def draw_upcurlstem(suffix $, $$)=
128 pen oldpen; oldpen:=currentpen;
129 path curlp[]; numeric curln[];
130 x$a=x$; top y$a = y$; % top of straight stem
131 draw z$a--z$$; % straight part
132 curln1 := rt x$a - lft x$a; % stem width
133 x$b = x$a - 4/2curln1; y$b = y$a; % left jut
134 curlp1 := z$a{-pdir}..{left}z$b;
135 draw curlp1;
136
137 x$c = x$a-3curln1; top y$c = bot y$a-1/2curln1;
138 x$f = x$b; y$f = 1/3[y$c,y$b];
139 x$tb = rt x$b; y$tb = top y$b;
140 x$bb = lft x$b; y$bb = bot y$b;
141 curlp2 := z$tb--z$bb..{down}z$c..{ppdir}z$f;
142 pickup stylus;
143 draw curlp2;
144 pickup oldpen;
145 labels($a,$b,$c,$d,$e,$f);
146 enddef; % end of draw_upcurlstem
147
148
149 def draw_updiamondstem(suffix $, $$)(expr fr, minfr, wd, phi)=
150 pen oldpen; oldpen:=currentpen;
151 numeric sj; sj := fr*stem_width; % jut distance
152 numeric sjr; sjr := minfr*stem_width; % right jut distance
153 numeric jw; jw := wd*stem_width; % jut width
154 %% $b is bottom left of jut, on LHS of stem
155 %% $c is leftmost point on jut
156 %% $d is topmost point on jut
157 %% $g is topmost point on stem
158 %% $e is on exprapolation of line from $d through $g
159 %% i.e., the rightmost point on jut
160 %% $f is on RHS of stem
161 pickup quill;
162 x$b = lft x$;
163 x$c = x$b - sj; y$c = y$ - jw*(cosd phi); % $c done
164 y$b = y$c - sj*(sind phi); % $b done
165 x$d = x$c + jw*(sind phi); y$d = y$; % $d done
166 x$g = x$f = rt x$;
167 y$g = y$ - (x$g-x$d)*(sind phi)/(cosd phi); % $g done
168 x$a = x$; top y$a = y$g; % $a done
169 x$e = x$g + sjr; z$e = whatever[z$d,z$g]; % $e done
170 z$f-z$e = whatever*(z$c-z$d); % $f done
171 x$h = x$b; y$h = bot y$a;
172 draw z$a--z$$; % straight part
173 pickup stylus;
174 lft x$cc = x$c; y$cc = y$c;
175 x$dd = x$d; top y$dd = y$d;
176 rt x$ee = x$e; bot y$ee=y$e;
177 filldraw z$b--z$cc--z$dd--z$ee--z$f--cycle; % diamond
178 if y$b > y$h:
179 lft x$hh = x$h; y$hh=y$h;
180 filldraw z$b--z$hh--z$g--cycle;
181 fi
182 pickup oldpen;
183 labels($a,$b,$c,$d,$e,$f);
184 enddef; % end of draw_updiamondstem
185
186
187 def draw_downdiamondstem(suffix $, $$)(expr fr, minfr, wd, phi)=
188 pen oldpen; oldpen:=currentpen;
189 numeric sj; sj := fr*stem_width; % (left) jut distance
190 numeric sjr; sjr := minfr*stem_width;; % right jut distance
191 numeric jw; jw := wd*stem_width; % jut width
192 %% $$b is top right of jut, on RHS of stem
193 %% $$c is rightmost point on jut
194 %% $$d is bottommost point on jut
195 %% $$g is bottommost point on stem
196 %% $$e is on exprapolation of line from $d through $g
197 %% i.e., the leftmost point on jut
198 %% $$f is on LHS of stem
199 pickup quill;
200 x$$b = rt x$$;
201 x$$c = x$$b + sj; y$$c = y$$ + jw*(cosd phi); % $$c done
202 y$$b = y$$c + sj*(sind phi); % $$b done
203 x$$d = x$$c - jw*(sind phi); y$$d = y$$; % $$d done
204 x$$g = x$$f = lft x$$;
205 y$$g = y$$ + (x$$d-x$$g)*(sind phi)/(cosd phi); % $$g done
206 x$$a = x$$; bot y$$a = y$$g; % $$a done
207 x$$e = x$$g - sjr; z$$e = whatever[z$$d,z$$g]; % $$e done
208 z$$f-z$$e = whatever*(z$$c-z$$d); % $$f done
209 x$$h = x$$b; y$$h = top y$$a;
210 draw z$--z$$a; % straight part
211 pickup stylus;
212 rt x$$cc = x$$c; y$$cc=y$$c;
213 x$$dd = x$$d; bot y$$dd = y$$d;
214 lft x$$ee = x$$e; top y$$ee = y$$e;
215 filldraw z$$b--z$$cc--z$$dd--z$$ee--z$$f--cycle; % diamond
216 if y$$b < y$$h:
217 rt x$$hh = x$$h; y$$hh=y$$h;
218 filldraw z$$b--z$$hh--z$$g--cycle;
219 fi
220 pickup oldpen;
221 labels($$a,$$b,$$c,$$d,$$e,$$f);
222 enddef; % end of draw_downdiamondstem
223
224
225 def draw_flat_head(suffix $)=
226 pen oldpen; oldpen:=currentpen;
227 %% pickup quill;
228 x$bl'' = lft x$; y$bl'' = bot y$;
229 x$tr'' = rt x$; y$tr'' = top y$;
230 pickup stylus;
231 lft x$blfh = x$bl''; y$blfh = y$bl'';
232 rt x$trfh = x$tr''; top y$trfh = y$tr'';
233 x$tlfh = x$blfh; y$tlfh = y$trfh;
234 filldraw z$blfh--z$tlfh--z$trfh--cycle;
235 pickup oldpen;
236 labels($tlfh);
237 enddef; % end of draw_flat_head
238
239 def draw_flat_foot(suffix $)=
240 pen oldpen; oldpen:=currentpen;
241 %% pickup quill;
242 x$bl'' = lft x$; y$bl'' = bot y$;
243 x$tr'' = rt x$; y$tr'' = top y$;
244 pickup stylus;
245 lft x$blff = x$bl''; bot y$blff = y$bl'';
246 rt x$trff = x$tr''; y$trff = y$tr'';
247 x$brff = x$trff; y$brff = y$blff;
248 filldraw z$blff--z$trff--z$brff--cycle;
249 pickup oldpen;
250 labels($brff);
251 enddef; % end of draw_flat_foot
252
253 def draw_serif(suffix $, $$)(expr fr)=
254 numeric beta, ajut, bjut;
255 beta=1-fr;
256 ajut=fr*jut; bjut=beta*jut;
257 pair vec[]; vec1=unitvector(z$$-z$);
258 vec2=ajut*vec1;
259 z$a=z$ shifted vec2;
260 z$b=z$a rotatedaround (z$,-90);
261 boolean top_serif;
262 if y$>y$$:
263 top_serif := true;
264 z$c=z$b shifted (-bjut*pdir);
265 else:
266 top_serif:=false;
267 z$c=z$b shifted (bjut*pdir);
268 fi
269 if top_serif:
270 draw z$c--z$b{pdir}..{z$$-z$}z$a; % the serif
271 else:
272 draw z$c--z$b{-pdir}..{z$$-z$}z$a;
273 fi
274 labels($a,$b,$c);
275 enddef; % end of draw_serif
276
277
278 def draw_roundserif(suffix $, $$)(expr fr)=
279 draw_serif($, $$, fr);
280 undraw z$--z$a;
281 enddef; % end of draw_roundserif
282
283
284 def draw_flatserif(suffix $, $$)(expr fr)=
285 numeric beta, ajut, bjut;
286 beta=1-fr;
287 ajut=fr*jut; bjut=beta*jut;
288 pair vec[]; vec1=unitvector(z$$-z$);
289 vec2=ajut*vec1;
290 z$a=z$ shifted vec2;
291 %%% z$b=z$a rotatedaround (z$,-90);
292 boolean top_serif;
293 if y$>y$$:
294 top_serif := true;
295 z$c=z$ shifted (-jut*pdir);
296 else:
297 top_serif:=false;
298 z$c=z$ shifted (jut*pdir);
299 fi
300 z$b = fr[z$,z$c];
301 draw z$a--z$;
302 if top_serif:
303 draw z$c--z$b{pdir}..{z$$-z$}z$a; % the serif
304 else:
305 draw z$c--z$b{-pdir}..{z$$-z$}z$a;
306 fi
307 labels($a,$b,$c);
308 enddef; % end of draw_flatserif
309
310
311 def draw_clubserif(suffix $, $$)(expr fr)=
312 numeric beta, ajut, bjut;
313 %% beta=1-fr;
314 ajut=clubjut; bjut=beta*jut;
315 pair vec[]; vec1=unitvector(z$$-z$);
316 %% vec2=ajut*vec1;
317 %% z$a=z$ shifted vec2;
318 boolean top_serif;
319 if y$>y$$:
320 top_serif := true;
321 z$c=z$ shifted (-clubjut*pdir);
322 else:
323 top_serif:=false;
324 z$c=z$ shifted (clubjut*pdir);
325 fi
326 z$a = fr[z$,z$$];
327 draw z$c..z$a{vec1};
328 labels($a,$b,$c);
329 enddef; % end of draw_clubserif
330
331
332 def draw_triserif(suffix $)(expr tj)=
333 pen oldpen; oldpen:=currentpen;
334 pickup quill;
335 x$ts1'=lft x$; y$ts1'=bot y$;
336 pickup stylus;
337 lft x$ts1=x$ts1'; bot y$ts1=y$ts1';
338 x$ts2=x$ts1-tj; z$ts2=whatever[z$,z$ts1];
339 x$ts3=x$ts1; y$ts3=y$ts2-tj;
340 pickup stylus;
341 %% filldraw z$ts1--z$ts2--z$ts3--cycle;
342 filldraw z$--z$ts2--z$ts3--cycle;
343 pickup oldpen;
344 labels($ts1,$ts2,$ts3);
345 enddef; % end of draw_triserif
346
347
348 def draw_istem(suffix $, $$)(expr fr)=
349 draw_serif($, $$, fr); % top serif
350 draw_serif($$, $, fr); % bottom serif
351 draw z$a--z$$a; % the stem
352 enddef; % end of draw_istem
353
354
355 def draw_tstem(suffix $, $$)(expr fr)=
356 %% draw_serif($$, $, fr); % the serif
357 %% draw z$--z$$a; % the stem
358 draw z$--z$$;
359 enddef; % end of draw_tstem
360
361
362 def draw_tlserif(suffix $, $$)(expr fr)=
363 draw_serif($, $$, fr); % the serif
364 draw z$a--z$$; % the stem
365 enddef; % end of draw_tlserif
366
367
368 def draw_flick(suffix $)(expr rise, fall, fjut)=
369 rt x$b = x1+fjut; top y$b=y$-fall;
370 x$a=0.5[x$,x$b]; top y$a=y$+rise;
371 draw z$..z$a..z$b;
372 labels($a,$b);
373 enddef; % end of draw_flick
374
375
376 def draw_wave(suffix $,$$)(expr f)=
377 x$wl=x$; y$wl=y$-f;
378 x$wr=x$$; y$wr=y$$+f;
379 z$wc=0.5[z$wl,z$wr];
380 draw z$wl{pdir}..z$wc{right}..{pdir}z$wr;
381 labels($wl,$wc,$wr);
382 enddef; % end of draw_wave
383
384 def draw_tail(suffix $)(expr fj)=
385 pen oldpen; oldpen:=currentpen;
386 pickup quill;
387 x$tl' = lft x$; y$tl=bot y$;
388 pickup stylus;
389 lft x$tl=x$tl';
390 x$tb=x$tl-fj; bot y$tb=y$tl-1/2desc_depth;
391 filldraw z${down}..{-pdir}z$tb & z$tb{pdir}..{up}z$tl--cycle;
392 pickup oldpen;
393 labels($tb,$tl);
394 enddef; % end of draw_tail
395
396 def draw_triangle(suffix $)(expr sz)=
397 pen oldpen; oldpen:=currentpen;
398 pickup stylus;
399 x$t1=x$-sz/2; x$t3=x$+sz/2;
400 y$t1=y$t3=y$;
401 x$t2=x$; y$t2=y$-0.9sz; % approx sqrt(3)/2
402 filldraw z$t1--z$t2--z$t3--cycle;
403 pickup oldpen;
404 labels($t1,$t2,$t3);
405 enddef; % end of draw_triangle
406
407 def draw_utriangle(suffix $)(expr sz)=
408 pen oldpen; oldpen:=currentpen;
409 pickup stylus;
410 x$t1=x$-sz/2; x$t3=x$+sz/2;
411 y$t1=y$t3=y$;
412 x$t2=x$; y$t2=y$+0.9sz; % approx sqrt(3)/2
413 filldraw z$t1--z$t2--z$t3--cycle;
414 pickup oldpen;
415 labels($t1,$t2,$t3);
416 enddef; % end of draw_utriangle
417
418 def draw_rtriangle(suffix $)(expr sz)=
419 pen oldpen; oldpen:=currentpen;
420 pickup stylus;
421 x$t1=x$-sz; rt x$t3=x$;
422 y$t1=y$t3=y$;
423 x$t2=x$t3; y$t2=y$-sz;
424 filldraw z$t1--z$t2--z$t3--cycle;
425 pickup oldpen;
426 labels($t1,$t2,$t3);
427 enddef; % end of draw_rtriangle
428
429 def draw_rutriangle(suffix $)(expr sz)=
430 pen oldpen; oldpen:=currentpen;
431 pickup stylus;
432 x$t1=x$-sz; rt x$t3=x$;
433 y$t1=y$t3=y$;
434 x$t2=x$t3; y$t2=y$+sz;
435 filldraw z$t1--z$t2--z$t3--cycle;
436 pickup oldpen;
437 labels($t1,$t2,$t3);
438 enddef; % end of draw_rutriangle
439
440 def draw_fork(suffix $, $$)(expr sz)=
441 pen oldpen; oldpen:=currentpen;
442 pickup quill;
443 x$f1'=lft x$; y$f1'=bot y$;
444 x$f3'=rt x$; y$f3'=top y$;
445 pickup stylus;
446 lft x$f1=x$f1'; bot y$f1=y$f1';
447 rt x$f3=x$f3'; y$f3-y$=2*(y$-y$f1);
448 rt x$f2=x$$-sz; bot y$f2=y$$;
449 rt x$f4= rt x$f5=x$$;
450 bot y$f5=y$$-sz; top y$f4=y$$+1/2sz;
451 filldraw z$f1--z$f2--z$f3--cycle; % the line
452 draw z$f2{right}..z$f4; % upper fork
453 draw z$f2{right}..z$f5; % lower fork
454 pickup oldpen;
455 labels($f1,$f2,$f3,$f4,$f5);
456 enddef; % end of draw_fork
457
458 def draw_urswish(suffix $, $$)=
459 pen oldpen; oldpen:=currentpen;
460 pickup quill;
461 rt x$$s1=x$$-thick; top y$$s1=y$$;
462 rt x$$s2=x$$;
463 %% x$$s3=x$$-thick;
464 lft x$$s3=x$$s1;
465 bot y$$s3=y$$-thick; y$$s2=0.5[y$$s1,y$$s3];
466 %% draw z$---z$$s1{right}..z$$s2{down}..{-pdir}z$$s3;
467 draw z$..z$$s1{pdir}..z$$s2{down};
468 labels($$s1,$$s2,$$s3);
469 enddef; % end of draw_urswish
470
471 def bowl_stem(suffix $, $$)=
472 x$'=0.5[x$,x$$]; y$'=y$; % the mid-point
473 z$''=z$' shifted (thick*pdir);
474 x$i=x$$; z$i=whatever[z$',z$''];
475 labels($',$i);
476 enddef; % end of bowl_stem
477
478 def draw_clubbase(suffix $, $$)(expr st, lft, rt)=
479 z$$l = z$$ shifted (lft*thick*(-pdir));
480 z$$r = z$$ shifted (rt*thick*(pdir));
481 z$$t = st[z$$,z$];
482 draw z$$t{z$$-z$}..z$$l--z$$r..{z$-z$$}z$$t;
483 labels($$t,$$l,$$r);
484 enddef; % end of draw_clubbase
485
486
487 def draw_pdot(suffix $)(expr sz)=
488 z$s = z$ shifted (0.5sz*left);
489 z$t = z$ shifted (0.5sz*up);
490 z$u = z$s shifted (sz*right);
491 z$v = z$t shifted (sz*down);
492 pickup stylus;
493 filldraw z$s--z$t--z$u--z$v--cycle;
494 labels($s,$t,$u,$v);
495 enddef; % end of draw_pdot
496
497
498 def draw_pcomma(suffix $)(expr sz, ar)=
499 z$s = z$ shifted (0.5sz*left);
500 z$t = z$s shifted (sz*right);
501 x$v=x$s-ar; y$v=y$s-2ar;
502 z$u = z$v shifted (sz*right);
503 z$sv = (x$s, 1/3[y$s,y$v]);
504 z$tu = (x$t, y$sv);
505 z$uv = 1/3[z$u,z$v];
506 z$vu = 1/3[z$v,z$u];
507 pickup stylus;
508 %% filldraw z$s--z$t--z$u--z$v--cycle;
509 filldraw z$s--z$t--z$tu--z$uv--z$vu--z$v--z$sv--cycle;
510 labels($s,$t,$u,$v);
511 enddef; % end of draw_pcomma
512
513
514 def draw_plq(suffix $)(expr sz, ar)=
515 z$s = z$ shifted (0.5sz*left);
516 z$t = z$s shifted (sz*right);
517 x$v=x$s+ar; y$v=y$s-2ar;
518 z$u = z$v shifted (sz*right);
519 z$sv = (x$s, 1/3[y$s,y$v]);
520 z$tu = (x$t, y$sv);
521 z$uv = 1/3[z$u,z$v];
522 z$vu = 1/3[z$v,z$u];
523 pickup stylus;
524 %% filldraw z$s--z$t--z$u--z$v--cycle;
525 filldraw z$s--z$t--z$tu--z$uv--z$vu--z$v--z$sv--cycle;
526 labels($s,$t,$u,$v);
527 enddef; % end of draw_plq
528
529
530 path obouter, obinner, obfirst, obsecond;
531 def offsetbowl(suffix $)(expr sx, sy, fx, fy)=
532 numeric inx, iny, cx, cy;
533 pair pt[];
534 path pth[];
535 inx := 1/2thick*cosd(pangle); iny := 1/2thick*sind(pangle);
536 cx := x$+fx*sx; cy := y$+fy*sy;
537 z$obc = (cx,cy);
538 if pangle = 90:
539 z$wt=(x$+1/2thin, cy);
540 z$et=(x$+sx-1/2thin, cy);
541 else:
542 z$wt=(x$+inx, cy);
543 z$et=(x$+sx-inx, cy);
544 penpos$wt(thick,pangle);
545 penpos$et(thick,pangle);
546 fi
547 if pangle = 0:
548 z$nh=(cx, y$+sy-1/2thin);
549 z$sh=(cx, y$+1/2thin);
550 else:
551 z$nh=(cx, y$+sy-iny);
552 z$sh=(cx, y$+iny);
553 penpos$nh(thick,pangle);
554 penpos$sh(thick,pangle);
555 fi
556 obfirst := z$nh{right}..z$et{down}..z$sh{left}..z$wt{up}..cycle;
557 if pangle = 90:
558 z$minl = z$wt; z$maxr = z$nh; z$minr = z$et; z$maxl = z$sh;
559 else:
560 if pangle = 0:
561 z$minl = z$nh; z$maxr = z$et; z$minr = z$sh; z$maxl = z$wt;
562 else:
563 z$minl = directionpoint dir(pangle) of obfirst;
564 z$minr = directionpoint -dir(pangle) of obfirst;
565 pt1 := z$minr - z$minl; % direction
566 pt2 := (- ypart pt1, xpart pt1); % perpendicular
567 pt3 := 1/2[z$minl, z$minr];
568 pt4 := pt3 shifted pt2;
569 pt5 := pt3 shifted -pt2;
570 pth1 := pt3--pt4;
571 pth2 := pt3--pt5;
572 z$maxr = pth1 intersectionpoint obfirst;
573 z$maxl = pth2 intersectionpoint obfirst;
574 \fi
575 \fi
576 penpos$minl(thin,pangle+90);
577 penpos$maxr(thick,pangle);
578 penpos$minr(thin,pangle+90);
579 penpos$maxl(thick,pangle);
580 obsecond := z$minl..z$maxr..z$minr..z$maxl..cycle;
581 z$minlo = z$minl.r; z$maxro = z$maxr.r;
582 z$minro = z$minr.l; z$maxlo = z$maxl.l;
583 obouter := z$minlo{dir(pangle)}...z$maxro...z$minro{-dir(pangle)}...z$maxlo...cycle;
584 z$minli = z$minl.l; z$maxri = z$maxr.l;
585 z$minri = z$minr.r; z$maxli = z$maxl.r;
586 obinner := z$minli...z$maxri...z$minri...z$maxli...cycle;
587 labels($obc, $nh, $et, $sh, $wt);
588 labels($minl, $maxr, $minr, $maxl);
589 labels($minlo, $maxro, $minro, $maxlo);
590 labels($minli, $maxri, $minri, $maxli);
591 enddef;
592
593
594 def obowl(suffix $)(expr sx, sy)=
595 offsetbowl($, sx, sy, 1/2, 1/2);
596 enddef;
597
598
599 primarydef v scalarprod w =
600 (xpart v * ypart w - ypart v * xpart w)
601 enddef;
602
603
604 def tangentpoint(suffix $)(expr pth)=
605 pair vecll, veclr, veclm; % "tangent" line directions
606 numeric pl, pr, pm; % path parameter values
607 pair vecpl, vecpr, vecpm; % path directions
608 pair ptl, ptr, ptm; % path points
609 numeric sl, sr, sm; % scalar products of path/line directions
610 numeric stpsize; % size of current binary step
611 numeric tantol; % tolerance
612 boolean wtest; % a boolean
613
614 tantol := eps;
615 pl:=0; pr:=length pth; pm:=0.5(pl+pr); stpsize:=pr-pl;
616 ptl := point pl of pth;
617 ptm := point pm of pth;
618 ptr := point pr of pth;
619 vecll := unitvector (z$-ptl);
620 veclm := unitvector (z$-ptm);
621 veclr := unitvector (z$-ptr);
622 vecpl := unitvector (direction pl of pth);
623 vecpm := unitvector (direction pm of pth);
624 vecpr := unitvector (direction pr of pth);
625 sl := vecll scalarprod vecpl;
626 sm := veclm scalarprod vecpm;
627 sr := veclr scalarprod vecpr;
628 wtest := (stpsize < tantol) or (sl*sr > 0) or
629 (abs sl < tantol) or (abs sm < tantol) or (abs sr < tantol);
630 if wtest:
631 if (stpsize < tantol):
632 z$tan=(0,0);
633 errmessage("No tangent; path too short");
634 else:
635 if (sl*sr > 0):
636 z$tan=(0,0);
637 errmessage("No tangent; end products have the same sign");
638 else:
639 if (abs sl < tantol):
640 z$tan=ptl;
641 else:
642 if (abs sm < tantol):
643 z$tan=ptm;
644 else:
645 z$tan=ptr;
646 fi
647 fi
648 fi
649 fi
650 else:
651 forever:
652 if (sl*sm < 0): % opposite signs, look between pl & pm
653 pr:=pm; pm:=0.5(pr+pl);
654 vecpr := vecpm; veclr := veclm; sr:=sm;
655 else:
656 pl:=pm; pm:=0.5(pr+pl);
657 vecpl:=vecpm; vecll:=veclm; sl:=sm;
658 fi
659 stpsize:=pr-pl;
660 ptm := point pm of pth;
661 veclm := unitvector (z$-ptm);
662 vecpm := unitvector (direction pm of pth);
663 sm := veclm scalarprod vecpm;
664 wtest := (stpsize < tantol) or (abs sm < tantol);
665 if wtest:
666 if (abs sm < tantol):
667 z$tan = ptm;
668 else:
669 z$tan = ptm;
670 %%%%%% errmessage("Warning: tangent approximated");
671 fi
672 fi
673 exitif wtest;
674 endfor
675 fi
676 enddef;
677
678
679 font_coding_scheme:="ASCII minuscules and punctuation";
680 mode_setup;
681 pgothic_font_setup;
682
683
684 input pgothl; % lower case
685 input pgothu; % capitals
686 input pgothpunct; % punctuation
687 input pgothlig; % the several dashes
688 input pgothdig; % arabic digits
689
690
691 font_slant slant; font_x_height x_height#;
692 if monospace:
693 font_normal_space 2vstretch*stem_width#; % no stretching or shrinking
694 font_quad vstretch*18u#;
695 font_extra_space vstretch*9u#;
696 else:
697 font_normal_space 2vstretch*stem_width#+2letter_fit#;
698 font_normal_stretch vstretch*3u#; font_normal_shrink vstretch*2u#;
699 font_quad vstretch*18u#+4letter_fit#;
700 font_extra_space vstretch*2u#;
701
702
703 fi
704
705 bye.
706
707 k#:=-.5u#; kk#:=-1.5u#; kkk#:=-2u#; % three degrees of kerning
708 kks#:=-4u#; kkx#:=-1.5u#; kkj#:=-2u#; kkr#:=-5u#; kkrs#:=-2u#; kkrl#:=-8u#;
709 ligtable "s":
710 "a" kern kks#, "A" kern kks#,
711 "c" kern kks#, "C" kern kks#,
712 "d" kern kks#, "D" kern kks#,
713 "e" kern kks#, "E" kern kks#,
714 "f" kern kks#, "F" kern kks#,
715 "g" kern kks#, "G" kern kks#,
716 "i" kern kks#, "I" kern kks#,
717 "j" kern kks#, "J" kern kks#,
718 "k" kern kks#, "K" kern kks#,
719 "m" kern kks#, "M" kern kks#,
720 "n" kern kks#, "N" kern kks#,
721 "o" kern kks#, "O" kern kks#,
722 "p" kern kks#, "P" kern kks#,
723 "q" kern kks#, "Q" kern kks#,
724 "r" kern kks#, "R" kern kks#,
725 "t" kern kks#, "T" kern kks#,
726 "u" kern kks#, "U" kern kks#,
727 "v" kern kks#, "V" kern kks#,
728 "w" kern kks#, "W" kern kks#,
729 "x" kern kks#, "X" kern kks#,
730 "y" kern kks#, "Y" kern kks#,
731 "z" kern kks#, "Z" kern kks#;
732
733 ligtable "S":
734 "a" kern kks#, "A" kern kks#,
735 "c" kern kks#, "C" kern kks#,
736 "d" kern kks#, "D" kern kks#,
737 "e" kern kks#, "E" kern kks#,
738 "f" kern kks#, "F" kern kks#,
739 "g" kern kks#, "G" kern kks#,
740 "i" kern kks#, "I" kern kks#,
741 "j" kern kks#, "J" kern kks#,
742 "k" kern kks#, "K" kern kks#,
743 "m" kern kks#, "M" kern kks#,
744 "n" kern kks#, "N" kern kks#,
745 "o" kern kks#, "O" kern kks#,
746 "p" kern kks#, "P" kern kks#,
747 "q" kern kks#, "Q" kern kks#,
748 "r" kern kks#, "R" kern kks#,
749 "t" kern kks#, "T" kern kks#,
750 "u" kern kks#, "U" kern kks#,
751 "v" kern kks#, "V" kern kks#,
752 "w" kern kks#, "W" kern kks#,
753 "x" kern kks#, "X" kern kks#,
754 "y" kern kks#, "Y" kern kks#,
755 "z" kern kks#, "Z" kern kks#;
756
757 ligtable "x":
758 "a" kern kkx#, "A" kern kkx#,
759 "b" kern kkx#, "B" kern kkx#,
760 "c" kern kkx#, "C" kern kkx#,
761 "d" kern kkx#, "D" kern kkx#,
762 "e" kern kkx#, "E" kern kkx#,
763 "g" kern kkx#, "G" kern kkx#,
764 "j" kern kkx#, "J" kern kkx#,
765 "l" kern kkx#, "L" kern kkx#,
766 "o" kern kkx#, "O" kern kkx#,
767 "q" kern kkx#, "Q" kern kkx#,
768 "t" kern kkx#, "T" kern kkx#,
769 "u" kern kkx#, "U" kern kkx#,
770 "v" kern kkx#, "V" kern kkx#,
771 "w" kern kkx#, "W" kern kkx#,
772 "y" kern kkx#, "Y" kern kkx#;
773
774 ligtable "X":
775 "a" kern kkx#, "A" kern kkx#,
776 "b" kern kkx#, "B" kern kkx#,
777 "c" kern kkx#, "C" kern kkx#,
778 "d" kern kkx#, "D" kern kkx#,
779 "e" kern kkx#, "E" kern kkx#,
780 "g" kern kkx#, "G" kern kkx#,
781 "j" kern kkx#, "J" kern kkx#,
782 "l" kern kkx#, "L" kern kkx#,
783 "o" kern kkx#, "O" kern kkx#,
784 "q" kern kkx#, "Q" kern kkx#,
785 "t" kern kkx#, "T" kern kkx#,
786 "u" kern kkx#, "U" kern kkx#,
787 "v" kern kkx#, "V" kern kkx#,
788 "w" kern kkx#, "W" kern kkx#,
789 "y" kern kkx#, "Y" kern kkx#;
790
791 ligtable "a": "A":
792 "b": "B":
793 "c": "C":
794 "d": "D":
795 "e": "E":
796 "h": "H":
797 "i": "I":
798 "k": "K":
799 "l": "L":
800 "m": "M":
801 "n": "N":
802 "o": "O":
803 "p": "P":
804 "t": "T":
805 "u": "U":
806 "v": "V":
807 "w": "W":
808 "z": "Z":
809 "j" kern kkj#, "J" kern kkj#;
810
811 ligtable "r":
812 "a" kern kkr#, "A" kern kkr#,
813 "b" kern kkr#, "B" kern kkr#,
814 "c" kern kkr#, "C" kern kkr#,
815 "d" kern kkr#, "D" kern kkr#,
816 "e" kern kkr#, "E" kern kkr#,
817 "f" kern kkrs#, "F" kern kkrs#,
818 "g" kern kkrs#, "G" kern kkrs#,
819 "h" kern kkr#, "H" kern kkr#,
820 "i" kern kkr#, "I" kern kkr#,
821 "j" kern kkj#, "J" kern kkj#,
822 "k" kern kkrs#, "K" kern kkrs#,
823 "l" kern kkr#, "L" kern kkr#,
824 "m" kern kkr#, "M" kern kkr#,
825 "n" kern kkrs#, "N" kern kkrs#,
826 "o" kern kkr#, "O" kern kkr#,
827 "p" kern kkrs#, "P" kern kkrs#,
828 "q" kern kkr#, "Q" kern kkr#,
829 "r" kern kkrs#, "R" kern kkrs#,
830 "s" kern kkr#, "S" kern kkr#,
831 "t" kern kkr#, "T" kern kkr#,
832 "u" kern kkr#, "U" kern kkr#,
833 "v" kern kkr#, "V" kern kkr#,
834 "w" kern kkr#, "W" kern kkr#,
835 "x" kern kkx#, "X" kern kkx#,
836 "y" kern kkr#, "Y" kern kkr#,
837 "z" kern kkr#, "Z" kern kkr#;
838
839 ligtable "R":
840 "a" kern kkr#, "A" kern kkr#,
841 "b" kern kkr#, "B" kern kkr#,
842 "c" kern kkr#, "C" kern kkr#,
843 "d" kern kkr#, "D" kern kkr#,
844 "e" kern kkr#, "E" kern kkr#,
845 "f" kern kkrs#, "F" kern kkrs#,
846 "g" kern kkrs#, "G" kern kkrs#,
847 "h" kern kkr#, "H" kern kkr#,
848 "i" kern kkr#, "I" kern kkr#,
849 "j" kern kkj#, "J" kern kkj#,
850 "k" kern kkrs#, "K" kern kkrs#,
851 "l" kern kkr#, "L" kern kkr#,
852 "m" kern kkr#, "M" kern kkr#,
853 "n" kern kkrs#, "N" kern kkrs#,
854 "o" kern kkr#, "O" kern kkr#,
855 "p" kern kkrs#, "P" kern kkrs#,
856 "q" kern kkr#, "Q" kern kkr#,
857 "r" kern kkrs#, "R" kern kkrs#,
858 "s" kern kkr#, "S" kern kkr#,
859 "t" kern kkr#, "T" kern kkr#,
860 "u" kern kkr#, "U" kern kkr#,
861 "v" kern kkr#, "V" kern kkr#,
862 "w" kern kkr#, "W" kern kkr#,
863 "x" kern kkx#, "X" kern kkx#,
864 "y" kern kkr#, "Y" kern kkr#,
865 "z" kern kkr#, "Z" kern kkr#;
866
867 fi
868
869 bye.
870