summaryrefslogtreecommitdiff
path: root/fonts/malvern/source/maglcaps.mf
blob: 5e403264a08c7905db6f2b322698f15ee582b378 (plain)
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
% maglcaps.mf 1.2.0 94/10/11 -- caps common to Greek and Latin
% Copyright  1992-4 P. Damian Cugley.

%%% @METAFONT-file {
%%%   filename       = "maglcaps.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       = "Greek/Latin cap. 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.

%{{{ maglcaps.mf

set_cap_widths;

if capmode = 1:
    vardef subst@# suffix $ =
	if unknown code.cap$: code.cap$ := code.gr.cap@#; fi
    enddef;

    subst alpha (a);
    subst beta (b);
    subst chi (x);
    subst epsilon (e);
    subst eta (h);
    subst iota (i);
    subst kappa (k);
    subst mu (m);
    subst nu (n);
    subst omicron (o);
    subst rho (p);
    subst tau (t);
    subst zeta (z);
fi

if testing: endinput fi

%{{{   N

iff known capcode.n: "Capital Nu";
ma_cap(capcode.n, medium_wd# + 2pn_adj#)(1,1);
    box_points; set_ic_tr;
    y1 = y.t + o - (x.r - x.l);
    if y1 < y.b: y1 := y.b; fi
    draw_box_l_o; draw_box_r_o;
    draw (x.l, y.t + o) -- (x.r, y1);
if not no_co:
remember;
    some_cap_marks(0.5[l,r]) N;
fi
endchar;

%}}}
%{{{   H

iff known capcode.h: "Capital Eta";
ma_cap(capcode.h, medium_wd# + 2pn_adj#)(1,1);
    box_points; draw_box_l_o; draw_box_r_o; draw_box_m; set_ic_tr;
if not no_co:
remember;
    some_cap_marks(0.5[l,r]) H;
fi
endchar;

%}}}
%{{{   Z

iff known capcode.z: "Capital Zeta";
ma_cap(capcode.z, medium_wd# + 2pn_adj#)(1/2,1/2);
    box_points; set_ic_tr;
    draw (good.x 1/24[x.l, x.r], y.t)
    	-- (good.x 1/24[x.r, x.l], y.t) -- (x.l, y.b) -- (x.r, y.b);
if not no_co:
remember;
    some_cap_marks(0.5[l,r]) Z;
similarly(code.co.Z.dot); "Cap. Z with dot above";
    charht := mark_t#;
    draw_dot_mark.dot(0.5[l,r], mark_b, dot_wd, mark_ht);
wug;
fi
endchar;

%}}}
%{{{   E

iff known capcode.e: "Capital Epsilon";
ma_cap(capcode.e, narrow_wd# + pn_adj#)(1, 1/2);
    rt x1 = rt x4 = r; lft x2 = lft x3 = lft x1bar = l;
    top y1 = top y2 = h; bot y3 = bot y4 = 0;
    y1bar = y2bar = 0.52h; x2bar = 4/5[l,r];
    draw z1 -- z2 -- z3 -- z4;
    draw z1bar -- z2bar;
    labels(1,2,3,4, 1bar, 2bar);
    set_ic_tr;
remember;
some_cap_marks(0.475[l,r]) E;
endchar;

%}}}
%{{{   A

iff known capcode.a: "Capital Alpha";
ma_cap(capcode.a, wide_wd# + 3pn_adj#)(1/3,1/3);
    A_body(true, false);
remember;
if not no_co:
    some_cap_marks(0.5[l,r]) A;
similarly(code.cap.a.ring); "Cap. A with ring";
    if cap_mark_t - h > 4v:
	draw_clear_ring.ring(1/2[l,r], 1/2[h, cap_mark_t] - 3/2v - eps, 3u, 3v);
    elseif cap_mark_t - h > 3.5v:
	draw_clear_ring.ring(1/2[l,r], h + 1/2v, 3u, 3v);
    else:
	draw_joined_ring.ring(1/2[l,r], h, 3u, min(3v, cap_mark_t - h + pn.ht - o));
    fi
    charht := cap_mark_t#;
wug;
fi
endchar;

%}}}
%{{{   T

iff known capcode.t: "Capital Tau";
ma_cap(capcode.t,medium_wd# + 2pn_adj#)(0,0);
    if 1/2w <> good.x 1/2w: change_width; fi
    lft x1 = w - rt x2 = l - eps; x3 = x4 = 1/2[x1,x2];
    top y1 = top y2 = top y3 = h; bot y4 = -d - o;
    draw z1 -- z2; draw z3 -- z4;
    labels(1,2,3,4); set_ic_tr;
remember;
if not no_co:
    some_cap_marks(0.5[l,r]) T;
fi
similarly(code.cap.t.cedilla); "cap T with cedilla";
    chardp := Cedilla_ht#;  charht := cap_ht#;
    draw_cedilla.cedilla(1/2[l,r], 0, Cedilla_wd, Cedilla_ht);
wug;
endchar;

%}}}
%{{{   O

iff known capcode.o: "Captial Omicron (O)";
ma_char(capcode.o, O_wd#, height#, 0v#)(O_sp, O_sp);
    draw_O; set_ic_O;
if not no_co:
remember;
    some_cap_marks(0.5[l,r]) O;
fi
endchar;

%}}}
%{{{   I

iff known capcode.i: "Capital Iota (I)";
ma_char(capcode.i, pn.wd#, height#, 0pt#)(1,1);
    if 1/2w <> good.x (1/2w): change_width; fi
    draw (1/2w, bot h + o) -- (1/2w, top -d - o); set_ic_tr;
endchar;

if not no_co:
%{{{   composite letters based on I

def do_marked_I(expr code, mark_width_sharp)(text MARK_PROC) text CODA =
    iff known code:
    ma_char(code, max(pn.wd#, mark_width_sharp - sp#), mark_t#, 0v#)(1,1);
	if good.x (1/2[l,r]) <> 1/2[l,r]: change_width; fi
	draw (1/2[l,r], bot (vround height#*vppp)) -- (1/2[l,r], top (0 - o));
	MARK_PROC(1/2[l,r], mark_b,
    	    	  mark_width_sharp * hppp, mark_ht) CODA;
	set_ic_tr;
    endchar;
enddef;

do_marked_I(code.cap.i.acute, max(2pn.wd#, (mark_t# - mark_b#)*hratio))
    (draw_acute_grave) false;
do_marked_I(code.cap.i.grave, max(2pn.wd#, (mark_t# - mark_b#)*hratio))
    (draw_acute_grave) true;
do_marked_I(code.cap.i.twodots, 2dot_wd# + sp#)
    (draw_twodots);
do_marked_I(code.cap.i.circumflex, 
    	max(3pn.wd#, (mark_t# - mark_b#)*hratio - pn.wd#))
    (draw_circumflex) false;
do_marked_I(code.cap.i.breve, 
    	max(3pn.wd#, (mark_t# - mark_b#)*hratio - pn.wd#))
    (draw_breve);
do_marked_I(code.cap.i.dot, dot_wd#)(draw_dot_mark);

%}}}   composite letters based on I
fi

%}}}

if co_only: endinput; fi

%{{{   B, P

iff known capcode.b: "Capital Beta";
ma_cap(capcode.b,max(2pn_wd# + 3u#, narrow_wd# + pn_adj#))(1,0.6);
    numeric mid; mid = good.y (0.55[-d, h]); 
    D_stem; 
    D_bowl.top(h, bot mid, hround 0.9[l,r]); 
    D_bowl.bot(top mid, -d, r); 
    set_ic 0.9h#; charic := max(0, charic - 0.1(r# - l#));
endchar;

iff known capcode.p: "Capital Rho";
ma_cap(capcode.p, max(2pn_wd# + 3u#, narrow_wd# + pn_adj#))(1,1/2); 
    P_stem; D_bowl.bowl(h, hround bot 0.45[-d, h], r); set_ic 0.9h#;
endchar;

%}}}
%{{{   K

iff known capcode.k: "Capital Kappa";
ma_cap(capcode.k, medium_wd# + pn_adj#)(1,1/2);
    box_points;
    z1top = (1/18[x.r, x.l],y.t + o); 
    z2top = z1top + whatever*(hratio, 1); x2top = x.l;
    z1bot = (x.r, y.b - o); 
    z2bot = whatever[z1top, z2top] = z1bot + whatever*(-hratio, 1);
    draw_box_l_o; draw z1top -- z2top; draw z1bot -- z2bot;
    labels(1top, 2top, 1bot, 2bot); set_ic_tr;
endchar;
%}}}
%{{{   M

if known capcode.m:

def do_variant_M(expr code) =
    ma_cap(code, wide_wd# + 3pn_adj#)(1,1);
	if 1/2w <> hround 1/2w: change_width; fi
	box_points; 
	z1 = (x.l, y.t + o); z3 = (x.r, y.t + o);
	x2 = 1/2[x1, x3]; y2 = 1/2[-d, h];
	draw z1 -- z2 -- z3; draw_box_l_o; draw_box_r_o;
	labels(1,2,3); set_ic_tr;
    endchar
enddef;

def do_M(expr code) =
    ma_char(code, width# + 2pn_adj#, height#, 0pt#)(3/4,3/4);
	if 1/2w <> apex.x 1/2w: change_width; fi
	lft x1 = w - rt x5 = l; bot y1 = bot y5 = -d -o;
	top y2 = top y4 = h;
	x3 = 1/2[l, r]; y3 = 0.1[y1, y2];
	x2 = w - x4 = x1 + floor(1/18(r - l));
	draw z1 -- apex_path2 -- vpex_path3 -- apex_path4 -- z5;
	labels(1,2,3,4,5); set_ic_tr;
    endchar
enddef;

if (width# < 7.5pt#):
    do_variant_M(capcode.m);
    if known code.cap.m1: "variant cap. M";
    	do_M(code.cap.m1);
    fi
else:
    do_M(capcode.m);
    if known code.cap.m1: "variant cap. M";
    	do_variant_M(code.cap.m1);
    fi
fi

fi

%}}}  M
%{{{   X 
iff known capcode.x: "Capital Chi";
ma_cap(capcode.x, medium_wd# + 2pn_adj#)(1/2,1/2); 
    draw_X 1/16; set_ic_tr; 
endchar;
%}}}   X

%}}} maglcaps.mf

% Local variables:
% fold-folded-p: t
% End: