% a font for double-9 dominoes
% initially designed to work best on 300dpi printer
% Example: To typeset a 2x3 array containing a vertical "1 over 2"
% followed by horizontal "3 4" over horizontal "5 6", say
% \obeylines \catcode`\^=12 \offinterlineskip
% ^1<3>4
% v2<5>6
% One can also typeset individual half dominoes without boundaries
% Note: The "real" dominoes (made in Taiwan) have slightly different
% proportions, more or less as if the centers were at 17,32,47 instead
% instead of 16,32,48. But the present scheme seems mathematically better.
mode_setup;
p#:=in#/300;
%d#:=64p#;
d#:=63p#; % changed September 2016 (makes the font slightly smaller)
define_pixels(p);
pickup pencircle scaled .5p; tiny_pen=savepen;
pickup pencircle scaled 13p; huge_pen=savepen;
% I first tried 15p, and it looked OK, but the Taiwan set has smaller dots
def begindomchar(expr code)=
beginchar(code,d#,d#,0);
pickup tiny_pen;
% for x=0 step 2p until 60p:
% drawdot (x+.5p,1.5p); drawdot (x+1.5p,.5p);
% drawdot (.5p,x+3.5p); drawdot (1.5p,x+2.5p);
% drawdot (w-1.5p,x+1.5p); drawdot (w-.5p,x+.5p);
% drawdot (x+2.5p,h-.5p); drawdot (x+3.5p,h-1.5p);
% September 2016: that approach gave bad effect at join between domino halves
for x=0 step 3p until 57p:
drawdot (x+1.5p,1.5p);
drawdot (w-1.5p,x+1.5p);
drawdot (w-1.5p-x,h-1.5p);
drawdot (1.5p,h-1.5p-x);
endfor
% fill (2p,2p)--(w-2p,2p)--(w-2p,h-2p)--(2p,h-2p)--cycle;
fill (3p,3p)--(w-3p,3p)--(w-3p,h-3p)--(3p,h-3p)--cycle;
pickup huge_pen;
enddef;
beginchar("<",d#,d#,0); % outline of left half
% fill (w-2.5p,h-2p)--(w+2.5p,h-2p)--(w+2.5p,2p)--(w-2.5p,2p)--cycle;
fill (w-3.5p,h-3p)--(w+3.5p,h-3p)--(w+3.5p,3p)--(w-3.5p,3p)--cycle;
endchar;
beginchar(">",d#,d#,0); % outline of right half
% fill (-2.5p,h-2p)--(2.5p,h-2p)--(2.5p,2p)--(-2.5p,2p)--cycle;
fill (-3.5p,h-3p)--(3.5p,h-3p)--(3.5p,3p)--(-3.5p,3p)--cycle;
endchar;
beginchar("^",d#,d#,0); % outline of top half
% fill (2p,-2.5p)--(2p,2.5p)--(w-2p,2.5p)--(w-2p,-2.5p)--cycle;
fill (3p,-3.5p)--(3p,3.5p)--(w-3p,3.5p)--(w-3p,-3.5p)--cycle;
endchar;
beginchar("v",d#,d#,0); % outline of bottom half
% fill (2p,h-2.5p)--(2p,h+2.5p)--(w-2p,h+2.5p)--(w-2p,h-2.5p)--cycle;
fill (3p,h-3.5p)--(3p,h+3.5p)--(w-3p,h+3.5p)--(w-3p,h-3.5p)--cycle;
endchar;