\documentclass{ltugproc}
\NoBlackBoxes
\usepackage{graphicx}
\usepackage{hyperref}
\def\GeX/{G\kern-.125em\lower.5ex\hbox{E}\kern-.125emX\@}
\hyphenation{Post-Script}
\ifx\VTeXversion\undefined
\else
\usepackage{mathexmm}
\fi
\title{Multiple Master Math Extension Fonts}
\author{D.~Men'shikov, A.~Kostin, M.~Vulis}
\address{
   MicroPress, Inc.\\
   68-30 Harrow Street\\
   Forest Hills, New York, 11375, USA\\
   Phone:  1 (718) 575 1818\\
   Fax:    1 (718) 575 8038\\
}
\netaddress{support@micropress-inc.com}
\personalURL{http://www.micropress-inc.com}

\begin{document}
\maketitle

\begin{abstract}
From its inception, \TeX\ relied on the concept of extensible (composite)
characters to implement large glyphs that occur in mathematical typesetting.
While thousands of papers have been successfully written using this technology,
there are obvious shortcomings of this approach. This article demonstrates
them, as well as an alternative solution, free from the problems.
\end{abstract}

\section{The traditional approach}

The extensible glyphs in \TeX\ are composed out of several smaller characters,
and, in some cases, rules. The construction itself is carried either by code
inside the \TeX\ compiler itself, using the special information in the \verb|.tfm|
files, or by macros, implemented as part of the format.

An example of the first situation is the construction of large delimiters,
for example, brackets. Here, a vertical segment in inserted to stretch the
delimiters vertically:

\begin{figure}[h] % fig1
\begin{center}
\ifx\VTeXversion\undefined
\includegraphics{fig1}
\else
\scalebox{2}{\fbox{
$
\font\tenex=cmex10  outline=1
\textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
\left[ \vrule width 0pt height 1cm \right]
\left\lbrace \vrule width 0pt height 1cm \right\rbrace
\left( \vrule width 0pt height 1cm \right)
\left< \vrule width 0pt height 1cm \right>
$}}
\fi
\end{center}
\caption{Vertical delimiters}
\end{figure}

One of the shortcomings of the extensible characters is that some character
shapes do not lend themselves to the insertion of extension pieces; thus,
the angular brackets are non-extensible, and, when used to encompass a large
formula, would not scale to the required size. For example, typing

\begin{verbatim}
$\left< \vrule width 1cm height 1cm \over
        \vrule width 1cm height 1cm \right>$
\end{verbatim}

\noindent results in
$
\font\tenex=cmex10  %outline=1
\textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
\left< \vrule width 1cm height 1cm \over \vrule width 1cm height 1cm \right>$
rather than in the anticipated
$
\left< \vrule width 1cm height 1cm \over \vrule width 1cm height 1cm \right>$



A variant of the situation is the \TeX's treatment of the radical symbol: the
construction is accomplished by the \TeX\ program itself, but while the
vertical extension is driven by the \verb|.tfm| information, the horizontal
bar is supplied by the \TeX\ program itself; and in this case the bar is a
rule, rather than an extension character.

\begin{figure}[h] % fig2
\begin{center}
\ifx\VTeXversion\undefined
\includegraphics{fig2}
\else
\scalebox{2}{\fbox{
$
\font\tenex=cmex10  outline=1
\textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
\sqrt{\vrule width 1cm height 2cm}
$}}
\fi
\end{center}
\caption{Radical delimiters}
\end{figure}

In the above picture, the rule component is shown filled.

The problem with the use of rule components in building a composite
symbol is that rules are subjected to different roundoff rules than
characters. In the prehistoric days of DVI files and bitmap fonts,
these roundoff errors could be in principle handled by careful calculations
within the \TeX\ program and the DVI driver; but in the modern world of
scalable fonts and PS/PDF targeting this becomes an impossibility.

The picture below shows a snapshot of square root constructed by Pdf\TeX:
\begin{center}
\fbox{\includegraphics{pdfsqrt.png}}
\end{center}

\noindent The underlying \TeX\ code was
\begin{verbatim}
$ \sqrt{\vrule height 2cm width 2cm} $
\end{verbatim}

Depending on the magnification used in the PDF previewer, or resolution
of the output device, the rule
may be thinner, or thicker, or above, or below the part of the \verb|sqrt|
glyph it is supposed to connect to smoothly. And, sometimes, it would fit
correctly.

The root of the problem here is that glyph rounding is subject to the font
hinting, while the thickness and positioning of rules is not well controlled
by the PS/PDF rendering.

The second type of extension mechanism is via \TeX\ macros; this is typically
used to construct long horizontal symbols, as done by commands similar to
\verb|\underbrace|:

\begin{figure}[ht] % fig3
\ifx\VTeXversion\undefined
\includegraphics{fig1}
\else
\scalebox{2}{\fbox{
$
\font\tenex=cmex10 scaled 999 outline=1
\textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
\underbraceSTD{\vrule width 3cm height 0.5cm}
$}}
\fi
\caption{Underbrace extension}
\end{figure}

Once again, we get mismatches in the width and positioning of the connecting
rules comparing to that of the symbols used in the middle and at the ends of
the long brace. A snapshot:

\fbox{\includegraphics[scale=0.7]{pdfbrace.png}}

The third problem with extensible characters is that sometimes (usually, in
slides) it is desirable to outline, or shade characters; this cannot be done
correctly with composite characters. In fact, the diagrams above that
show the structure of extensible characters, are \textit{unintended output} of
an attempt to stroke extensible symbols, making them suitable for this article,
but not for a use within a slide.


Summarizing, we have identified three separate problems with the \TeX\ approach
to the extensible symbols:

\begin{itemize}
\item Impossibility to correctly scale some of the delimiters (angular
brackets, for example).
\item Impossibility to correctly align rules and characters.
\item Impossibility to correctly stroke or shade composite symbols.
\end{itemize}

All these problems can be solved, however, if we switch to a different
mechanism of constructing large symbols: multiple-master fonts.

\section{Multiple Master Fonts}

For those unfamiliar with the MM fonts, they represent a PostScript World
answer to MetaFont. Just like MetaFont allows creation of different designs
from the same font program, so does the MM technology. While MM fonts are
less flexible than MetaFont, they are easy to use, and the output of MM
font instancing is a ready-to-use Type~1 font, whereas a generic MetaFont emits
obsolete bitmapped fonts.

Additional information on the MM fonts can be found in the Adobe Technical
Specification \#5015 \textit{``Type 1 Font Format Supplement''}.

The Multiple-Master (MM) Font technology was introduced by Adobe in 1991;
the first description of the MM technology appeared in the PC Week article
of the March 11, 1991 issue. The first MM font was Myriad (1992), with
two axes: weight and width.

Since 1992 Adobe designed at least 36 MM font families with 99 fonts.
Perhaps the most successful was the Minion family.

While Adobe originally intended to include MM in the OpenType specifications,
this effort has been abandoned, and Adobe stopped making new
MM fonts. The last Adobe's MM font, VerveMM, was designed in 1998;
Adobe had announced that it was giving up on the MM technology at
the 1999 ATypI Congress.

Despite the abandonment by Adobe, MM fonts represents
a very convenient technology for use in typesetting applications like \TeX.
While MM functionality is not supported within PDF documents,
instances of MM fonts are, and the entire MM font can be made
available to the \TeX\ document.

V\TeX\ has supported MM fonts since 2001, and the use of MM fonts in
math extension fonts merely builds up on the existing MM support; we
will start with outlining the existing support.

V\TeX\ recognizes MM fonts by the name of the font; a font name that includes
the bracket character is assumed to be an instance of a Multiple Master font.
This does not represent much of a restriction on the font name selection,
since use of brackets in file names is not common and is not legal on some
operating systems.

The left bracket in the font name is followed by the instancing parameters.
For example, in

\begin{verbatim}
\font\sm=xo______
\font\mm=xo______[300,10]
\end{verbatim}
the \verb|\sm \font| declaration defines the default shape of the Multiple
Master CrononMM
font; this is the ``normal'' way to use the typeface. The second
declaration, however, defines an instance of this MM font to be constructed
dynamically.

In the above example, the first definition makes V\TeX\ to load the usual
TFM metrics file, namely \verb|xo______.tfm|;
the second declaration causes V\TeX\ to load the Multiple font Metrics
file
\verb|xo______.mfm|
and generate the instance metrics on the fly. Because of the use of
\verb|.mfm| files
providing metrics file for each instance becomes unnecessary.

In some MM fonts, all the instances of the font have the same metrics; if so,
it is possible to use the ordinary \verb|.tfm| file. In most MM fonts, however,
the metrics of different instances is different, and this made the development
of the new metrics format necessary.

Upon seeing a MM font used in the document, V\TeX\ compiler would automatically
use the build-in PostScript interpreter (\GeX/, see [1]) to instance it; since
the instancing is done by a PostScript execution, the instance font is always
built correctly; and the \TeX\ compiler automatically packs it into the
output PDF file.

For example, the following \TeX\ code would provide a set of instances of the
Minion font (TM).

Additional details on the MM support can be found in the \verb|mmsupp.pdf|
document in V\TeX\ distributions.


\section{Math Extension Multiple Master Fonts}


Supporting Math Extension MM fonts requires several additional steps.

Firstly, such fonts need to be developed themselves; currently such fonts
exist:
\verb|cmex10mm| and \verb|paex10mm|. The first is intended for use with
Computer Modern fonts, the second with the alternative PaMATH set, available
from MicroPress.

Math Extension MM fonts include symbols for vertical delimiters, long
horizontal symbols (like the ones constructed by the \verb|\underbrace| macro),
and the radical symbol. Since the radical requires two MM axes, the entire
font is a two-axes MM font, even if the majority of symbols are actually
``one-dimensional''.

%The layout of the \verb|cmex10mm| font is as follows:

%---??? Include layout ???---


Specific sizes of delimiters can be constructed by loading the font with
different instancing parameters. For example, for the \verb|\overbrace|
symbol, we can try font commands like

\begin{verbatim}
\font\f=cmex10mm[30,100] \f \char"7A
\font\f=cmex10mm[30,300] \f \char"7A
\font\f=cmex10mm[30,500] \f \char"7A
\font\f=cmex10mm[30,700] \f \char"7A
\font\f=cmex10mm[30,900] \f \char"7A
\end{verbatim}
obtaining the shapes

\begin{center}
\ifx\VTeXversion\undefined
\begin{tabular}{c}
\includegraphics{fig4}
\end{tabular}
\else
\begin{tabular}{|c|c|}
\hline
\hbox to 2in{\tt100:\ \ \font\f=cmex10mm[30,100] outline=3\f \char"7A\hss} \\
\hline
\hbox to 2in{\tt300:\ \ \font\f=cmex10mm[30,300] outline=3\f \char"7A\hss} \\
\hline
\hbox to 2in{\tt500:\ \ \font\f=cmex10mm[30,500] outline=3\f \char"7A\hss} \\
\hline
\hbox to 2in{\tt700:\ \ \font\f=cmex10mm[30,700] outline=3\f \char"7A\hss} \\
\hline
\hbox to 2in{\tt900:\ \ \font\f=cmex10mm[30,900] outline=3\f \char"7A\hss} \\
\hline
\end{tabular}
\fi
\end{center}

\noindent (Only the second instancing parameter is used in long horizontal
symbols.)

Notice that the symbols are built from single glyphs and thus do not suffer
from the problems listed at the beginning of this paper.

Since \TeX\ supports \verb|overbrace| and other long horizontal symbols
entirely through macros, switching \TeX\ to supporting MM instances instead
requires only changes to the macros. One of the tasks of the
\verb|mathexmm| style is to therefore redefine these macros.

\medskip

Supporting vertical delimiters and radicals requires more radical changes: the
\verb|.tfm| mechanism of extensible characters needs to be replaced by an MM
alternative. We accomplish this as follows:

Firstly, we prepare an alternative metrics file, \verb|cmex10m|, which is
mostly equivalent to \verb|cmex10|, except that

\begin{itemize}
\item The encoding specified in the \verb|.tfm| must be \verb|MMEXTENSION|;
this
is the signal to the \TeX\ compiler that what normally would be interpreted as
exten instructions in the \verb|.tfm| instead should be seen as pointers to
MM glyphs. (It is unfortunate that the \verb|.tfm| syntax does not
provide any space for new flags; this is what forces us to use the comment
field.) In a \verb|.PL| file, this would appear as
\begin{verbatim}
(CODINGSCHEME MMEXTENSION)
\end{verbatim}

\item Each \verb|exten| specification in the \verb|.tfm| is replaced by the
glyph number of the character to use in the \verb|cmex10mm| MM font. For
example, whereas the \verb|cmex10.pl| listing contains
\begin{verbatim}
(CHARACTER C 0
   (CHARWD R 0.875003)
   (CHARHT R 0.039999)
   (CHARDP R 1.760019)
   (VARCHAR
      (TOP C 0)
      (BOT O 100)
      (REP C B)
      )
   )
\end{verbatim}
specifying that the character \verb|0| is to be built from glyphs
\verb|0|, \verb|`100| and \verb|B|; in \verb|cmex10m.pl| we set

\begin{verbatim}
(CHARACTER C 0
   (CHARWD R 0.875003)
   (CHARHT R 0.039999)
   (CHARDP R 1.760019)
   (VARCHAR
      (REP O 303)
      )
   )
\end{verbatim}
which means that the character \verb|0| is to be built as an instance
of the glyph \verb|`0303| in the corresponding MM font (\verb|cmex10mm|).

\verb|cmex10| and \verb|cmex10m| are otherwise identical.
\end{itemize}

The \verb|mathexmm| style, when used, would load the \verb|cmex10m| font
instead of \verb|cmex10|. Unless extensible characters are invoked, it would
function in exactly the same way as \verb|cmex10|; by when \TeX\ is about to
build an extensible character, it would instead build an appropriately-sized
instance from the \verb|cmex10mm| MM font.

From the point of view of the user, this is all invisible, and no action
is required except for adding \verb|\usepackage{mathexmm}|
in the document preamble for \LaTeXe, or \verb|\input mathexmm|
for Plain \TeX\ and AmS\TeX.

\section{Acknowledgement}

Related ideas previously appeared in [2]; they, however, did not add up a
practically usable implementation as has been done in this work.

\section{Bibliography}


\begin{itemize}
\item[[1]] A.~Kostin \& M.~Vulis, \textit{``Mixing \TeX\ and PostScript: The
\GeX/ Model''}, in TUG 2000 Conference Proceedings.
\item[[2]] J.~Andr\`e \& I.~Vatton, \textit{``Dynamic optical scaling and
variable-sized
characters''}, in Electronic Publishing, Vol. 7(4), 231-250 (Dec 1994).
\end{itemize}

\end{document}

The example below shows the appearance of the MM \verb|\overbrace| glyphs
with the width of the symbols varied:
\smallskip

\noindent\begin{tabular}{|c|c|c|}
\hline
\hbox to 2in{\tt100:\ \ \font\f=cmex10mm[30,100] outline=2\f \char"7A\hss} &
\hbox to 2in{       \ \ \font\f=cmex10mm[30,100] outline=2\f \char"C8\hss} &
\hbox to 2in{       \ \ \font\f=cmex10mm[30,100] outline=2\f \char"CB\hss} \\
\hline
\hbox to 2in{\tt300:\ \ \font\f=cmex10mm[30,300] outline=2\f \char"7A\hss} &
\hbox to 2in{       \ \ \font\f=cmex10mm[30,300] outline=2\f \char"C8\hss} &
\hbox to 2in{       \ \ \font\f=cmex10mm[30,300] outline=2\f \char"CB\hss} \\
\hline
\hbox to 2in{\tt500:\ \ \font\f=cmex10mm[30,500] outline=2\f \char"7A\hss} &
\hbox to 2in{       \ \ \font\f=cmex10mm[30,500] outline=2\f \char"C8\hss} &
\hbox to 2in{       \ \ \font\f=cmex10mm[30,500] outline=2\f \char"CB\hss} \\
\hline
\hbox to 2in{\tt700:\ \ \font\f=cmex10mm[30,700] outline=2\f \char"7A\hss} &
\hbox to 2in{       \ \ \font\f=cmex10mm[30,700] outline=2\f \char"C8\hss} &
\hbox to 2in{       \ \ \font\f=cmex10mm[30,700] outline=2\f \char"CB\hss} \\
\hline
\hbox to 2in{\tt900:\ \ \font\f=cmex10mm[30,900] outline=2\f \char"7A\hss} &
\hbox to 2in{       \ \ \font\f=cmex10mm[30,900] outline=2\f \char"C8\hss} &
\hbox to 2in{       \ \ \font\f=cmex10mm[30,900] outline=2\f \char"CB\hss} \\
\hline
\end{tabular}



\end{document}
