Switch from tracing with autotrace to potrace
[gilgal.git] / gilgal.mf
blob376b747034e5535cd745b0504df286e98364fef7
1 % Gilgal
3 % by Gary Wong 2023, Open Font Licence 1.1.
4 % https://openfontlicense.org/
6 % A replica of the neo-grotesque monoline small cap sans-serif typeface
7 % inscribed by Thomas Child at Gilgal Sculpture Garden.
9 if unknown ht#:
11 % Parameters:
12 font_size 10pt#; % design size
13 autorounding:=0;
14 smoothing:=1;
15 ht#:=7pt#;
16 fcht#:=8.5pt#; % full cap height
17 scht#:=7pt#; % small cap height
18 u#:=0.5pt#; % general unit
19 s#:=0.5pt#; % spacing
20 o#:=0.1pt#; % overshoot
21 ho#:=o#; % horizontal overshoot
22 px#:=0.67pt#; % pen scale
23 punct#:=1pt#; % punctuation pen scale
24 arch_depth=0.3; % depth of arches on AMNOUW
25 arch_tension=0.8; % tension of arches on AMNOUW
26 bowl_tension=0.8; % tension of outer stroke of bowls on BPR
27 min_tension=0.75; % minimum possible tension
28 asymm:=0.05; % asymmetry
29 boolean angle_nu;
30 angle_nu:=false; % whether the slightly stressed spurs on n and u should
31                  % deviate from the vertical
32 lstem#:=u#+s#; % left stem location
35 mode_setup;
37 define_pixels(ht,fcht,scht,u,s);
38 define_blacker_pixels(px,punct);
40 pickup pencircle scaled px; basepen:=savepen;
41 pickup pensquare scaled px; squarepen:=savepen;
43 define_good_x_pixels(lstem);
44 define_corrected_pixels(o);
45 define_horizontal_corrected_pixels(ho);
47 for smallcap=true,false:
49 if smallcap:
50   topbar:=good.y( (0.5+asymm)*scht );
51   botbar:=good.y( (0.5-asymm)*scht );
52 else:
53   topbar:=good.y( (0.5+asymm)*fcht );
54   botbar:=good.y( (0.5-asymm)*fcht );
57 def beginscchar( expr code, unit_width, need_mid ) =
58   beginchar( code, if smallcap: unit_width*u# else: unit_width*1.15*u# fi,
59              if smallcap: scht# else: fcht# fi,0 );
60   if smallcap: charcode:=charcode + ASCII"a" - ASCII"A"; fi
61   pickup basepen;
62   if need_mid:
63     if 0.5w <> good.x 0.5w:
64       change_width;
65     fi
66   fi
67   save mid;
68   mid=0.5w;
69   save rstem;
70   rstem=good.x( w-lstem );
71   for i=lstem,mid,rstem: proofrule( (i,0), (i,h) ); endfor
72   for i=botbar, topbar: proofrule( (0,i), (w,i) ); endfor
73   ( if smallcap: "Small capital " else: "Capital " fi ) & code;
74 enddef;
76 def endscchar =
77   save i;
78   i:=1;
79   forever:
80     exitif not known x[i];
81     makelabel(decimal i,z[i]);
82     i:=i+1;
83   endfor;
84   endchar;
85 enddef;
87 % Letters:
89 beginscchar("A",10,false); % --- A ---
91 x1=x2=lstem;
92 x3=mid;
93 x4=x5=rstem;
94 y1=y5=0;
95 y2=y4=(1-arch_depth)*h;
96 top y3=h+o;
98 cutdraw z1..{up}z2..tension arch_tension..z3..tension arch_tension..{down}z4..z5;
100 x6=lstem;
101 x7=rstem;
102 y6=y7=topbar;
104 draw z6--z7;
106 endscchar;
108 beginscchar("B",10,false); % --- B ---
110 x1=x3=x4=lstem;
111 x2=0.9[x1,x6];
112 x6=rstem+ho;
113 top y1=h;
114 y2=0.45[y1,y3];
115 y3=botbar;
116 bot y4=0;
117 y6=0.5[y5,y4];
119 path p;
120 p=z1{right}..tension min_tension and bowl_tension..z2{down}..tension bowl_tension and 3..z3;
121 draw p;
122 z5=point 1.4 of p;
123 draw z5..tension bowl_tension..{down}z6..tension 1 and min_tension..{left}z4;
125 pickup squarepen;
126 draw z1--z4;
128 endscchar;
130 beginscchar("C",10,false); % --- C ---
132 x1=rstem;
133 x2=x4=0.6[lstem,rstem];
134 x3=lstem-o;
135 x5=1.05[lstem,rstem];
136 y1=0.9h;
137 top y2=h+o;
138 y3=0.5[y2,y4];
139 bot y4=-o;
140 y5=0.07h;
142 cutdraw z1..{left}z2..{down}z3..z4{right}..z5;
144 endscchar;
146 beginscchar("D",10.5,false); % --- D ---
148 x1=x2=lstem;
149 x3=x5=0.2[x1,x4];
150 x4=rstem+ho;
151 top y1=h;
152 bot y2=0;
153 y3=y1;
154 y5=y2;
155 y4=0.5[y1,y2];
157 draw z1..z3{right}..tension 0.85..z4..tension 0.85..z5{left}..z2;
159 pickup squarepen;
160 draw z1--z2;
162 endscchar;
164 beginscchar("E",9,false); % --- E ---
166 pickup squarepen;
168 x1=0.86[lstem,rstem];
169 x4=rstem;
170 x2=x3=x5=lstem;
171 x6=0.72[lstem,rstem];
172 top y1=top y2=h;
173 bot y3=bot y4=0;
174 y5=y6=topbar;
176 draw z1--z2--z3--z4;
177 draw z5--z6;
179 endscchar;
181 beginscchar("F",9,false); % --- F ---
183 pickup squarepen;
185 x1=rstem;
186 x2=x3=x4=lstem;
187 x5=0.72[lstem,rstem];
188 top y1=top y2=h;
189 bot y3=0;
190 y4=y5=topbar;
192 draw z1--z2--z3;
193 draw z4--z5;
195 endscchar;
197 beginscchar("G",11,false); % --- G ---
199 x1=x6=x7=rstem;
200 x5=0.9[lstem,rstem];
201 x2=x4=0.6[x3,x7];
202 x3=lstem-o;
203 y1=0.9h;
204 top y2=h+o;
205 y3=0.5[y2,y4];
206 bot y4=-o;
207 y5=0.07[y4,y7];
208 y6=0.18[y4,y7];
209 y7=botbar;
211 cutdraw z1..{left}z2..z3..z4{right}..z5..z6--z7;
213 endscchar;
215 beginscchar("H",10,false); % --- H ---
217 pickup squarepen;
219 x1=x2=x5=lstem;
220 x3=x4=x6=rstem;
221 top y1=top y3=h;
222 bot y2=bot y4=0;
223 y5=y6=topbar;
225 draw z1--z2;
226 draw z3--z4;
227 draw z5--z6;
229 endscchar;
231 beginscchar("I",5,true); % --- I ---
233 pickup squarepen;
235 x1=x2=mid;
236 bot y1=0;
237 top y2=h;
239 draw z1--z2;
241 endscchar;
243 beginscchar("J",9,true); % --- J ---
245 x1=x2=rstem;
246 x3=mid;
247 x4=lstem;
248 y1=h;
249 y2=0.2[y3,y1];
250 bot y3=0;
251 y4=0.07[y3,y1];
253 cutdraw z1{down}..z2{down}..z3{left}..z4;
255 endscchar;
257 beginscchar("K",10,false); % --- K ---
259 x1=x4=rstem;
260 x2=x5=x6=lstem;
261 x3=0.4[x2,x1];
262 y1=top y5=h;
263 y4=bot y6=0;
264 y2=botbar;
265 y3=topbar;
266 draw z1{dir -100}..z3..z2;
267 cutoff(z1,90);
268 draw z3..{dir -80}z4;
269 cutoff(z4,-90);
271 pickup squarepen;
272 draw z5--z6;
274 endscchar;
276 beginscchar("L",9,false); % --- L ---
278 pickup squarepen;
280 x1=x2=lstem;
281 x3=rstem;
282 top y1=h;
283 bot y2=bot y3=0;
285 draw z1--z2--z3;
287 endscchar;
289 beginscchar("M",14,true); % --- M ---
291 x1=x2=lstem;
292 x3=0.5[x1,x4];
293 x4=x5=mid;
294 x6=0.5[x5,x7];
295 x7=x8=rstem;
297 y1=y5=y8=0;
298 top y3=top y6=h+o;
299 y2=y4=y7=(1-arch_depth)*h;
301 cutdraw z1..{up}z2..tension arch_tension..z3..tension arch_tension..{down}z4..z5;
302 cutdraw z5..{up}z4..tension arch_tension..z6..tension arch_tension..{down}z7..z8;
304 endscchar;
306 beginscchar("N",10,false); % --- N ---
308 x1=x2=lstem;
309 x3=mid;
310 x4=x5=rstem;
311 y1=y5=0;
312 y2=y4=(1-arch_depth)*h;
313 top y3=h+o;
315 cutdraw z1..{up}z2..tension arch_tension..z3..tension arch_tension..{down}z4..z5;
317 if angle_nu:
319 x6=lstem-0.7px;
320 x7=lstem;
321 x8=lstem+0.5px;
322 y6=y7=h;
323 y8=h-0.8px;
324 fill z2--z6--z7--z8--cycle;
326 else:
328 y6=y7=y2;
329 x6=x2-0.5px;
330 x7=x2+0.5px;
331 x8=x6;
332 x9=0.5[x8,x10];
333 x10=x7;
334 y8=y9=h;
335 y9-y10=x10-x9;
336 fill z8--z9--z10--z7--z6--cycle;
340 endscchar;
342 beginscchar("O",10,false); % --- O ---
344 x1=x4=mid;
345 x2=x3=rstem;
346 x5=x6=lstem;
347 top y1=h+o;
348 y2=y6=(1-arch_depth)*h;
349 y3=y5=arch_depth*h;
350 bot y4=-o;
352 draw z1..tension arch_tension..{down}z2--z3{down}..tension arch_tension..z4..tension arch_tension..{up}z5--z6{up}..tension arch_tension..cycle;
354 endscchar;
356 beginscchar("P",10,false); % --- P ---
358 x1=x3=x4=lstem;
359 x2=rstem+ho;
360 top y1=h;
361 y2=0.45[y1,y3];
362 y3=botbar;
363 bot y4=0;
365 draw z1{right}..tension min_tension and bowl_tension..z2{down}..tension bowl_tension and infinity..z3;
367 pickup squarepen;
368 draw z1--z4;
370 endscchar;
372 beginscchar("Q",11,false); % --- Q ---
374 x1=x4=0.5[x2,x5];
375 x2=x3=0.95[lstem,rstem];
376 x5=x6=lstem;
377 top y1=h+o;
378 y2=y6=(1-arch_depth)*h;
379 y3=y5=arch_depth*h;
380 bot y4=-o;
382 draw z1..tension arch_tension..{down}z2--z3{down}..tension arch_tension..z4..tension arch_tension..{up}z5--z6{up}..tension arch_tension..cycle;
384 pickup pencircle scaled 0.4px;
386 x7=0.2[mid,rstem];
387 x8=x9=rstem+px;
388 y7=3px;
389 y8=0.9px;
390 y9=0;
391 filldraw z7--z8--z9--cycle;
393 endscchar;
395 beginscchar("R",10,false); % --- R ---
397 x1=x3=x4=lstem;
398 x2=rstem+ho;
399 x6=rstem;
400 top y1=h;
401 y2=0.45[y1,y3];
402 y3=botbar;
403 bot y4=0;
404 y6=0;
406 path p;
407 p=z1{right}..tension min_tension and bowl_tension..z2{down}..tension bowl_tension and infinity..z3;
408 draw p;
409 z5=point 1.45 of p;
410 draw z5--z6;
411 cutoff(z6,-90);
413 pickup squarepen;
414 draw z1--z4;
416 endscchar;
418 beginscchar("S",10,false); % --- S ---
420 x1=0.92[x3,x4];
421 x2=x5=0.5[x1,x3];
422 x3=lstem;
423 x4=rstem;
424 x6=lstem-0.5u;
425 y1=0.9[y5,y2];
426 y3=(0.8+0.5asymm)[y5,y2];
427 top y2=h+o;
428 y4=(0.2+1.5asymm)[y5,y2];
429 y6=0.15[y5,y2];
430 bot y5=-o;
432 draw z1..z2{left}..z3{down}..tension 1.2..z4{down}..tension 0.85 and 1..z5{left}..z6;
433 pickup squarepen; cutoff(z1,-45); cutoff(z6,135);
435 endscchar;
437 beginscchar("T",9,true); % --- T ---
439 pickup squarepen;
441 x1=lstem-0.5u;
442 x2=rstem+0.5u;
443 x3=x4=mid;
444 top y1=top y2=top y3=h;
445 bot y4=0;
447 draw z1--z2;
448 draw z3--z4;
450 endscchar;
452 beginscchar("U",10,false); % --- U ---
454 x1=x2=rstem;
455 x3=mid;
456 x4=x5=lstem;
457 y1=y5=h;
458 y2=y4=arch_depth*h;
459 bot y3=-o;
461 cutdraw z1..{down}z2..tension arch_tension..z3..tension arch_tension..{up}z4..z5;
463 if angle_nu:
465 x6=rstem+0.7px;
466 x7=rstem;
467 x8=rstem-0.5px;
468 y6=y7=0;
469 y8=0.8px;
470 fill z2--z6--z7--z8--cycle;
472 else:
474 y6=y7=y2;
475 x6=x2+0.5px;
476 x7=x2-0.5px;
477 x8=x6;
478 x9=0.5[x8,x10];
479 x10=x7;
480 y8=y9=0;
481 y9-y10=x10-x9;
482 fill z8--z9--z10--z7--z6--cycle;
486 endscchar;
488 beginscchar("V",10,false); % --- V ---
490 x1=lstem;
491 x2=x3=rstem;
492 y1=top y3=h;
493 bot y2=0;
495 cutdraw z1{down}..{right}z2;
497 pickup squarepen;
499 draw z2--z3;
501 endscchar;
503 beginscchar("W",14,true); % --- W ---
505 x1=x2=lstem;
506 x3=0.5[x1,x4];
507 x4=x5=mid;
508 x6=0.5[x5,x7];
509 x7=x8=rstem;
511 y1=y5=y8=h;
512 bot y3=bot y6=-o;
513 y2=y4=y7=arch_depth*h;
515 draw z1..{down}z2..tension arch_tension..z3..tension arch_tension..{up}z4..z5;
516 cutoff(z1,90); cutoff(z5,90);
517 draw z5..{down}z4..tension arch_tension..z6..tension arch_tension..{up}z7..z8;
518 cutoff(z5,90); cutoff(z8,90);
520 endscchar;
522 beginscchar("X",11,false); % --- X ---
524 x1=0.03[lstem,rstem];
525 x2=0.97[lstem,rstem];
526 x3=(-0.03)[lstem,rstem];
527 x4=1.03[lstem,rstem];
528 y1=y2=h;
529 y3=y4=0;
531 cutdraw z1{down}..{down}z4;
532 cutdraw z2{down}..{down}z3;
534 endscchar;
536 beginscchar("Y",11.5,false); % --- Y ---
538 x1=lstem;
539 x2=0.85[x1,x3];
540 x3=rstem;
541 x4=0.1[x1,x3];
542 y1=y3=h;
543 y2=0.7[y4,botbar];
544 bot y4=0;
546 draw z1{down}..z2;
547 cutoff(z1,90);
548 draw z3{down}..tension 0.8 and 1.2..z2..tension 0.8..{left}z4;
549 cutoff(z3,90); cutoff(z4,180);
551 endscchar;
553 beginscchar("Z",10,false); % --- Z ---
555 x1=x3=lstem;
556 x2=x4=rstem;
557 top y1=top y2=h;
558 bot y3=bot y4=0;
560 draw z1{right}..{right}z2{down}..{down}z3{right}..{right}z4;
561 cutoff(z1,180); cutoff(z4,0);
563 endscchar;
565 endfor
567 beginchar(".",4u#,3u#,0); % --- . ---
569 "Puncuation `.'";
571 pickup pencircle scaled punct;
573 x1=0.5w;
574 bot y1=0;
576 drawdot z1;
577 labels(1);
579 endchar;
581 beginchar(",",4u#,3u#,3u#); % --- , ---
583 "Puncuation `,'";
585 pickup pencircle scaled punct;
587 x1=0.5w;
588 x2=x1+pen_rt;
589 x3=x1+pen_lft;
590 bot y1=bot y2=0;
591 y3=pen_bot-pen_top;
593 drawdot z1;
595 fill z3{curl1}..{up}z1..z2{down}..cycle;
597 labels(1,2,3);
599 endchar;
601 beginchar(";",4u#,10u#,3u#); % --- ; ---
603 "Puncuation `;'";
605 pickup pencircle scaled punct;
607 x1=x2=0.5w;
608 x3=x1+pen_rt;
609 x4=x1+pen_lft;
610 y1=(0.5-asymm)*scht;
611 bot y2=bot y3=0;
612 y4=pen_bot-pen_top;
614 drawdot z1;
616 drawdot z2;
618 fill z4{curl1}..{up}z2..z3{down}..cycle;
620 labels(1,2,3,4);
622 endchar;
624 beginchar("'",4u#,fcht#,0); % --- ' ---
626 "Puncuation '";
628 pickup pencircle scaled punct;
630 x1=0.5w;
631 x2=x1+pen_rt;
632 x3=x1+pen_lft;
633 y1=y2=scht;
634 y3=y2+pen_bot-pen_top;
636 drawdot z1;
638 fill z3{curl1}..{up}z1..z2{down}..cycle;
640 labels(1,2,3);
642 endchar;
644 beginchar("!",4u#,scht#,0); % --- ! ---
646 "Puncuation !";
648 pickup pencircle scaled punct;
650 x1=x2=x3=0.5w;
651 bot y1=0;
653 drawdot z1;
654 labels(1);
656 y2=scht-0.5px;
657 y3=0.5[y1,y2];
659 fill z3{(-1,3)}..tension 2 and 1.5..z2{right}..tension 1.5 and 2..z3{(-1,-3)}..cycle;
661 labels(2,3);
663 endchar;
665 % The following glyphs were added by extrapolating from others; no direct
666 % source references for the shapes are known.
668 beginchar(":",4u#,10u#,0); % --- : --- 
670 "Puncuation `:'";
672 pickup pencircle scaled punct;
674 x1=x2=0.5w;
675 y1=(0.5-asymm)*scht;
676 bot y2=0;
678 drawdot z1;
679 drawdot z2;
681 labels(1,2);
683 endchar;
685 beginchar("/",9u#,fcht#,0); % --- / --- 
687 "Puncuation `/'";
689 z1=(u,0);
690 z2=(w-u,h);
692 pickup pencircle scaled px;
693 cutdraw z1..z2;
695 labels(1,2);
697 endchar;
699 beginchar("(",8u#,fcht#,0); % --- ( --- 
701 "Puncuation `('";
703 z1=(w-s-0.5u,h);
704 z2=(s+u,0.5[y1,y3]);
705 z3=(x1,0);
707 pickup pencircle scaled px;
708 cutdraw z1..z2{down}..z3;;
710 labels(1,2,3);
712 endchar;
714 beginchar(")",8u#,fcht#,0); % --- ) --- 
716 "Puncuation `)'";
718 z1=(s+0.5u,h);
719 z2=(w-s-u,0.5[y1,y3]);
720 z3=(x1,0);
722 pickup pencircle scaled px;
723 cutdraw z1..z2{down}..z3;;
725 labels(1,2,3);
727 endchar;
729 ligtable "F":
730   "o" kern -u#;
732 ligtable "T":
733   "a" kern -0.5u#;
735 ligtable "c":
736   "o" kern -0.5u#,
737   "y" kern -0.5u#;
739 ligtable "e":
740   "e" kern -0.5u#,
741   "s" kern -0.5u#,
742   "x" kern -0.5u#;
744 ligtable "f":
745   "i" kern -u#,
746   "o" kern -u#;
748 ligtable "l":
749   "o" kern -1.5u#,
750   "y" kern -2u#;
752 ligtable "m":
753   "y" kern -0.5u#;
755 ligtable "s":
756   "t" kern -u#,
757   "y" kern -0.5u#;
759 ligtable "t":
760   "o" kern -0.5u#;
762 ligtable "y":
763   "o" kern -0.5u#;
765 font_quad 18u#+2s#;
766 font_normal_space 4u#+2s#;
767 font_normal_stretch 3u#;
768 font_normal_shrink 2u#;
769 font_identifier "Gilgal";
770 font_coding_scheme "OT1";
771