We want to help developers like you. Tell us about how you work: http://qsurvey.mozilla.com/s3/Developer-Audience-Survey-V2/?s=mdn

# Fonts for Mozilla's MathML engine

These instructions are for Gecko 31.0 (Firefox 31.0 / Thunderbird 31.0 / SeaMonkey 2.28) and higher. For former versions see Fonts for Mozilla 1.8, Fonts for Mozilla 1.9 or Fonts for Mozilla 2.0.

## Installation Instructions

### Windows

Install the Latin Modern Math and STIX fonts as follows:

• Open the ZIP archive, move inside the latinmodern-math-1959 directory and then inside the otf directory. You will find a latinmodern-math font file.
• Open the latinmodern-math font file and click the Install button.
• Open the ZIP archive, move inside the Fonts directory and then inside the STIX-Word directory. You will find the STIXMath-Regular, STIX-Regular, STIX-Bold, STIX-Italic, STIX-BoldItalic font files.
• Open the STIXMath-Regular font file and click the Install button. If desired, you may also do the same for the other font files.

Note: Cambria Math is installed by default on Windows 7 and later versions and should ensure relatively good MathML rendering. An enhancement request has been submitted to Microsoft to install Latin Modern Math and STIX by default.

Warning: On some versions of Windows prior to Gecko 41.0 (Firefox 41.0 / Thunderbird 41.0 / SeaMonkey 2.38), you may be affected by a rendering bug causing excessive line height. This bug still happens with the latest STIX fonts (1.1.1).

### Mac

Install the Latin Modern Math and STIX fonts as follows:

• Extract the ZIP archive, move inside the latinmodern-math-1959 directory and then inside the otf directory. You will find a latinmodern-math font file.
• Double-click the latinmodern-math font file and follow the on screen prompts to install the font.
• Open the ZIP archive, move inside the Fonts directory and then inside the STIX-Word directory. You will find the STIXMath-Regular, STIX-Regular, STIX-Bold, STIX-Italic, STIX-BoldItalic font files.
• Open the STIXMath-Regular font file and follow the on screen prompts to install the font. If desired, you may also do the same for the other font files.

Note: A deprecated version of STIX is preinstalled starting with OS X Lion and should ensure relatively good MathML rendering. Enhancement requests have been submitted to Apple to ship OpenType MATH fonts in the default installation. If you have a developer account, these are problems 16841023 and 17021145.

### Linux

Install the Latin Modern Math, STIX or XITS fonts, which are generally available from your package manager.

On Debian/Ubuntu/Mint and other Debian-based distributions, use the following command:

sudo apt-get install fonts-lmodern fonts-stix

On Fedora and other Fedora-based distributions, use the following command (stix-math-fonts is often already installed):

sudo dnf install texlive-lm-math stix-math-fonts

On openSUSE and other openSUSE-based distributions, use the following command:

sudo zypper install texlive-lm-math stix-fonts

On other Linux distributions, consider installing appropriate texlive packages, which includes Latin Modern Math and XITS:

sudo pacman -S texlive-core textlive-fontsextra # Arch Linux
sudo urpmi texlive-dist texlive-fontsextra # Mageia


However, you might need to ensure that the fonts are known by your system. Typically,  use a fontconfig configuration /etc/fonts/conf.avail/09-texlive-fonts.conf that points to the opentype directory of TeXLive, such as

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/your/path/to/texmf-dist/fonts/opentype</dir>
</fontconfig>

Finally, add this configuration file to the system font location list and regenerate the fontconfig cache:

ln -sf /etc/fonts/conf.avail/09-texlive-fonts.conf /etc/fonts/conf.d/
fc-cache -sf


### Android

You must use the MathML-fonts add-on.

Note: A pull request has been opened on Android to integrate Latin Modern Math into the default installation. Also there is an enhancement request to add a MATH table to Noto fonts.

### Firefox OS

You must use the MathML-fonts add-on.

Note: We plan to bundle a MATH font in the default installation.

### Other systems

On other systems, consider installing a MATH font using your package manager. Note that these fonts are generally delivered with TeX distributions such as TeX Live, but you might need to follow specific instructions so that your system is aware of the fonts. As a last resort, install the MathML fonts add-on.

### Arabic Mathematical Alphabetic Symbols

Currently, very few fonts have appropriate glyphs for the Arabic Mathematical Alphabetic Symbols. If you are likely to need these characters, we recommend to install the XITS or Amiri fonts. A bug has been reported to the STIX consortium to add coverage for these characters.

### Reset old setup

If you had already installed MathML fonts for a previous version of Gecko, it is best to reset your setup:

• The STIX consortium provides several sets to use in various situations ; the recommended one is now the STIX Word (STIX-Regular.otf, STIX-Bold.otf, STIX-BoldItalic.otf and more importantly STIX-Math.otf) while the STIX General set (about 30 files) is now deprecated. Similarly, the MathJax TeX fonts are now deprecated in favor of the Latin Modern Math font which provides the style of the popular Computer Modern. If you don't need STIX General or MathJax TeX for another application, you can just uninstall them. At the moment, you can still use them but note that we plan to remove support for these fonts in the future. Support for MathJax TeX fonts has been removed from Gecko 41.0 (Firefox 41.0 / Thunderbird 41.0 / SeaMonkey 2.38).
• If you had install the MathML fonts package using the Windows installer, you can uninstall it (this will remove the STIX General, MathJax TeX and Asana Math fonts).
• If you had install the MathML fonts add-on, you can upgrade to version >= 2.1 to use the new XITS Math and Latin Modern Math fonts.  It might be a good idea to check the instructions below and uninstall the add-on if it is no longer necessary.
• If you had previously changed the font.mathfont-family preference, 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.

## Fonts with a MATH table

Gecko's MathML layout algorithm has long been based on some TeX rules and private per-font tables. Unfortunately, this did not always work well with the modern OpenType/TrueType Unicode fonts used by browsers and installed by default on various systems. If one of the few mathematical fonts supported by Gecko were not installed on the user system, then the MathML rendering could be very poor.

Starting with Gecko 31 (Firefox 31.0 / Thunderbird 31.0 / SeaMonkey 2.28), it is recommended to use OpenType fonts that have a MATH table. This table is based on the TeX rules and was designed by Microsoft for Microsoft Word, it has been implemented in many modern TeX typesetting systems and has been integrated in version 3 of the Open Font Format. See the implementation status on the Mozila wiki.

Here is a list of known fonts with a MATH table. Starting with Gecko 41.0 (Firefox 41.0 / Thunderbird 41.0 / SeaMonkey 2.38),  you can use the advanced font preference menu to configure the default for mathematics. Alternatively, you can try the MathML-fontsettings add-on for Gecko 31 (Firefox 31.0 / Thunderbird 31.0 / SeaMonkey 2.28) and higher.

## Using mathematical fonts on Web pages

Starting with Gecko 31.0 (Firefox 31.0 / Thunderbird 31.0 / SeaMonkey 2.28), it is now easy to set up the CSS style (and optional WOFF fonts) to use on your Web site. See the Authoring MathML page for details and try the MathML Torture Test. You can use FontForge and FontTools to edit the MATH table and create your own mathematical fonts.

Tags: