Tombstone
mathml
Aug 2003 · age 21
What it was
"phpMathML", a server-side renderer for Content MathML, written in one week of August 2003 because browsers could not display math and Jeff wanted to post mathematics online. A page opted in with a comment marker; each formula block was replaced by an image whose address carried the formula, hex-encoded. On the server, the XML was parsed into a node table and compiled into a string of PHP calls, which was then evaluated to build the picture as a box model: every glyph a measured box, joined left to right and top to bottom, aligned around operators, wrapped in parentheses. Seven homemade TrueType fonts supplied the pieces, so a tall parenthesis or integral was a stack of tiled glyphs. GD drew the result as a JPEG, and a second back end produced HTML tables. The demo went live; the status sheet said 40 percent of tags were supported.
Wins, for the age
- At twenty-one, in one week, Jeff rediscovered TeX's boxes and glue in PHP arrays: measure, box, join, align.
- Built seven fonts as a rendering toolkit, where letters stood for parenthesis segments and integral pieces, finding on their own what TeX's extensible delimiters had already found. A primate who needed a stretchy bracket and simply drew one.
- Wrote a real compiler whose back end was one line, and retargeted it from images to HTML by swapping a prefix.
- Added baselines two days later, so superscripts and fractions could sit on the text line. Wrote a mission statement and a status sheet, and honestly reported the 40.
What it taught
- How typesetting actually works, from the inside. The understanding outlived the product by twenty years.
- A back end can be trivial if the intermediate form is the host language, and that is a terrible idea on a public server. Formula text went unescaped into evaluated code, an injection hole this primate did not think twice about.
- Font editing well enough to treat type as an engineering resource.
- Hand-made safety copies are what version control replaced.
Genealogy
Ancestors: Memorando: software for learners, now wanting to show real mathematics. Descendants: Edu Lang: teaching output rendered straight to the browser. HUROX Compilers: templates compiled into host-language code. Jovian Suite: a compiler whose output was a web page. Tutor: a box-model equation typesetter, rebuilt in GDI+.
Epitaph
Here lies phpMathML, which typeset integrals from a font where E was the middle of the sign, and evaluated whatever you sent it.