A.9.6 Output and Interfacing
Hidden-surface elimination for 3D graphics is done so as to be independent of display resolution.
A custom-written PostScript interpreter is used to render graphics in the front end.
Notebooks use a custom platform-independent bitmap image format.
The front end uses MathLink both for communication with the kernel, and for communication between its different internal components.
All menu items and other functions in the front end are specified using Mathematica expressions.
Configuration and preference files use Mathematica language format.
The Help Browser is based on Mathematica notebooks generated from the same source code as this book.
Notebooks are represented as Mathematica expressions.
Notebook files contain additional cached outline information in the form of Mathematica comments. This information makes possible efficient random access.
Incremental saving of notebooks is done so as to minimize rewriting of data, moving data already written out whenever possible.
Platform-independent double-buffering is used by default to minimize flicker when window contents are updated.
Autoscrolling uses a control-theoretical mechanism to optimize smoothness and controllability.
All special characters are platform-independently represented using Unicode. Mapping tables are set up for specific Kanji and other fonts.
Spell checking and hyphenation are done using algorithms and a 100,000-word standard English dictionary, together with a 20,000-word technical dictionary, with 5000 Mathematica and other words added. Spelling correction is done using textual and phonetic metrics.
In OSI terms, MathLink is a presentation-level protocol, which can be layered on top of any transport medium, both message-based and stream-based.
MathLink encodes data in a compressed format when it determines that both ends of a link are on compatible computer systems.
MathLink can transmit out-of-band data such as interrupts as well as Mathematica expressions.
When possible MathLink is implemented using dynamically linked shared libraries.
The front end uses a directed acyclic graph to represent the box structure of formatted expressions.
Boxes are interpreted using a two-dimensional generalization of an operator precedence parser.
Incremental parsing is used to minimize structure and display updating.
Character spacing and positioning are determined from font data and operator tables.
Line breaking is globally optimized throughout expressions, based on a method similar to the one used for text layout in TeX.
During input, line breaking is set up so that small changes to expressions rarely cause large-scale reformatting; if the input needs to jump, an elliptical cursor tracker momentarily appears to guide the eye.
Expression formatting uses about 2000 pages of C code.