| 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
% File: clock.mf |
| 3 |
% Date: April 10, 2001 |
| 4 |
% Author: Oliver Corff |
| 5 |
% (c) 2001 Ulaanbaatar, Beijing, Berlin |
| 6 |
% |
| 7 |
% A metafont for providing the clock to LaTeX-users. |
| 8 |
% |
| 9 |
% Usage: see package clock |
| 10 |
% |
| 11 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 12 |
%%%% This font contains characters for hands and dials. %%%%% |
| 13 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 14 |
|
| 15 |
mode_setup; |
| 16 |
mg:=4/4; |
| 17 |
thin#:=mg*1pt#; |
| 18 |
width#:=mg*16pt#; |
| 19 |
height#:=mg*12pt#; |
| 20 |
depth#:=mg*4pt#; |
| 21 |
margin#:=mg*1.05pt#; |
| 22 |
|
| 23 |
define_pixels(width,height,depth,thin,margin); |
| 24 |
|
| 25 |
font_size = 10pt#; |
| 26 |
|
| 27 |
font_x_height = 16pt#; |
| 28 |
% font_quad = 16pt#; |
| 29 |
font_normal_space = 0pt#; |
| 30 |
font_extra_space = 0pt#; |
| 31 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 32 |
% |
| 33 |
% All sorts of clock parts |
| 34 |
% |
| 35 |
def MinuteHand (expr minutes) = % Minutenzeiger |
| 36 |
z1=(w/2,1/2(h-d)); |
| 37 |
z2=(w/2,27/36h-margin); |
| 38 |
pickup pencircle scaled 1/2thin; % rotated (-minutes*6); |
| 39 |
draw (z1--z2) rotatedabout (z1,-minutes*6); |
| 40 |
enddef; |
| 41 |
|
| 42 |
def HourHand (expr minutes) = % Stundenzeiger |
| 43 |
z1=(w/2,1/2(h-d)); |
| 44 |
z2=(w/2,24/36h-margin); |
| 45 |
pickup pencircle scaled 9/16thin; % rotated (-minutes*6); |
| 46 |
draw (z1--z2) rotatedabout (z1,-minutes*6); |
| 47 |
enddef; |
| 48 |
|
| 49 |
def Hands (expr minutes) = % Beide Zeiger |
| 50 |
% |
| 51 |
beginchar(minutes+64,width#,height#,depth#); |
| 52 |
MinuteHand(minutes); |
| 53 |
endchar; |
| 54 |
% |
| 55 |
beginchar(minutes+128,width#,height#,depth#); |
| 56 |
HourHand(minutes); |
| 57 |
endchar; |
| 58 |
enddef; |
| 59 |
|
| 60 |
def NESW = |
| 61 |
% This routine places ticks at 12, 3, 6 and 9 o'clock |
| 62 |
for l = 0,3,6,9: |
| 63 |
top z5=(w/2,h-margin); |
| 64 |
z7=(w/2,1/2(h-d)); |
| 65 |
z6=6/36[z5,z7]; |
| 66 |
draw (z5--z6) rotatedabout (z7,-l*30); |
| 67 |
endfor; |
| 68 |
enddef; |
| 69 |
|
| 70 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 71 |
% |
| 72 |
% All sorts of dials |
| 73 |
% |
| 74 |
beginchar("0",width#,height#,depth#); |
| 75 |
top z1=(0.5w,h-margin); % 12 Uhr |
| 76 |
rt z2=(w-margin,0.5(h-d)); % 3 Uhr |
| 77 |
bot z3=(x1,-d+margin); % 6 Uhr |
| 78 |
lft z4=(0+margin,y2); % 9 Uhr |
| 79 |
|
| 80 |
pickup pencircle scaled 1/2thin; |
| 81 |
draw z1...z2...z3...z4...cycle; |
| 82 |
endchar; |
| 83 |
% |
| 84 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 85 |
% |
| 86 |
beginchar("1",width#,height#,depth#); |
| 87 |
% |
| 88 |
% "Standard", or "Classical" dial |
| 89 |
% with indications for every hour |
| 90 |
% |
| 91 |
pickup pencircle scaled 5/8thin; |
| 92 |
NESW; |
| 93 |
|
| 94 |
pickup pencircle scaled 2/4thin; |
| 95 |
for l = 1,2,4,5,7,8,10,11: |
| 96 |
numeric x[]; |
| 97 |
numeric y[]; |
| 98 |
top z5=(w/2,h-margin); |
| 99 |
z7=(w/2,1/2(h-d)); |
| 100 |
z6=3/36[z5,z7]; |
| 101 |
draw (z5--z6) rotatedabout (z7,-l*30); |
| 102 |
endfor; |
| 103 |
endchar; |
| 104 |
% |
| 105 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 106 |
% |
| 107 |
beginchar("2",width#,height#,depth#); |
| 108 |
% |
| 109 |
% A rather minimalist dial, with |
| 110 |
% just a dot marking each hour |
| 111 |
% |
| 112 |
pickup pencircle scaled 2/4thin; |
| 113 |
for l = 0 step 1 until 11: |
| 114 |
top z2=(w/2,h-margin-6/8thin); |
| 115 |
z1=(w/2,1/2(h-d)); |
| 116 |
drawdot(z2) rotatedabout (z1,-l*30); |
| 117 |
endfor; |
| 118 |
endchar; |
| 119 |
% |
| 120 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 121 |
% |
| 122 |
beginchar("3",width#,height#,depth#); |
| 123 |
% A radically minimalist dial |
| 124 |
pickup pencircle scaled 5/8thin; |
| 125 |
NESW; |
| 126 |
endchar; |
| 127 |
% |
| 128 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 129 |
% |
| 130 |
% The true center of activity: |
| 131 |
% create both hands at the same time |
| 132 |
% |
| 133 |
for minutes = 0 step 1 until 59: |
| 134 |
Hands(minutes); |
| 135 |
endfor; |
| 136 |
end. |
| 137 |
|