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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
% mafigs.mf 1.2.0 1994/10/11 -- program file for figures
% Copyright 1991, 1992, 1993 P. Damian Cugley.
%%% @METAFONT-file {
%%% filename = "mafigs.mf",
%%% version = "1.2.0",
%%% date = "1994/10/11",
%%% package = "Malvern 1.2",
%%% author = "P. Damian Cugley",
%%% email = "damian.cugley@comlab.ox.ac.uk",
%%% address = "Oxford University Computing Laboratory,
%%% Parks Road, Oxford OX1 3QD, UK",
%%% codetable = "USASCII",
%%% keywords = "Malvern, METAFONT, font, typefont, TeX",
%%% supported = "Maybe",
%%% abstract = "Character programs for the Malvern
%%% font family.",
%%% dependencies = "other program files",
%%% }
% See the Malvern Handbook (maman.tex) for more info about Malvern.
% This software is available freely but without warranty.
% See the file COPYING for details.
% This file is read in more than once in order to create several sets
% of figures: old-style (`text'), ranging, and maybe superior (superscript)
% and inferior (subscript). To do this several parameters set in
% ma.mf must be set correctly.
%{{{ mafigs.mf
%{{{ macro to start each character with
% So that each program can generate `superior' figures as well as
% text and ranging figures, they refer to |fig_b| instead of |-d|.
% For text figures this is set to |-d|. For others it must be set
% before the |input mafigs| command.
string type_of_figs;
type_of_figs :=
if text_figs: "old style"
elseif fig_b > 0: "superior" % footnotes etc.
elseif fig_b < 0: "inferior"
else: "ranging" % fixed width and height
fi;
if (fig_b > 0) or (fig_ht# < x_ht#) and unknown sfig_pn:
small_figs := true;
pickup pencircle xscaled sfig.pn.wd yscaled sfig.pn.ht;
fig_pn := savepen;
fi
def ma_fig(expr num)(expr w_sh, h_sh, d_sh) =
type_of_figs & " figure " & char(ASCII"0" + num);
ma_char(fig_offset + num,
if text_figs: w_sh, h_sh, d_sh
else: fig_wd#, fig_ht#, fig_dp# fi)
(1,1);
if text_figs: fig_b := -d; fi
if known fig_pn: pickup fig_pn; fi
enddef;
%}}}
def hsuper(suffix f, t) =
z.f
... (1/sqrt2)[(x.f, y.t), (x.t, y.f)]{z.t - z.f}
... z.t
enddef;
def vsuper(suffix f, t) =
z.f
... (1/sqrt2)[(x.t, y.f), (x.f, y.t)]{z.t - z.f}
... z.t
enddef;
if testing: endinput; fi
%{{{ 1
% - pdc Mon. 25 Feb. 1991
ma_fig(1, 4u#, x_ht#, 0v#);
top z1 = (hround (1/2w + 1/2u), h + o); bot z2 = (x1, fig_b - o);
z0 = z1 + whatever*ne; x0 = x1 - 2u;
draw z0 -- z1 -- z2;
labels(0,1,2); set_ic_tr;
endchar;
%}}}
%{{{ 0
ma_fig(0, 8u#, x_ht#, 0v#);
top z1 = (1/2[l,r], h + o); bot z4 = (x1, fig_b - o);
lft x2 = lft x3 = l; rt x0 = rt x5 = r;
if x0 - x2 < y1 - y4:
y2 = y0 = 2/3[1/2[fig_b, h] + eps, y1 - 1/2(x0 - x2)];
y3 = y5 = 2/3[1/2[fig_b, h] - eps, y4 + 1/2(x0 - x2)];
draw vsuper(0,1) & hsuper(1,2) --- vsuper(3,4) & hsuper(4,5) --- cycle;
else:
y2 = y0 = 1/2[y4, y1];
draw superellipse(z0, z1, z2, z4)(1/sqrt2);
fi
labels(1, 2, 3, 4, 5, 0); set_ic_tr;
endchar;
%}}}
%{{{ 3 & 5
def draw_fivthree =
rt z4 = (r, 1/2[y3,y5]);
bot z5 = (0.55[r,l], fig_b - o);
bot lft z6 = (l, good.y (fig_b - o + 1/2v));
draw z1 -- z2 -- z3 ... hsuper(3',4){down} & vsuper(4,5){left}
& hsuper(5,6);
labels(1,2,3,3',4,5,6)
enddef;
ma_fig(5, 7.25u#, x_ht#, desc_dp#);
top rt z1 = (good.x 0.8[l,r], h);
top lft z2 = (good.x 0.1[l,r], h);
top y3 + if r - l > 5u: 1/4v else: 1/8v fi = top y3'
= if text_figs: 0.708[fig_b,h] else: 2/3[fig_b,h] fi;
x3 = x2; x3' = x5;
draw_fivthree;
endchar;
ma_fig(3, 7.25u#, x_ht#, desc_dp#);
top lft z1 = (0.05[l,r], h); top rt z2 = (good.x 0.875[l,r], h);
top y3 if r - l > 6u: + 1/6v fi = top y3'
= if text_figs: 0.683[fig_b,h] else: 2/3[fig_b,h] fi;
x3 = max(1/6[l,r] + 1/2pn.wd, min(0.35[l,r], x2 - (y2 - y3)));
x3' = x5;
draw_fivthree;
endchar;
%}}}
%{{{ 7
ma_fig(7, 6.5u#, x_ht#, desc_dp#);
draw bot rt (l,h) -- bot lft (r, h) -- top (good.x 1/3[l,r], fig_b - o);
endchar;
%}}}
%{{{ 4
ma_fig(4, 7u#, x_ht#, 2/3desc_dp#)
top y1 = h + o; x1 = good.x 1/3[l,r];
bot y2 = bot y3 = if text_figs: 0 else: 1/4[fig_b, h] fi;
lft x2 = l; rt x3 = r;
draw z1 -- z2 -- z3;
x4 = x5 = good.x 1/3[r,l];
top y4 = 2/3[fig_b, h];
bot y5 = fig_b - o;
draw z4 -- z5;
labels(1,2,3,4,5);
endchar;
%}}}
%{{{ 2
ma_fig(2, 6u#, x_ht#, 0v#);
lft x1 = l; top y2 = top y1 + if text_figs: 1.25v else: 1.5v fi = h + o;
rt x3 = rt x7 = r; lft x6 = l; bot y6 = bot y7 = fig_b;
x2 = x4 = 0.55[r,l];
y3 = if text_figs: 2/3 else: 0.75 fi [y6, y2];
y4 = 0.55[y6, y3]; %% if text_figs: 3/8 else: 2/5 fi [y6, y2];
z5 = z6 + 1/2pn.ht * up;
draw z1 ... hsuper(2,3)
... z4 ... z5
... {(z6 - z4) yscaled 8} z6 -- z7;
labels(1,2,3,4,5,6,7);
endchar;
%}}}
%{{{ 8
ma_fig(8, 8u#, fig_ht#, 0v#);
bot z3bot = (1/2[l,r], fig_b - o);
lft x2bot = l - ho; rt x0bot = r + ho;
x1bot = x3bot = x1top = x3top = 1/2[x2top, x0top];
y2top = y0top = 1/2[y3top, y1top];
y2bot = y0bot = 1/2[y3bot, y1bot]; top y1top = h + o;
y1bot = y3top = max(0.55[y3bot, y1top],
min(2/3[y3bot, y1top], y3bot + (x0bot - x2bot)));
x2top = max(rt 1/16[l,r], 1/2[l,r] -
1/2(y1top - y3top) * max(1, (x0bot - x2bot)/(y1bot - y3bot)));
draw superellipse(z0bot, z1bot, z2bot, z3bot)(1/sqrt2);
draw superellipse(z0top, z1top, z2top, z3top)(1/sqrt2);
endchar;
%}}}
%{{{ 69
% pdc Wed. 27 Feb. 1991
% tails fixed pdc Tue. 23 Apr. 1991
ma_fig(6, 8u#, fig_ht#, 0v#);
lft x2 = l; rt x0 = r + ho; bot y3 = fig_b - o;
y2 = y0 = 1/2[y1, y3]; x1 = x3 = 1/2[x0, x2];
top z2tail = (1/2[l,r], h + o);
y1 = max(0.55[y3, y2tail], min(3/4[y3, y2tail], y3 + (x0 - x2)));
draw superellipse(z0, z1, z2, z3)(1/sqrt2);
% try to guess the point on bowl where tail connects:
numeric theta;
theta = angle(y1 - y0, (y2tail - y0) +-+ (y1 - y0));
z1tail = (x1, y0) + (y1 - y0) * (dir (theta + 90)
xscaled ((x0 - x2)/(y1 - y3)));
draw z1tail -- z2tail;
labels(0, 1, 2, 3, 1tail, 2tail);
endchar;
ma_fig(9, 8u#, x_ht#, desc_dp#);
lft x2 = l; rt x0 = r + ho; top y1 = h + o;
y2 = y0 = 1/2[y1, y3]; x1 = x3 = 1/2[x0, x2];
bot z2tail = (1/2[l,r], fig_b - o);
y3 = min(0.55[y1, y2tail], max(3/4[y1, y2tail], y1 - (x0 - x2)));
draw superellipse(z0, z1, z2, z3)(1/sqrt2);
% try to guess the point on bowl where tail connects:
numeric theta;
theta = angle(y1 - y0, (y0 - y2tail) +-+ (y1 - y0));
z1tail = (x1, y0) + (y1 - y0) * (dir (theta + 270)
xscaled ((x0 - x2)/(y1 - y3)));
draw z1tail -- z2tail;
labels(0, 1, 2, 3, 1tail, 2tail);
endchar;
%}}}
%}}}
% Local variables:
% fold-folded-p: t
% End:
|