14.03.2013 Views

symbols-a4

symbols-a4

symbols-a4

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

font identifier := "LightBulb10"; % Name the font.<br />

font size 10pt # ; % Specify the design size.<br />

em # := 10pt # ; % “M” width is 10 points.<br />

cap # := 7pt # ; % Capital letter height is 7 points above the baseline.<br />

sb # := 1/4pt # ; % Leave this much space on the side of each character.<br />

o # := 1/16pt # ; % Amount that curves overshoot borders.<br />

input lightbulb % Load the file that draws the actual glyph.<br />

Figure 2: Sample METAFONT size-specific file (lightbulb10.mf)<br />

mode setup; % Target a given printer.<br />

define pixels(em, cap, sb); % Convert to device-specific units.<br />

define corrected pixels(o); % Same, but add a device-specific fudge factor.<br />

%% Define a light bulb at the character position for “A”<br />

%% with width 1/2em # , height cap # , and depth 1pt # .<br />

beginchar("A", 1/2em # , cap # , 1pt # ); "A light bulb";<br />

pickup pencircle scaled 1/2pt; % Use a pen with a small, circular tip.<br />

%% Define the points we need.<br />

top z1 = (w/2, h + o); % z1 is at the top of a circle.<br />

rt z2 = (w + sb + o − x4, y4); % z2 is at the same height as z4 but the opposite side.<br />

bot z3 = (z1 − (0, w − sb − o)); % z3 is at the bottom of the circle.<br />

lft z4 = (sb − o, 1/2[y1, y3]); % z4 is on the left of the circle.<br />

path bulb; % Define a path for the bulb itself.<br />

bulb = z1 . . z2 . . z3 . . z4 . . cycle; % The bulb is a closed path.<br />

z5 = point 2 − 1/3 of bulb; % z5 lies on the bulb, a little to the right of z3.<br />

z6 = (x5, 0); % z6 is at the bottom, directly under z5.<br />

z7 = (x8, 0); % z7 is at the bottom, directly under z8.<br />

z8 = point 2 + 1/3 of bulb; % z8 lies on the bulb, a little to the left of z3.<br />

bot z67 = ( 1/2[x6, x7], pen bot − o − 1/8pt); % z67 lies halfway between z6 and z7 but a jot lower.<br />

%% Draw the bulb and the base.<br />

draw bulb; % Draw the bulb proper.<br />

draw z5 - - z6 . . z67 . . z7 - - z8; % Draw the base of the bulb.<br />

%% Display key positions and points to help us debug.<br />

makegrid(0, sb, w/2, w − sb)(0, −1pt, y2, h); % Label “interesting” x and y coordinates.<br />

penlabels(1, 2, 3, 4, 5, 6, 67, 7, 8); % Label control points for debugging.<br />

endchar;<br />

end<br />

Figure 3: Sample METAFONT size-independent file (lightbulb.mf)<br />

110

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!