1 The Web Platform

1.3 Styling of Mathematics

As seen in section 1.2, one can use CSS the standard way to apply specific styles to mathematical equations. However, perhaps the most important style that scientists and publishers want is the rendering with a given mathematical font. Gecko has always used TeX heuristics to position scripts, fractions, roots, etc. However, there are many parameters that depend on
fontdimen parameters and others on built-in rules in TeX’s typesetting engines, which are not exposed to a HTML5 rendering engine a priori [Vieth]. Moreover, in order to draw stretchy and large operators the MathML code requires to pick and assembly specific glyphs from math fonts. So far, Gecko only knows a limited set of Unicode constructions and also has a few private per-font tables. This means that without one of the supported fonts installed, the quality of the MathML rendering could be very low.

In order to solve that problem, we have started to implement the OpenType MATH table which is currently undergoing standardization as ISO/IEC CD 14496-22 “Open Font Format” [MPEG1]. We have started to use this table in order to provide a generic support for MATH fonts and a partial support is available in Firefox 31. Note that MathML does not specify a precise way to render mathematical formulas and leave the details to the implementers. Relying on the MATH table will give more control to professional font designers. In a nutshell, the main features are:

  1. 1.

    Some OpenType Tags to provide alternate form of glyphs. For example, we implemented the ”ssty” feature to adjust the size of glyphs like primes when they are used as scripts.

  2. 2.

    Font parameters to define precisely the gaps, shifts, kerning, etc. of mathematical objects. Most of them are extensions to the TeX rules so it is easy to integrate them into our MathML rendering engine.

  3. 3.

    Font parameters specific to each glyph. At the moment, we only considered italic corrections.

  4. 4.

    A table to draw stretchy and large operators such as parenthesis, radicals or summation symbols. We have started to use that table for our operator stretching code.

There are various mathematical fonts with an OpenType MATH table available and most of them are distributed with a TeX Live distribution. Windows and Mac systems have respectively Cambria Math and STIX installed by default. We have also experimented with PackageKit auto-installation on Linux [PackageKit], we plan to install math fonts on Firefox OS and tried other another auto-installation method for Android. In any case, fallback downloadable Web fonts can also be used. This means that missing mathematical fonts will become very unlikely in the future.

The page demos/4-mathml-fonts.html shows how to get various font style for a document: Asana, TeX Gyre Bonum, TeX Gyre Pagella, TeX Gyre Termes, Latin Modern, Neo Euler and XITS. You need a browser with Gecko 31 or higher in order to see the appropriate rendering.