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