%%
mode_setup; path p[]; u:=pt/36;
currenttransform:=identity scaled .5 shifted (0,-2pt);

%%The scale of Daniel's initial drawing was too big; 
%%rather than change each of the points, we just halve them 
%%all by means of a transform.

beginchar("e",6pt#,7pt#,1pt#); "eflask";
z1=(170u,500u); z2=(40u,190u); z3=(40u,140u);
z4=(400u,140u); z5=(400u,190u); z6=(280u,500u);
z7=(300u,600u); z8=(300u,630u); z9=(150u,630u);
z10=(150u,600u); z11=(170u,600u); z12=(280u,600u);
p1:=z11---z1---z2---z3---z4---z5
 ---z6---z12---z7---z8---z9---z10---z7;
pickup pencircle scaled .4pt; draw p1;
%%\font\eflask=eflask scaled\magstep4 
%%\medskip\rightline{\eflask e}\medskip
%%At first, the points and 
%%curves were defined outside the character
%%routines. But then, the {\tt z*} definitions aren't available for the 
%%labeling routines. (The {\tt beginchar} does a {\tt begingroup}. It
%%also does a {\tt save x,y} which saves previously defined {\tt z}
%%points (z1 is just a macro that sets x1 \& y1) so 
%%they will be available after the grouping ends. However, inside this
%%grouping, {\tt x*,y*} become undefined and so aren't accessible by
%%the {\tt label} commands. If you dislike this convention, I suggest
%%you use {\tt pair w[]; w1=(170u,500u);} etc.). The labeling routines 
%%insert specials into the {\tt gf}  
%%file so that when one runs {\tt gftodvi eflask.2602gf}, one gets a
%%pretty picture of the character with its control points labeled.

labels(range 1 thru 10);makelabel.lft("12",z12);
makelabel.rt("11",z11);;endchar;

%%\mf\ didn't think there was enough room for all the
%%labels so I didn't `autolabel' the {\tt z11,z12} points; instead, I
%%explicitly said where to place the labels.

beginchar("f",6pt#,7pt#,1pt#); "fflask";
z8=(300u,630u); z9=(150u,630u); z11=(170u,600u); z12=(280u,600u);
z13=(170u,140u); z14=(280u,140u); z15=(40u,320u); 
z16=(400u,320u); z17=(170u,450u); z18=(280u,450u);
p2:=z17..z15..z13&z13--z14&z14..z16..z18;
p3:=z18---z12..z8&z8--z9&z9..z11---z17; p4:=p2&p3;
pickup pencircle scaled .5pt;
draw p4; labels(range 11 thru 18);
makelabel.rt("curve to z8",z8);
makelabel.top("out to z9",z9);
endchar;

%%\medskip\rightline{\eflask f}\medskip
%%Besides points and their labels, one can also insert {\tt
%%proofrule(z1,z2)} (where {\tt x1=x2 $\|$ y1=y2}) and general
%%annotations with {\tt makelabel.bot.nodot}, etc. To use this font in
%%\TeX, one first defines a command for the font:\hfil\break
%%\centerline{\tt $\backslash$font$\backslash$eflaskfont = eflask.}
%%Then, in the text, one can say: $\{$$\backslash$eflaskfont e
%%$\{$$\backslash$rm$\backslash$ and$\backslash$ $\}$ f$\}$, for
%%example.  
%%
%%While we are making characters, lets do something calligraphic. The
%%Computer Modern Symbol fonts (cmsy10.mf, for example) include
%%uppercase calligraphic characters designed by N.~N.~Billawala. I've 
%%eliminated two fitting adjustments and simplified the slanting. These
%%characters rely on a slanted elliptical pen and carefully chosen
%%control points. Their coding appears simpler than most of the computer
%%modern characters which use simulated broadnibbed pens via the {\tt
%%penstroke} command.

beginchar("C",9.4*20/36pt#,246/36pt#,0);    
def .... = .. tension atleast .9 .. enddef; 
currenttransform:=identity slanted .2pt#;
join_radius:=20/36pt;
cap_curve:=35/36pt; cap_hair:=11/36pt; o:=8/36pt;
pickup pencircle xscaled cap_curve yscaled cap_hair rotated 30;

%%Thus, 30 degree strokes will be the thinest and 120
%%degree strokes the 
%%thickest. 
%%\hb \mf's most distinctive features;
%%This ability to draw with sophisticated
%%pens\footnote{${}^4$}{``$\ldots$ \mf's most difficult task, which is to
%%fill the envelope of a given cyclic path with respect to a given pen
%%polygon.'' -- Donald Knuth, {\it METAFONT: The Program\/}, section 490}
%% is another
%%principle advantage that \mf\ has over PostScript as a language for
%%font design. That said, the comparison is not really fair; PostScript
%%was not developed as a language for font design but rather as a
%%general printer language in which font outlines (designed with
%%graphical tools) could be expressed. Related to this, PostScript is
%%meant to be written by printer drivers and other such programs. This,
%%in my opinion, is the other main difference from \mf. Although some
%%people actually write directly in PostScript, commonly programs are
%%written to write PostScript. Metafont is
%%meant to be written by people even though there are graphics programs
%%such as {\tt gnuplot} and {\tt xfig, via fig2mf} which can output \mf\
%%code. \mf's declarative (linear) equations are a good example 
%%of its adaptation to the programmers needs. While complex pens (and even
%%its attention to discretization errors) are of more significance to 
%%the font maker, being able to declare a font's linear relationships
%%eliminates programming complications.
%%
%%By the way, if you try to format this section with {\tt mft}, you
%%will need to add the $.\;.\;.\;.$ operator to {\tt plain.mft}. This, 
%%along with using three or more \%'s unintentionally, is a common
%%source of typesetting errors when using {\tt mft}. 
%%Also note that each space at the 
%%beginning of a line gets converted into a {\tt quad} of space.

x0=.7[x2,x1]; rt x1=.85w; x2=.6w; lft x3=0; x4=.5w; rt x5=w;
y0=.7h; y1=.8[y0,y2]; top y2=h+o; y3=.5h; bot y4=-o; y5=.2h;
draw (z0{2(x1-x0),y1-y0}...z1)
 softjoin (z1...z2{left}....z3{down}...z4...z5); 
labels(0,1,2,3,4,5); endchar; 
%%\medskip\rightline{\eflask C}\medskip

%%The {\tt softjoin} command joins two curves with a
%%circular arc of 
%%radius {\tt join\_radius}, thus saving us the effort of explicitly
%%working out the curve. 
%%
%% Notice the dramatic difference between this last character and the
%%previous two. In the `eflask' character, while we did leave the actual
%%drawing up to {\tt mf}, we explicitly defined all the crucial points.
%%In this last character, the \mf\ programming language is better
%%utilized. We declare various facts, ie equations, which determine the
%%character and then just command \mf\ to draw so we can see it. \par
%%This character also points out the value of more interactive tools.
%%This character is easy to code; the real work was in defining the
%%control points for the pen to use.  One might want a tool enabling
%%one to grab a control point and move it around while viewing the
%%results.  One can not do this with \mf\ (however, provided one's
%%computer is fast enough, we can `prompt and show' to somewhat
%%simulate this). On the other hand, for real interaction, no computer
%%tools can compare to real pens and brushes.\par
%%Even with a simple character like the flask where equations don't
%%need to be solved, it is easier to define the character in terms of
%%a parameter:

currenttransform:=identity;
beginchar("F",8pt#,9pt#,1pt#); "Fflask";
 pickup pencircle scaled .4pt; path p[]; 
 m=1/8w; x1=x3=x4=5m; x2=7.3m; 
 y1=0; y2=3m; y3=6m; y4=h; z5=z4+(.05w,.05h); 
 p1=z1..z2..z3&z3---z4..z5;
 p2=p1 reflectedabout ((.5w,0),(.5w,h));
 draw p1--reverse p2--cycle;
endchar; 
