You are currently viewing a snapshot of taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to, please file a bug.

Fonts for MathML-enabled Mozilla

Fonts to Install
  • On Windows (not Linux), download the font installer and follow the instructions.

  • On the Mac OS X, be sure to avoid bug 228804. Use browsers based on Mozilla Gecko 1.8 or later (such as Firefox 1.5 and later).

    Download the font installer and follow the instructions.

  • On Linux with Xft-enabled builds, you should install the TrueType TeX fonts and Mathematica 4.1 fonts (repeat: 4.1). To install TrueType fonts, simply extract and copy the .ttf files in your ~/.fonts/ directory (create it if you don't have it yet). See also these instructions.

    (To check which Linux build you have, enter about:buildconfig in the address bar of your browser. This lists the options used when building the browser. Your build is Xft-enabled if you see --enable-xft somewhere there.)

  • On Unix/Linux with Xft-disabled builds (i.e., with X11core fonts), you should install the Type1 TeX fonts and Mathematica 4.1 fonts (repeat: 4.1) in PFA and PCF formats. C.f. these instructions.

  • Troubleshooting
Test Drive
The aim is to only see a minimum number of '?' as possible in this list of characters/entities for scientific documents. The list is best viewed with a Unicode-based browser such as Mozilla (a MathML-enabled build gives access to more glyphs via the ucvmath module).

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. A number of these assignments are unfortunately in plane-1 which Mozilla does not yet support. But Mozilla does a good job at handling all the assignments in plane-0, provided the user installs the appropriate fonts.

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 glyph, Mozilla will display a question mark ('?').

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 avoid this, you need to properly install a number of fonts for a better MathML experience with Mozilla. Just having a MathML-enabled build is not enough.

While awaiting the comprehensive set of fonts being made by the STIX project to cover all the symbols in MathML, use the font installers (on the right) to install the fonts on your system if you do not have them already. MIT has developed convenient font installers for Windows and the Mac, following licensing negotiations through this project and staff (especially considering the open-source nature of Mozilla). The respective font owners have made provision for the fonts to be packaged into these installers, with the aim of helping to boost the adoption of MathML into the mainstream.

For your information, recommended fonts include:
  • TeX's Computer Modern Fonts
    The TrueType fonts of interest are provided by virtue of the BakoMa license. The Type1 versions are from AMS. Note that TeX fonts are not bundled in the Mac installer due to bug 161137. You must not install these TeX fonts on the Mac now. To stop Mozilla from popping up the missing font dialog about TeX fonts, just set this pref in your prefs.js (or your user.js):
    user_pref("font.mathfont-family", "Math1, Math2, Math4, Symbol");
  • Mathematica 4.1 Fonts
    The TrueType font packs are provided by Wolfram Research, Inc., for Windows and the Mac. The Type1 versions are in the PFA and PCF formats.

  • Other Fonts
    • MT Extra -- this is only in the Windows installer.
    • Lucida Sans Unicode -- this is not in the installers but it is worth installing (separately) if you can. It contains many useful mathematical symbols. For Windows users, the installation of new fonts is explained in this font installation procedure.
Refer to the instructions on the "Fonts to Install" section above. Unix/Linux users who experience troubles after trying earlier steps should have a look at the suggested troubleshooting links and other general information on troubleshooting Mathematica fonts which might be relevant when configuring the fonts to work with Mozilla.

Known Problems

Reported fonts' problems for which no built-in error recovery mechanism exists in Mozilla (as yet).
  • On the Mac, bug 161137 causes MathML to render wrong symbols if TeX fonts are installed.

  • On Win9x/NT/2000: If you see symbols (like the square-root symbol) that appear jagged, then you are not using TeX fonts from the Bakoma collection.
    Work-around: Download the fonts from the Bakoma collection given above.

Customize the fonts used for stretchy characters

Due to the fact that a browser is used by various users under different configurations, Mozilla's MathML engine doesn't make assumptions on the particular configuration that a viewer may have, and uses a greedy search when looking for the best glyph that fits in a certain situation. As a result, a document is sometimes displayed with a mixture of glyphs with different characteristics because these glyphs happen to be picked from different font families.

It is possible for you, as a viewer, to instruct the MathML engine to only use some of the fonts that you prefer. The following description applies to fonts that only affect stretchy characters. Other characters will continue to be rendered with other fonts (these are also configurable -- but their configuration is not described here). You will have to edit prefs.js in your profile directory (tip: you can also edit your preferences by entering about:config in the address bar).

To illustrate the impact of the choice of fonts, here are screenshots of a same page rendered with different stretchy font settings. These will give you a precise idea why it is academical/subjective, but still itchy enough for some people to insist on one or the other, just like one person might prefer Times while another prefers Verdana. The screenshots use an excerpt from the GNU Scientific Library manpage (c.f. bug 118475):

  1. Default screenshot: this is the default rendering obtained with the default installation.

  2. Mathematica screenshot: this is the rendering obtained by instructing the MathML engine to use Mathematica fonts when a character is being stretched. This can be achieved by adding this line in your prefs.js:
    user_pref("font.mathfont-family", "Math1, Math2, Math4, Symbol");
  3. TeX screenshot: this is the rendering obtained by instructing the MathML engine to use TeX's Computer Modern fonts when a character is being stretched. This can be achieved by adding this line in your prefs.js:
    user_pref("font.mathfont-family", "CMSY10, CMEX10, Symbol");

As a web viewer reading pages produced by others, it is possible for you to set the list differently from the examples above. In fact, it is possible to specify fonts per each individual stretchy character (in the file which contains some of the encoding data of MathML characters).

The recommended rule of thumb is to install all the fonts (if possible) but use the above screenshots to decide whether you prefer stretchy characters to be rendered by TeX fonts or Mathematica fonts, then set the font.mathfont-family accordingly. The reasoning here is that some of these fonts also contain normal (i.e., non stretchy characters) and you don't want to lose them, if possible. Both TeX fonts and Mathematica fonts work fine on Windows and Linux. As indicated above, TeX fonts cause troubles on the Mac and so Mathematica fonts are preferred there even for normal characters (see also bug 228804 comment 32).

As a web author producting pages to be read by others, it is also possible for you to instruct their MathML engine to only use some of the fonts that you prefer for your documents (see the documentation in mathml.css, and how this is used to setup the alternate stylesheets that appear in the demos of MathML tags). The caveat to remember:

  • if a viewer has set the pref above, the fonts selected from your list are checked against the list that the viewer has chosen.

  • viewers can choose to override document fonts altogether (by visiting the Fonts pref dialog and unchecking the pref to allow document fonts in the usual way).

Roger B. Sidje <>