summaryrefslogtreecommitdiff
path: root/usergrps/uktug/baskervi/4_4/simpsons.mf
blob: 7a1f991f85bc10d2655a58ec1bd1cda66e6c8ae2 (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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
% simpsons.mf by Raymond Chen (rjc@math.princeton.edu) 
 
mode_setup; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Parameters (and typical values) 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Pen control 
% 
% u#            the basic unit. 
%               A choice of 1/16in# makes Lisa fit into a 1.5" square. 
% 
% thin#         The pen used for everything, unless otherwise noted. 
%               A value of 1/18u# produces a razor-sharp-ish pen, 
%               good for low resolution work (and which scales nicely). 
%               But a value of 1/9u# produces a slightly thicker line 
%               which might show up better. 
%               And a value of 1/5u# produces a heavy pen, more in keeping 
%               with MG's drawing style. 
% 
% fine#         For fine detail, like the atom logo on the SNPP cooling tower. 
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Physical attributes for everybody 
% 
% tau_top       Curviness of the top part of the little `t' that 
%               forms the ridges inside the ear.  Recommend 45. 
% 
% tau_side      Curviness of the side part of the little `t' that 
%               forms the ridges inside the ear.  Recommend 45. 
% 
% dimple_depth  Amount of curve (in degrees) to give the dimple. 
%               Positive value makes the cheeks puffier. 
%               Negative value makes the dimple deeper. 
%               Recommend -10. 
% 
% innocence#    Size of pupils.  Suggest 0.5u#. 
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Controls for the ladies 
% 
% lace#         The pen used for necklaces.  Recommend = thin#. 
% 
% pearl#        Size of pearls in the necklace.  Set pearl < 0 
%               to suppress the necklace altogether. 
%               Recommend 1.9u#. 
% 
% mascara       Thickness of the eyelashes, relative to thin#. 
%               1.5 means eyelashes are 1.5 times thicker than regular strokes. 
%               Recommend a value of 1.0. 
% 
% seductiveness Curliness of the eyelashes.  In degrees.  Suggest 5. 
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Controls for the kids 
% 
% spikiness     Controls spikiness (tension) of Lisa and Maggie's hair. 
%               Lower numbers make it wavier, 
%               higher numbers make it spikier.  5 seems about right. 
% 
% kemptness#    How uniform the spikes of Bart's hair are. 
%               Higher values make Bart's hair more erratic. 
%               A value of 0 makes them perfectly evenly spaced. 
%               I think 0.05u# looks about right. 
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Controls for Homer 
% 
% starch        How much Homer's collar points flare outwards. 
%               Larger values make Homer's collar stick out more. 
%               In degrees 0..90.  Recommend 30. 
% 
% machismo      How much the front of Homer's shirt opens. 
%               Larger values make it more open.  Degrees 0..90. Recommend 60. 
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Controls for Marge 
% 
% curlers       How large to make the `bumps' the make up Marge's hair. 
%               In degrees.  Suggest 30. 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
u# = 1/80in#; 
%thin# = 1/9 u#;         % heavy lines 
thin# = 1/5 u#;        % realistically heavy 
fine# = 1/9u#; 
 
tau_top := 45; 
tau_side := 45; 
dimple_depth = -10; 
innocence# := .5u#; 
 
lace# = thin#; 
pearl# = 1.9u#; 
mascara = 1.0; 
seductiveness := 7; 
 
spikiness := 5; 
kemptness# := 1/20u#; 
 
starch := 30; 
machismo := 60; 
 
curlers := 30; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Preparing to do business 
 
define_pixels(u, pearl, innocence, kemptness); 
define_whole_blacker_pixels(thin, fine, lace); 
 
pickup pencircle scaled thin; thinpen = savepen; 
pickup pencircle scaled fine; finepen = savepen; 
pickup pencircle scaled (thin * mascara); lashpen = savepen; 
pickup pencircle scaled lace; lacepen = savepen; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Private macros 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
def openit =                            % so screen previewing works better 
    openwindow currentwindow from origin to (screen_rows, screen_cols) 
    at (0, screen_rows-1) enddef; 
 
def :: = ..tension spikiness.. enddef;     % For drawing the kids' spiky hair. 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% preclip     -- clips the path p to start at q. 
% postclip    -- clips the path p to end at r. 
% prepostclip -- clips the path p to start at q and end at r. 
% hardjoin    -- start on p and end on q, transition when they intersect 
 
def preclip(expr p,q)= 
    subpath (xpart(p intersectiontimes q), infinity) of p enddef; 
def postclip(expr p, r) = reverse preclip(reverse p, r) enddef; 
def prepostclip(expr p, q, r) = postclip(preclip(p, q), r) enddef; 
 
secondarydef p hardjoin q = 
    begingroup dz_ := p intersectiontimes q; 
        subpath (0, xpart dz_) of p .. subpath(ypart dz_, infinity) of q 
    endgroup enddef; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Drawing bent lines (i.e., shallowly curved).. Positive theta curves 
% to the left, negative to the right. 
 
vardef bend(expr theta, p, q) = 
    p{(q-p) rotated  theta}.. 
     {(q-p) rotated -theta}q enddef; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Drawing opaquely 
def overdraw expr c = erase fill c; draw c enddef; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Labelling shifted points 
vardef labelsoffset@#(expr offset)(text t) = 
    if proofing > 1: forsuffixes $=t: makelabel@#(str$, z$+offset); endfor 
    fi enddef; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Facial features 
 
def dimplepath(expr p, q) =             % top coordinate first 
    if proofing>1: hide( makelabel("", p); makelabel("", q); ) fi 
%    p{(q-p) rotated  dimple_depth}.. 
%     {(q-p) rotated -dimple_depth}q 
    bend(dimple_depth, p, q) 
enddef; 
 
%   _s__q 
% p/ | 
%    | 
%     \r 
 
def drawtau(expr p, q, r, s) = 
    if proofing>1: makelabel("p", p); makelabel("q", q); 
                   makelabel("r", r); makelabel("s", s); fi 
    c_ := p{(q-p) rotated tau_top}..q; 
    draw c_; 
%    draw postclip( (r{(s-r) rotated tau_side}.. 
%                     {(s-r) rotated -tau_side}s), c_) enddef; 
    draw postclip( bend(tau_side, r, s), c_) enddef; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Eyelashes either bend clockwise or counter-clockwise as they leave 
% the eye. 
% 
% p = starting point, q = ending point, d = delta 
%   d>0 = curves right, d<0 = curves left.  Bigger d means more curve. 
 
def makelash(expr ofs,p,q,d) = 
    if proofing>1: hide( makelabel("", ofs+p); makelabel("", ofs+q); ) fi 
    bend(d*seductiveness, ofs+p, ofs+q) enddef; 
 
% Right lashes clip to the right eye, left lashes to the left eye_ 
vardef rlash@#(expr p,q,d) = 
    lash@# := preclip(makelash( 
                      if known z.eye_right: z.eye_right else:origin fi, p,q,d), 
                      eye_right); 
    draw lash@# enddef; 
vardef llash@#(expr p,q,d) = 
    lash@# := preclip(makelash( 
                      if known z.eye_left: z.eye_left else:origin fi, p, q, d), 
                      eye_left); 
    draw lash@# enddef; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Marge's hair contains little puffs. 
 
def puffhair(text t) =                  % t is a list of pairs 
    hide( n_ := 0; for z=t: z_[incr n_] := z; 
          if proofing>1: makelabel(decimal n_, z); fi endfor) 
    z_1 
        for k = 2 upto n_: 
            {(z_[k] - z_[k-1]) rotated -curlers} .. 
            {(z_[k] - z_[k-1]) rotated  curlers} z_[k] 
        endfor enddef; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Character positions 
 
def simpdochar(expr c, ht, wd, dp, name) = 
    beginchar(c, ht, wd, dp); name enddef; 
 
string current_char_name; 
def pictureof(suffix c)(expr wd, ht, dp) = 
   beginchar(2c, wd, ht, dp); 
    current_char_name := str c; 
    current_char_name & " looking right, no pupils" enddef; 
 
def endpicture = 
    pic_ := currentpicture; 
    endchar; 
 
    beginchar(incr charcode, charwd, charht, chardp); 
    current_char_name & " looking left, no pupils"; 
    currentpicture := pic_ reflectedabout ((.5w, 0), (.5w, h)); 
    endchar; 
    pic_ := nullpicture enddef; 
 
def unreflectedpictureof(suffix c)(expr wd, ht, dp) = 
    beginchar(c, wd, ht, dp); str c enddef; 
 
let unreflectedendpicture = endchar; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Draw grid marks during proofing 
 
def makebox(text rule) = 
    for y = 0 step 4u.o_ until charht*hppp: 
        rule((0, y), (w, y)); 
    endfor 
    rule((0, charht*hppp), (w, charht*hppp)); 
    rule((0, chardp*hppp), (w, chardp*hppp)); 
 
    for x = 0 step 4u until charwd*hppp: 
        rule ((x, -d.o_), (x, h.o_)); 
    endfor 
    rule ((charwd*hppp, -d.o_), (charwd*hppp, h.o_)); 
enddef; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Eye positions 
% 
% Eye positions are stored in the fontdimens. 
 
def eyepos(expr p, a, b, c, d) = fontdimen 4 + 4p: a, b, c, d enddef; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Local variables 
 
def local(text t, v) = 
    forsuffixes $=v: save v; t v; endfor enddef; 
 
def localpath text v = local(path)(v) enddef; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
Lisa = 1; 
Homer = 2; 
Bart = 3; 
Marge = 4; 
Maggie = 5; 
Burns = 6; 
 
proofing:=2; 
% screenstrokes; 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
beginchar(0, 0, innocence#, 0); "A pupil (no width)"; 
    fill fullcircle scaled innocence; 
endchar; 
 
% and character 1 is SNPP. 
input snpp 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% The x-height is 1pt.  The purpose of this is so that pupil positioning 
% can be done in ex-units, which will therefore scale properly if the 
% font is loaded at nonstandard magnifications. 
 
fontdimen 5: 1pt#; 
 
input lisa 
input homer 
input bart 
input marge 
input maggie 
input burns 
end