Debian Codegraph @

texmf-dist/fonts/source/public/knuth-local/domino.mf

raw
1 % a font for double-9 dominoes
2 % initially designed to work best on 300dpi printer
3
4 % Example: To typeset a 2x3 array containing a vertical "1 over 2"
5 % followed by horizontal "3 4" over horizontal "5 6", say
6 % \obeylines \catcode`\^=12 \offinterlineskip
7 % ^1<3>4
8 % v2<5>6
9
10 % One can also typeset individual half dominoes without boundaries
11
12 % Note: The "real" dominoes (made in Taiwan) have slightly different
13 % proportions, more or less as if the centers were at 17,32,47 instead
14 % instead of 16,32,48. But the present scheme seems mathematically better.
15 mode_setup;
16 p#:=in#/300;
17 %d#:=64p#;
18 d#:=63p#; % changed September 2016 (makes the font slightly smaller)
19 define_pixels(p);
20
21 font_identifier:="DOMINO";
22 font_coding_scheme:="dominoes";
23 font_size:=10pt#;
24 font_quad:=d#;
25 font_normal_space:=d#;
26
27 pickup pencircle scaled .5p; tiny_pen=savepen;
28 pickup pencircle scaled 13p; huge_pen=savepen;
29 % I first tried 15p, and it looked OK, but the Taiwan set has smaller dots
30
31 def begindomchar(expr code)=
32 beginchar(code,d#,d#,0);
33 pickup tiny_pen;
34 % for x=0 step 2p until 60p:
35 % drawdot (x+.5p,1.5p); drawdot (x+1.5p,.5p);
36 % drawdot (.5p,x+3.5p); drawdot (1.5p,x+2.5p);
37 % drawdot (w-1.5p,x+1.5p); drawdot (w-.5p,x+.5p);
38 % drawdot (x+2.5p,h-.5p); drawdot (x+3.5p,h-1.5p);
39 % September 2016: that approach gave bad effect at join between domino halves
40 for x=0 step 3p until 57p:
41 drawdot (x+1.5p,1.5p);
42 drawdot (w-1.5p,x+1.5p);
43 drawdot (w-1.5p-x,h-1.5p);
44 drawdot (1.5p,h-1.5p-x);
45 endfor
46 % fill (2p,2p)--(w-2p,2p)--(w-2p,h-2p)--(2p,h-2p)--cycle;
47 fill (3p,3p)--(w-3p,3p)--(w-3p,h-3p)--(3p,h-3p)--cycle;
48 pickup huge_pen;
49 enddef;
50
51 def dota = erase drawdot(16p,47p) enddef;
52 def dotb = erase drawdot(31.5p,47p) enddef;
53 def dotc = erase drawdot(47p,47p) enddef;
54 def dotd = erase drawdot(16p,31.5p) enddef;
55 def dote = erase drawdot(31.5p,31.5p) enddef;
56 def dotf = erase drawdot(47p,31.5p) enddef;
57 def dotg = erase drawdot(16p,16p) enddef;
58 def doth = erase drawdot(31.5p,16p) enddef;
59 def doti = erase drawdot(47p,16p) enddef;
60
61 def v(expr code)=128+ASCII code enddef;
62 % change character code for vertical format
63
64 begindomchar("0"); endchar;
65 begindomchar("1"); dote; endchar;
66 %begindomchar("2"); dotc; dotg; endchar;
67 %begindomchar(v("2")); dota; doti; endchar; % in vertical position
68 %begindomchar("3"); dotc; dote; dotg; endchar;
69 %begindomchar(v("3")); dota; dote; doti; endchar; % in vertical position
70 begindomchar("2"); dota; doti; endchar;
71 begindomchar(v("2")); dotc; dotg; endchar; % in vertical position
72 begindomchar("3"); dota; dote; doti; endchar;
73 begindomchar(v("3")); dotc; dote; dotg; endchar; % in vertical position
74 begindomchar("4"); dota; dotc; dotg; doti; endchar;
75 begindomchar("5"); dota; dotc; dote; dotg; doti; endchar;
76 begindomchar("6"); dota; dotb; dotc; dotg; doth; doti; endchar;
77 begindomchar(v("6")); dota; dotc; dotd; dotf; dotg; doti; endchar; % vert
78 begindomchar("7"); dota; dotb; dotc; dote; dotg; doth; doti; endchar;
79 begindomchar(v("7")); dota; dotc; dotd; dote; dotf; dotg; doti; endchar; % vert
80 begindomchar("8"); dota; dotb; dotc; dotd; dotf; dotg; doth; doti; endchar;
81 begindomchar("9"); dota; dotb; dotc; dotd; dote; dotf; dotg; doth; doti;
82 endchar;
83
84 beginchar("<",d#,d#,0); % outline of left half
85 % fill (w-2.5p,h-2p)--(w+2.5p,h-2p)--(w+2.5p,2p)--(w-2.5p,2p)--cycle;
86 fill (w-3.5p,h-3p)--(w+3.5p,h-3p)--(w+3.5p,3p)--(w-3.5p,3p)--cycle;
87 endchar;
88 beginchar(">",d#,d#,0); % outline of right half
89 % fill (-2.5p,h-2p)--(2.5p,h-2p)--(2.5p,2p)--(-2.5p,2p)--cycle;
90 fill (-3.5p,h-3p)--(3.5p,h-3p)--(3.5p,3p)--(-3.5p,3p)--cycle;
91 endchar;
92 beginchar("^",d#,d#,0); % outline of top half
93 % fill (2p,-2.5p)--(2p,2.5p)--(w-2p,2.5p)--(w-2p,-2.5p)--cycle;
94 fill (3p,-3.5p)--(3p,3.5p)--(w-3p,3.5p)--(w-3p,-3.5p)--cycle;
95 endchar;
96 beginchar("v",d#,d#,0); % outline of bottom half
97 % fill (2p,h-2.5p)--(2p,h+2.5p)--(w-2p,h+2.5p)--(w-2p,h-2.5p)--cycle;
98 fill (3p,h-3.5p)--(3p,h+3.5p)--(w-3p,h+3.5p)--(w-3p,h-3.5p)--cycle;
99 endchar;
100
101 ligtable "^": "v": "2" |=: v("2"), v("2") kern-d#,
102 "3" |=: v("3"), v("3") kern-d#,
103 "6" |=: v("6"), v("6") kern-d#,
104 "7" |=: v("7"), v("7") kern-d#, skipto 1;
105 ligtable "<": ">": "2" kern-d#, "3" kern-d#, "6" kern-d#, "7" kern-d#, 1::
106 "0" kern-d#, "1" kern-d#, "4" kern-d#, "5" kern-d#, "8" kern-d#, "9" kern-d#;
107
108 end.