Fonts for MathML-enabled Mozilla

MathML has over 2000 predefined entities, many of which are associated to various symbols used in mathematics and science. Recently, assignments for these symbols were approved by the Unicode Consortium. Mozilla can display any of these symbols provided suitable Unicode fonts are installed.

Mozilla is internally Unicode-based. Furthermore, in accordance with the W3C CSS2 recommendation on fonts, authors can specify an ordered list of particular fonts which they prefer (using the font-family property of CSS), with the assurance that Mozilla's font engine will hunt for alternate fonts whenever their specified fonts are not found on a particular user' system. If no appropriate font is ultimately found for a given character, Mozilla will instead display a box containing the hexadecimal representation of the Unicode code point for the character.

It follows that, on two similar systems, while one user may see a document rendered correctly, the other user may see something completely different. To see MathML as intended, you need sufficient font support, which may mean installing some fonts. Just having a MathML-enabled browser is not necessarily enough.

Note: These instructions are for Mozilla 1.9 (Firefox 3) and later. For former versions see Fonts for Mozilla 1.8.

STIX Fonts

The STIX Fonts Project has been developing a comprehensive set of fonts that cover all the symbols in MathML. A copy of these fonts is provided on this wiki and should be installed for best MathML rendering. For Mozilla 2.0 (including Firefox 4), one can simply use the Zip archive of STIX fonts 1.0. Users of Mozilla 1.9 (including Firefox 3) should download a Zip archive of STIX fonts 1.0 + additional fonts from STIX Beta. Indeed, even if STIX fonts 1.0 are already installed on your system, you need the STIXSiz*.odf fonts provided in this archive. 

The fonts may be installed by extracting the font files (which have the ".otf" extension) from the Zip archive, then following instructions for Microsoft Windows, or copying the files to a "~/Library/Fonts" folder on Mac OS X, or to a "~/.fonts/" directory (which may need to be created) on Unix/Linux systems. Alternatively, follow dafont's "How to install a font".

(These fonts are OpenType PostScript fonts, which are supported by most modern operating systems. However some operating systems (including OS/2) may not support these fonts. On such systems [only systems without support for OpenType Postscript fonts], it will be necessary to convert the fonts to a supported format or use an unofficial TrueType conversion.)

Reset Old Preferences

If users have previously changed the "font.mathfont-family" preference for a previous version of Mozilla, then it is best to reset this to the default value. To do this, enter the URL "about:config", "Filter" for "mathfont", and "Reset" to the default value through the context menu on the preference.

Other fonts

It may be best to uninstall BaKoMa TrueType Computer Modern fonts if these have been installed (perhaps for a previous version of Mozilla) because these fonts use a character encoding that is inconsistent with Unicode recommendations. These fonts are not normally used, and thus may not cause problems, but if a document explicitly requests font-family "CMSY10" or "CMEX10" or similar, and the BaKoMa fonts are installed, then they will get used, which will likely result in the wrong symbols being shown.

There are some other fonts that provide good Unicode support for most mathematical characters, but without STIX fonts some stretchy operators will not stretch to the appropriate size in Mozilla. Most notably, radical signs and under- and over-braces will not stretch to fit their content without STIX fonts.

Stretched operators are drawn by using glyphs for larger variants of the character or by assembling glyphs for a few pieces of the character. These variant or part glyphs do not in general have Unicode assignments, and so font-specific support is required for some characters. Mozilla 1.9 has general support for the common delimiters and arrows that have the necessary Unicode assignments. For other characters, there is font-specific support only for STIX fonts.

The following fonts are not necessary when the STIX fonts are installed, but are worth noting because of their Unicode support for many mathematical characters.

  • Asana Math is freely available under the SIL Open Font License and has good support for mathematical characters. The font contains the necessary glyphs for stretchy operators. Support for Asana Math has been introduced in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4) .

  • DejaVu Serif and DejaVu Sans are freely available and installed with many Linux distributions. They contain support for many mathematical characters, and Mozilla will display some MathML reasonably on systems with these fonts installed, even without STIX fonts. The font only contains glyphs for stretchy operators that have Unicode assignments.

  • Cambria Math is preinstalled on Microsoft Windows Vista, and also comes with Miscrosoft Office 2007 or Microsoft PowerPoint Viewer 2007. The font has good support for mathematical characters, and so, with any of these products installed, Mozilla will be able to display some MathML reasonably even without STIX fonts. The font contains the necessary glyphs for stretchy operators but Mozilla does not yet make use of all of these. The license allows you to "use this font as permitted by the EULA for the product in which this font is included to display and print content", so consulting your lawyer is recommended if considering installing this on systems without the associated product.

  • On Mac OS X, the Apple's "Apple Symbols" and "Symbol" fonts provide support for many mathematical characters, so Mac users can view some MathML reasonably even without STIX fonts installed.

Both Asana Math and Cambria Math include a MATH table as an extension to OpenType that would enable selecting glyphs for stretchy operators in a not-so-font-specific manner, but Mozilla does not yet make use of this.

Original Document Information

  • Author(s): Roger B. Sidje and Karl Tomlinson
  • Other Contributors: Frédéric Wang
  • Last Updated Date: March 31, 2010
  • Copyright Information: Portions of this content are © 1999-2010 by individual mozilla.org contributors; content available under a Creative Commons license | Details.

Tags (2)

Edit tags

Attachments (3)

Attach file