\chapter{Applications in font design}
\label{fonts-chapter}

A major motivation for this work is to develop better tools for
producing fonts.

Existing font formats in the literature use many different
representations of the curves. Usually the user interface for
designing the curves corresponds closely to the representation. Today,
by far the most common representation is B\'ezier curves, both cubic
in the case of PostScript Type 1 fonts \cite{Type1Spec}, and quadratic
in the case of TrueType fonts \cite{TrueTypeSpec}. (The more recent
OpenType specification \cite{OpenTypeSpec} can serve as a container
for either of these two underlying formats).

However, a number of alternate formats, popular in their day, use
other techniques. Metafont \cite{Hobby85} and Ikarus \cite{Karow87},
in particular, both used their own flavor of interpolating
splines. Perhaps not coincidentally, both these formats supported
\emph{variation,} or representing a parametrized family of shapes
rather than a single static outline.

Font shapes have a number of requirements beyond simple interpolating
splines. The shapes of outlines have corners and straight line
sections in addition to smooth curves. In general, the outlines
forming a letter shape are closed, although in general not entirely
made from smooth points like the inner and outer contours of a typical
`o'.

\renewcommand{\arraystretch}{1.2}
\begin{table}[ht]
\label{constraint-legend-table}
\[
\begin{array}{llll}
\mbox{\textbf{Type of constraint}} &
\mbox{\textbf{Symbol}}
 \\
\hline
\mbox{Left endpoint} &
\includegraphics[scale = 0.8]{figs/cpoint-left} \\
\hline
\mbox{Right endpoint} &
\includegraphics[scale = 0.8]{figs/cpoint-right} \\
\hline
G^2\ \mbox{curve point} &
\includegraphics[scale = 0.8]{figs/cpoint-g2} \\
\hline
G^4\ \mbox{curve point} &
\includegraphics[scale = 0.8]{figs/cpoint-g4} \\
\hline
\mbox{One-way (curve to terminal)} &
\includegraphics[scale = 0.8]{figs/cpoint-ctt} \\
\hline
\mbox{One-way (terminal to curve)} &
\includegraphics[scale = 0.8]{figs/cpoint-ttc} \\
\hline
\end{array}
\]
\caption{Constraints used to draw font outlines.}
\end{table}
\renewcommand{\arraystretch}{1.0}

Further, letter-shapes often contain transitions between straight and
curved sections. These shape patterns are easily expressed using the
constraints described in Section \ref{sec-constraints}, and the
results preserve $G^2$-continuity, yielding visually smooth
transitions. Table \ref{constraint-legend-table} summarizes these
constraints, as well as the visual symbol used to represent them, used
consistently in the following font outlines.

\begin{figure*}
\begin{center}
\includegraphics[scale=1]{figs/inco1}
\caption{\label{inco1}Selected glyphs from Inconsolata.}
\end{center}
\end{figure*}

\begin{figure*}
\begin{center}
\includegraphics[scale=1]{figs/inco2}
\caption{\label{inco2}Selected glyphs from Inconsolata.}
\end{center}
\end{figure*}

Inconsolata is an original design by the author, drawn entirely using
the splines described in this thesis. Most of the lowercase alphabet
is shown in Figures \ref{inco1} and \ref{inco2}. Most of the curves
were drawn using $G^4$-continuity, but using some $G^2$ points when
curvature varies more dramatically, for example in the inner curve of
the tail of the `g'. Of course, straight-to-curve transitions (which
have $G^2$-continuity) are used extensively as well, for example in the
`u'.

The design intent is classical, and draws inspiration from such metal
types as the Franklin Gothic series by Morris Fuller Benton (see
\cite[p. 142]{McGrew93} for showings of this and many other metal
fonts), as opposed to more recent designs such as TheSans Mono, which
show their B\'ezier underlying format rather clearly.

Inconsolata is also used for the \texttt{typewriter} style in the
formatting of this thesis.

% These are not made using the Makefile in figs, but, rather, use
% multishow{1,2} in the font directory.
\begin{figure*}
\begin{center}
\includegraphics[scale=1]{figs/baskital1}
\caption{\label{baskital1}Selected glyphs from Baskerville Italic.}
\end{center}
\end{figure*}

\begin{figure*}
\begin{center}
\includegraphics[scale=1]{figs/baskital2}
\caption{\label{baskital2}Selected glyphs from Baskerville Italic.}
\end{center}
\end{figure*}


% Not under Makefile. Use this process:
% from ~/fonts/baskerville
% convert bask_ital_w.png -gamma 0.6 -unsharp 1x1+5+0 -resize 200% -depth 8 /tmp/foo.png && pngtopnm /tmp/foo.png | ppmtopgm | pgmtoppm rgb:2/0/0-white  > /tmp/foo.ppm
% strip the actual curve into bask_ital_w.ps
% ps2pdf -dEPSCrop bask_ital_w.ps ~/Desktop/Stuff/phd/figs/bask_ital_w.pdf 
\begin{figure*}
\begin{center}
\includegraphics[scale=2.5]{figs/bask_ital_w}
\caption{\label{baskitalw}Lowercase `w' from Baskerville Italic, scan
  with outline.}
\end{center}
\end{figure*}

Figures \ref{baskital1} and \ref{baskital2} show a lowercase alphabet
carefully traced from ATF Baskerville Italic (again, see
\cite[p. 26]{McGrew93} for a sample). These outlines generally use
$G^4$-continuous constraints, and often use one-way constraints to
isolate sections of high curvature. Very special care was taken to
trace the outlines faithfully. Figure \ref{baskitalw} shows one scan
(enlarged $25\times$ from the original) with the outline superposed.

\begin{figure*}
\begin{center}
\includegraphics[scale=0.85]{figs/ceccocaps1}
\caption{\label{ceccocaps1}Selected glyphs from Cecco.}
\end{center}
\end{figure*}

\begin{figure*}
\begin{center}
\includegraphics[scale=0.85]{figs/ceccocaps2}
\caption{\label{ceccocaps2}Selected glyphs from Cecco.}
\end{center}
\end{figure*}

Figures \ref{ceccocaps1} and \ref{ceccocaps2} are a draft of the
capital letters from Cecco, a more recent original design by the
author. As opposed to Inconsolata, the curves were drawn primarily
with $G^2$-continuous curves. These curves are visually just as smooth
as the $G^4$, and fewer points were needed, in general, to describe
them. These shapes are also classical, inspired in large part by
Pacioli by Giovanni Mardersteig \cite{Mardersteig}. 

\begin{figure*}[tbh]
\begin{center}
\includegraphics[scale=1.25]{figs/karow-a.pdf}
\raisebox{.08in}{\includegraphics[scale=0.5]{figs/karow-a-spiro.pdf}}
\caption{\label{ikarus-fig-compare}Typical letter-shape using IKARUS, with
  Spiro comparison.}
\end{center}
\end{figure*}

\begin{figure*}
\begin{center}
\includegraphics[scale=.8]{figs/a_thin}
\hspace{10mm}
\includegraphics[scale=.8]{figs/a_fat}
\caption{\label{asources}Interpolation masters.}
\end{center}
\end{figure*}

\begin{figure*}
\begin{center}
\includegraphics[scale=.8]{figs/ainterpfill}
\caption{\label{ainterp}Interpolation between extremes.}
\end{center}
\end{figure*}

\begin{figure*}
\begin{center}
\includegraphics[scale=.8]{figs/ainterpseq}
\caption{\label{ainterpseq}Interpolation between extremes, superimposed.}
\end{center}
\end{figure*}

Many interpolating splines in the literature are used for generating
\emph{variations} in fonts, rather than a single static shape. Since
fonts are desired in a wide range of weights, one of the more common
applications is to generate these continuously. One of the most
straightforward techniques, pioneered by Ikarus \cite{Karow87}, is to
start with two masters with similar structure, representing thin and
thick extremes, and linearly interpolate the positions of the control
points between the two. Then, an interpolating spline is fit through
these control points. Note that there are \emph{two} senses of
interpolation here -- one for the control points, another for the
spline.

The splines described in this thesis work especially well for such
interpolation. An example interpolation is shown in Figure
\ref{ainterp}, derived from the masters in Figure \ref{asources}. Figure \ref{ainterpseq} more clearly shows the nature of this
interpolation, with the linear motion of the control points with
respect to the interpolation parameter represented by the equal
spacing of the resulting contour lines.


One advantage of the splines of this thesis over the Ikarus spline is
that fewer control points are needed to achieve good smoothness, as
shown in Figure \ref{ikarus-fig-compare}. As can be seen,
approximately half as many control points are needed, and the
smoothness and quality of the result is favorable. Second, the one-way
constraints are more robust under interpolation than ordinary
interpolating splines, for such things as straight-to-curve joins, as
in the upper right corner curve of this ``a''. In particular,
$G^2$-continuity is always preserved.

\begin{figure*}
\begin{center}
\includegraphics[scale=.8]{figs/bezinterp}
\caption{\label{fig-bezinterp}Interpolation between cubic B\'eziers fails to preserve $G^1$-continuity.}
\end{center}
\end{figure*}

By contrast, as shown in Figure \ref{fig-bezinterp}, interpolation between
two curves defined by multiple cubic B\'ezier segments doesn't
preserve even $G^1$-continuity, and a ``kink'' can appear, even when
the source curves have a high degree of continuity (in this case,
$G^\infty$ across the join, because both source curves have been
subdivided from a single B\'ezier curve). Even though the
figure shows a fairly extreme example, it is likely that unless
special care is taken, small discontinuities can arise in ordinary use
(perhaps a degree or less, so barely visible). Such cases
particularly arise when interpolating between different widths, as in
this example; it requires special care to place the subdivisions so
that the interpolations are continuous.

In this particular example, the interpolation master curves are
subdivided from a single B\'ezier segment. If the subdivision point
had been chosen at the same paramter for both, then the result would
have been at least $G^1$-continuous. Alternatively, if the curves had
been subdivided at the point of the same tangent angle, the result
also would have been $G^1$-continuous. It is certainly possible for
designers to carefully choose subdivision points to achieve smooth
results, as witnessed by a relatively small number of Multiple Master
releases from designers such as Robert Slimbach. However, this
requirement leads to a steeper learning curve and entails ongoing
difficulties in use. Using a spline that is $G^2$-continuous by
construction promises to be better in both respects, and make the
design of fonts with variation more accessible and productive than
with previous tools.
