\input mftmac
\medskip
$\5{screenstrokes};$\par
$\2{show}\\{mode};$\par
$>>$ mode
$\5{mode\_setup};\ \2{show}\\{mode};$\par
$>>$ 1
\BL
Initially, mode doesn't have a value although it has been declared
numeric. When {\tt mode\_setup} is run, if {\tt mode} doesn't have a
value,
it is set to {\tt proof} mode.
\BL
$\2{show}\\{mode\_name}[\\{mode}];\ \9proof\_\par
$\2{drawdot}\\{origin};\ \5{showit};$\par
$\2{numeric}\\{mode};\ \\{mode}=\\{CanonCX};\ \5{mode\_setup};$\par
$\2{drawdot}\\{origin}+(50,50);\ \5{showit};\ \2{show}\\{pt};\ \94.1511\par
\BL
$\2{numeric}\\{mode};\ \\{mode}=\\{proof};\ \5{mode\_setup};$\par
$\2{drawdot}\\{origin}+(50,50);\ \5{showit};\ \2{show}\\{pt};\ \936\par
\BL
When {\tt mode\_setup} is called, among other things, it sets the
device dependent values of the various units. In other words, units
like {\tt mm} or {\tt in} are just numerics which give the number of
pixels in that unit for the currently defined device (i.e., mode).
The default pen is  .4pt in diameter; thus, in proof mode, a dot is
$round(36*.4)=14$ pixels
wide. CanonCX is for 300dpi LaserJets, etc.
where the corresponding dot
is only $round(4.1511*.4)=2$ pixels wide. To reset {\tt mode,} clear
the previous equation by declaring {\tt mode} as {\tt numeric.}

To see the names of the various modes, one can do:
\BL
$\2{for}i=1\4{upto}\\{number\_of\_modes}\?:$\par
\quad$\2{message}\7"mode "\AM \1{decimal}i\AM \7" is "\AM \\{mode\_name}[i];$%
\par
$\!\3{endfor};$\par
\BL
Lets look at some pens:
\BL
$\2{string}s;$\par
$\2{for}i=10\4{step}-1.5\4{until}1\?:$\par
\quad$a:=300/i;\ \9want pens about the same size\par
\quad$\2{pickup}\5{pencircle}\6{scaled}i;\ \2{pickup}\\{currentpen}%
\6{scaled}a;$\par
\quad$\2{drawdot}(200,100);$\par
\quad$\2{undraw}(200,100);$\par
$\!\3{endfor};$\par
\font\dotsetc=dotsetcp
\bigskip\centerline{\dotsetc A\hfil B}
\bigskip\centerline{\dotsetc C\hfil D}
\bigskip\centerline{\dotsetc E\hfil F}
\bigskip\centerline{\dotsetc G\hfil H}
\bigskip\centerline{\dotsetc I\hfil J}
\bigskip\centerline{\dotsetc K\hfil L}
\bigskip\centerline{\dotsetc M\hfil N}\bigskip
\BL
We want to look at small pens; thus we first create the pen to define
its shape and then magnify it. As you can see, \mf's pencirle isn't
really a circle, but rather a polygonal approximation to one. When one
is outputing to a particular discrete device, the resulting rounding
errors are reduced by using such convex polygons. Any convex polygon
can be used as a pen (and vice-versa); \mf's plain format predefines
{\tt penrazor, pensquare, pencircle} which can be scaled in {\tt x,y}
 directions
separately.  Also notice that {\tt drawdot (x,y)} and {\tt draw (x,y)}
aren't exactly the same; again, discretization errors make it useful
to have a special routine to draw dots. This careful attention to
problems of discretization is one of the three main differences
between \mf\ and Postscript.

$\!\3{end}$\par
