\input mftmac

$\5{mode\_setup};\ \2{path}p[];\ u:=\\{pt}/36;$\par
$\\{currenttransform}:=\\{identity}\6{scaled}.5\6{shifted}(0,-2\\{pt});$\par
\BL
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.
\BL
$\2{beginchar}(\7"e",6\\{pt}\SH ,7\\{pt}\SH ,1\\{pt}\SH );\ \7"eflask";$\par
$z_{1}=(170u,500u);\ z_{2}=(40u,190u);\ z_{3}=(40u,140u);$\par
$z_{4}=(400u,140u);\ z_{5}=(400u,190u);\ z_{6}=(280u,500u);$\par
$z_{7}=(300u,600u);\ z_{8}=(300u,630u);\ z_{9}=(150u,630u);$\par
$z_{10}=(150u,600u);\ z_{11}=(170u,600u);\ z_{12}=(280u,600u);$\par
$p_{1}:=z_{11}\8{---}z_{1}\8{---}z_{2}\8{---}z_{3}\8{---}z_{4}\8{---}z_{5}$\par
\quad$\8{---}z_{6}\8{---}z_{12}\8{---}z_{7}\8{---}z_{8}\8{---}z_{9}%
\8{---}z_{10}\8{---}z_{7};$\par
$\2{pickup}\5{pencircle}\6{scaled}.4\\{pt};\ \2{draw}p_{1};$\par
\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.
\BL
$\2{labels}(\\{range}_{1thru10});\ \\{makelabel}_{lft}(\7"12",z_{12});$\par
$\\{makelabel}_{rt}(\7"11",z_{11});\ ;\3{endchar};$\par
\BL
\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.
\BL
$\2{beginchar}(\7"f",6\\{pt}\SH ,7\\{pt}\SH ,1\\{pt}\SH );\ \7"fflask";$\par
$z_{8}=(300u,630u);\ z_{9}=(150u,630u);\ z_{11}=(170u,600u);\
z_{12}=(280u,600u);$\par
$z_{13}=(170u,140u);\ z_{14}=(280u,140u);\ z_{15}=(40u,320u);$\par
$z_{16}=(400u,320u);\ z_{17}=(170u,450u);\ z_{18}=(280u,450u);$\par
$p_{2}:=z_{17}\8{..}z_{15}\8{..}z_{13}\AM z_{13}\8{--}z_{14}\AM z_{14}%
\8{..}z_{16}\8{..}z_{18};$\par
$p_{3}:=z_{18}\8{---}z_{12}\8{..}z_{8}\AM z_{8}\8{--}z_{9}\AM z_{9}\8{..}z_{11}%
\8{---}z_{17};\ p_{4}:=p_{2}\AM p_{3};$\par
$\2{pickup}\5{pencircle}\6{scaled}.5\\{pt};$\par
$\2{draw}p_{4};\ \2{labels}(\\{range}_{11thru18});$\par
$\\{makelabel}_{rt}(\7"curve to z8",z_{8});$\par
$\\{makelabel}_{top}(\7"out to z9",z_{9});$\par
$\!\3{endchar};$\par
\BL
\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.
\BL
$\2{beginchar}(\7"C",9.4\ast \frac20/{36}\\{pt}\SH ,\frac246/{36}\\{pt}\SH
,0);$\par
$\2{def}\8{....}=\8{..}\1{tension}\1{atleast}.9\8{..}\3{enddef};$\par
$\\{currenttransform}:=\\{identity}\6{slanted}.2\\{pt}\SH ;$\par
$\\{join\_radius}:=\frac20/{36}\\{pt};$\par
$\\{cap\_curve}:=\frac35/{36}\\{pt};\ \\{cap\_hair}:=\frac11/{36}\\{pt};\ o:=%
\frac8/{36}\\{pt};$\par
$\2{pickup}\5{pencircle}\6{xscaled}\\{cap\_curve}\6{yscaled}\\{cap\_hair}%
\6{rotated}30;$\par
\BL
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.
\BL
$x_{0}=.7[x_{2},x_{1}];\ \\{rt}\,x_{1}=.85w;\ x_{2}=.6w;\ \\{lft}\,x_{3}=0;\
x_{4}=.5w;\ \\{rt}\,x_{5}=w;$\par
$y_{0}=.7h;\ y_{1}=.8[y_{0},y_{2}];\ \\{top}\,y_{2}=h+o;\ y_{3}=.5h;\ \\{bot}%
\,y_{4}=-o;\ y_{5}=.2h;$\par
$\2{draw}(z_{0}\{2(x_{1}-x_{0}),y_{1}-y_{0}\}\8{...}z_{1})$\par
\quad${}\6{softjoin}(z_{1}\8{...}z_{2}\{\\{left}\}\8{....}z_{3}\{\\{down}\}%
\8{...}z_{4}\8{...}z_{5});$\par
$\2{labels}(0,1,2,3,4,5);\3{endchar};$\par
\medskip\rightline{\eflask C}\medskip
\BL
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:
\BL
$\\{currenttransform}:=\\{identity};$\par
$\2{beginchar}(\7"F",8\\{pt}\SH ,9\\{pt}\SH ,1\\{pt}\SH );\ \7"Fflask";$\par
\quad$\2{pickup}\5{pencircle}\6{scaled}.4\\{pt};\ \2{path}p[];$\par
\quad$m=\frac1/{8}w;\ x_{1}=x_{3}=x_{4}=5m;\ x_{2}=7.3m;$\par
\quad$y_{1}=0;\ y_{2}=3m;\ y_{3}=6m;\ y_{4}=h;\ z_{5}=z_{4}+(.05w,.05h);$\par
\quad$p_{1}=z_{1}\8{..}z_{2}\8{..}z_{3}\AM z_{3}\8{---}z_{4}\8{..}z_{5};$\par
\quad$p_{2}=p_{1}\1{reflectedabout}((.5w,0),(.5w,h));$\par
\quad$\2{draw}p_{1}\8{--}\1{reverse}p_{2}\8{--}\1{cycle};$\par
$\!\3{endchar};$\par
