The Geometry of the Letter S: Donald Knuth's Quest for Typographic Precision
In the world of typography, most letters are relatively straightforward to define geometrically. A vertical line, a circle, or a simple angle can describe the majority of the alphabet. However, as Donald Knuth discovered during the development of his typesetting system, there is one outlier: the letter 'S'.
In his 1980 paper, The Letter S, Knuth details a three-day struggle to mathematically define a proper 'S'. This effort was not merely an exercise in aesthetics but a fundamental requirement for his broader goal: creating a parameterized system for font design. This pursuit eventually led to the creation of METAFONT, a language designed to describe character shapes as mathematical functions rather than static outlines.
The Challenge of the 'S'
Knuth notes that while 25 of the letters in the English alphabet are comparatively easy to handle, the 'S' resists simple definition. The difficulty lies in the transition between its curves and the straight segments that often form its middle. A visually pleasing 'S' requires a delicate balance of curvature and slope to avoid looking "crooked" or unnatural.
To understand the problem, Knuth first looked back at the Renaissance. He analyzed the work of Francesco Torniello (1517), who attempted to "square the S" using a ruler and compass. By translating Torniello's geometric instructions into modern Cartesian coordinates, Knuth revealed the inherent flaws in early constructions. Specifically, he found that Torniello's method resulted in abrupt shifts in direction at the junction points—mathematical discontinuities that are barely noticeable to the human eye at small scales but become glaringly apparent when enlarged.
From Static Shapes to Variable Parameters
Knuth's objective was not to draw a single, perfect 'S', but to solve what Alan Perlis called "the art of making constant things variable." In typography, this means creating a set of principles that allow a designer to generate infinitely many variations of a letter—such as bold or italic versions—by adjusting a few parameters while maintaining a compatible look across the entire alphabet.
To achieve this, Knuth moved beyond circular arcs to ellipses. He posed a specific mathematical problem: finding an ellipse that is tangent to a straight line of a given slope and passes through specific top and side points. This required solving a system of simultaneous quadratic equations.
Interestingly, Knuth discovered that these equations yielded purely rational expressions as their roots. He also noted a curious failure of early computer algebra systems; while MACSYMA could solve the simplified versions of these equations in seconds, it crashed when asked to solve the original, more complex system, highlighting the importance of the mathematical transformation Knuth performed to make the problem tractable.
The Crossover Problem and Mathematical Rigor
Even with elliptical arcs, Knuth encountered a "disastrous" effect when enlarging his letters: the crossover problem. If the width of the stroke was not carefully managed, the inner boundary of the 'S' could cross the outer boundary, creating an unintentional calligraphic effect where the letter effectively folded into itself.
To solve this, Knuth derived a necessary and sufficient condition using power series to ensure the curves never cross. He determined that the curves remain distinct if and only if the ratio of the vertical distance to the square of the horizontal distance is maintained across both the inner and outer ellipses:
$$\frac{Y_t - Y_{l1}}{(X_t - X_{l1})^2} > \frac{Y_t - Y_{l2}}{(X_t - X_{l2})^2}$$
Legacy and Influence
Knuth's obsession with the 'S' was part of a larger journey. As noted in community discussions, his drive to create TeX and METAFONT was sparked by a desire to ensure that the second edition of The Art of Computer Programming (TAOCP) looked exactly like the first, despite the obsolescence of the hot-lead Linotype machines used for the original.
This mathematical approach to typography shifted the focus from drawing outlines to modeling the ductus—the movement of the pen. While modern font design often relies on Bézier curves, Knuth's work remains a foundational example of using analytic geometry to solve design problems. Today, this legacy persists in specialized font build systems, such as Iosevka's PatEL, which uses a domain-specific language to define glyphs through decomposed sub-functions, mirroring the parameterized spirit of METAFONT.
As one former font designer noted in the comments of the original post, the 'S' is often the litmus test for any typeface: "I always designed the S first, because if I couldn't get the S to work, there was no fuckin' point."