% This files contains macros used to pretty-print the Metafont source file of
% the French-Cursive typeface. It acts as a driver file: compile it after
% processing frcursive.mf through mft to get the DVI document. The font itself
% must be available since it is used in the source's comments.

%-- some fonts

\font\tentex=ectt10
\font\eightrm=cmr8
\font\tensc=cmcsc10
\font\titlefont=cmcsc14
\font\fc=frcr10
\tenrm

%-- some useful macros

\def\cs#1{{\tt\string#1}}
\def\item{%
  \par\noindent%
  --\kern 1.5ex\relax}
\def\deflist#1{\halign{\kern\parindent\relax##\hfil&\ = ##\hfil\cr#1}}

%-- a nice title

\def\title#1,#2.{%
  \begingroup%
  \parindent=0pt%
  \parfillskip=0pt%
  \leftskip=3em plus 1fil%
  \rightskip=\leftskip%
  {\titlefont #1}\medskip
  {\tensc \let\cr\medskip \ignorespaces #2}\bigskip%
  \vrule height 0.4pt width 10cm\bigskip%
  \endgroup}

%-- sectioning

\newwrite\tocfile
\openout\tocfile=\jobname.toc

\newcount\secnum
\outer\def\sec#1.{%
  \par\vfil\break%
  \advance\secnum1\relax\subsecnum0%
  \sechead{$\oldstyle\the\secnum.$ #1}%
  \write\tocfile{\noexpand\tocsec{\the\pageno}{\the\secnum}{#1}}}

\def\sechead#1{%
  \centerline{\tensc #1}%
  \centerline{\vrule height 0.4pt width 5em}%
  \bigskip}

\newcount\subsecnum
\outer\def\subsec#1.{%
  \medbreak%
  \advance\subsecnum1%
  \centerline{\it\the\subsecnum. #1.}%
  \smallskip}

%-- generating the toc file

\def\tocsec#1#2#3{%
  \medskip%
  \line{\kern2cm%
    \hbox to 7mm{$\oldstyle#2.$\hfil}#3 \xleaders\hbox{ . }\hfil\ #1%
    \kern2cm}}

%-- input the processed Metafont source

\input frcursive

%-- generating the table of contents

\closeout\tocfile

\vfill\eject
\nopagenumbers
\topskip 0pt plus 1fill
\sechead{Table of contents}
\input\jobname.toc
\vfill

\end
