Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1030386 of Fonts for Mozilla's MathML engine

  • Revision slug: Mozilla/MathML_Project/Fonts
  • Revision title: Fonts for Mozilla's MathML engine
  • Revision id: 1030386
  • Created:
  • Creator: fred.wang
  • Is current revision? No
  • Comment
Tags: 

Revision Content

These instructions are for Gecko 31.0 {{GeckoRelease("31.0")}} 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:

  • Download latinmodern-math-1959.zip.
  • 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.
  • Download STIXv1.1.1-word.zip.
  • 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 {{GeckoRelease("41.0")}}, 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:

  • Download latinmodern-math-1959.zip.
  • 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 click the "Install the font" button from the window that opens.
  • Download STIXv1.1.1-word.zip.
  • 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 the font" button from the window that opens. 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 {{GeckoRelease("41.0")}}.
  • 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 {{GeckoRelease("31.0")}}, 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 {{GeckoRelease("41.0")}},  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 {{GeckoRelease("31.0")}} and higher.

Using mathematical fonts on Web pages

Starting with Gecko 31.0 {{GeckoRelease("31.0")}}, 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.

Revision Source

<div class="note">These instructions are for Gecko 31.0 {{GeckoRelease("31.0")}} and higher. For former versions see<a href="/en/Mozilla/MathML_Project/FontsMozilla1.8" title="en/Mozilla MathML Project/FontsMozilla1.8"> Fonts for Mozilla 1.8</a>, <a href="/en/Mozilla/MathML_Project/Fonts_for_Mozilla_1.9's_MathML_engine" title="en/Mozilla_MathML_Project/FontsMozilla1.9">Fonts for Mozilla 1.9</a> or <a href="/en/Mozilla/MathML_Project/FontsMozilla2.0" title="en/Mozilla MathML Project/FontsMozilla1.8">Fonts for Mozilla 2.0</a>.</div>

<h2 id="Installation_Instructions">Installation Instructions</h2>

<h3 id="Windows">Windows</h3>

<p>Install the <em>Latin Modern Math</em> and <em>STIX</em> fonts as follows:</p>

<ul>
 <li>Download <a href="https://www.gust.org.pl/projects/e-foundry/lm-math/download/latinmodern-math-1959.zip">latinmodern-math-1959.zip</a>.</li>
 <li>Open the ZIP archive, move inside the&nbsp;<code>latinmodern-math-1959</code> directory and then inside the <code>otf</code> directory. You will find a <code>latinmodern-math</code> font file.</li>
 <li>Open the <code>latinmodern-math</code> font file and click the <code>Install</code> button.</li>
 <li>Download <a href="https://sourceforge.net/projects/stixfonts/files/Current%20Release/STIXv1.1.1-word.zip/download">STIXv1.1.1-word.zip</a>.</li>
 <li>Open the ZIP archive, move inside the <code>Fonts</code> directory and then inside the <code>STIX-Word</code> directory. You will find the <code>STIXMath-Regular</code>, <code>STIX-Regular</code>, <code>STIX-Bold</code>, <code>STIX-Italic</code>, <code>STIX-BoldItalic</code> font files.</li>
 <li>Open the <code>STIXMath-Regular</code> font file and click the <code>Install</code> button. If desired, you may also do the same for the other font files.</li>
</ul>

<p><u>Note:</u> <em>Cambria Math</em> is installed by default on Windows 7 and later versions and should ensure relatively good MathML rendering. <a href="https://windows.uservoice.com/forums/265757-windows-feature-suggestions/suggestions/9727281-add-new-math-fonts-latin-modern-math-and-stix-2">An enhancement request has been submitted to Microsoft to install Latin Modern Math and STIX by default</a>.</p>

<p><u>Warning:</u> On some versions of Windows prior to&nbsp;Gecko 41.0 {{GeckoRelease("41.0")}}, you may be affected by a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=598900">rendering bug causing excessive line height</a>. <a href="https://sourceforge.net/p/stixfonts/tracking/64/">This bug still happens with the latest STIX fonts (1.1.1)</a>.</p>

<h3 id="Mac">Mac</h3>

<p>Install the <em>Latin Modern Math</em> and <em>STIX</em> fonts as follows:</p>

<ul>
 <li>Download <a href="https://www.gust.org.pl/projects/e-foundry/lm-math/download/latinmodern-math-1959.zip">latinmodern-math-1959.zip</a>.</li>
 <li>Extract the ZIP archive, move inside the&nbsp;<code>latinmodern-math-1959</code> directory and then inside the <code>otf</code> directory. You will find a <code>latinmodern-math</code> font file.</li>
 <li>Double-click the <code>latinmodern-math</code> font file click the "Install the font" button from the window that opens.</li>
 <li>Download <a href="https://sourceforge.net/projects/stixfonts/files/Current%20Release/STIXv1.1.1-word.zip/download">STIXv1.1.1-word.zip</a>.</li>
 <li>Open the ZIP archive, move inside the <code>Fonts</code> directory and then inside the <code>STIX-Word</code> directory. You will find the <code>STIXMath-Regular</code>, <code>STIX-Regular</code>, <code>STIX-Bold</code>, <code>STIX-Italic</code>, <code>STIX-BoldItalic</code> font files.</li>
 <li>Open the <code>STIXMath-Regular</code> font file and click the "Install the font" button from the window that opens. If desired, you may also do the same for the other font files.</li>
</ul>

<p><u>Note:</u> 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 <span class="probNo" id="displayFullDetailsProblemID">in the default installation. If you have a developer account, these are problems </span><span class="probNo" id="displayFullDetailsProblemID">16841023</span> and <span class="probNo" id="displayFullDetailsProblemID">17021145.</span></p>

<h3 id="Linux">Linux</h3>

<p>Install the <em>Latin Modern Math</em>, <em>STIX</em> or <em>XITS</em> fonts, which are generally available from your package manager.</p>

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

<pre>
sudo apt-get install <code>fonts-lmodern fonts-stix</code></pre>

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

<pre>
sudo dnf install <code>texlive-lm-math stix-math-fonts</code></pre>

<p>On openSUSE and other openSUSE-based distributions, use the following command:</p>

<pre>
sudo zypper install texlive-lm-math stix-fonts</pre>

<p>On other Linux distributions, consider installing appropriate <code>texlive</code> packages, which includes <em>Latin Modern Math</em> and <em>XITS</em>:</p>

<pre>
sudo pacman -S texlive-core textlive-fontsextra # Arch Linux
sudo urpmi texlive-dist texlive-fontsextra # Mageia
</pre>

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

<pre class="lang-tex prettyprint prettyprinted">
<code><span class="pln">&lt;?xml version</span><span class="pun">=</span><span class="pln">"1.0"?&gt;
&lt;!DOCTYPE fontconfig SYSTEM "fonts.dtd"&gt;
&lt;fontconfig&gt;
  &lt;dir&gt;/your/path/to/texmf-dist/fonts/opentype&lt;/dir&gt;
&lt;/fontconfig&gt;</span></code></pre>

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

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

<h3 id="Android">Android</h3>

<p>You must use the <a href="https://addons.mozilla.org/firefox/addon/mathml-fonts/">MathML-fonts add-on</a>.</p>

<p><u>Note:</u> A <a href="https://android-review.googlesource.com/#/c/101904/">pull request</a> has been opened on Android to integrate Latin Modern Math into the default installation. Also there is an <a href="https://github.com/googlei18n/noto-fonts/issues/330">enhancement request</a> to add a MATH table to Noto fonts.</p>

<h3 id="Firefox_OS">Firefox OS</h3>

<p>You must use the <a href="https://addons.mozilla.org/firefox/addon/mathml-fonts/">MathML-fonts add-on</a>.</p>

<p><u>Note:</u> We <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=775060">plan to bundle</a> a <a href="#MATH_fonts">MATH font</a> in the default installation.</p>

<h3 id="Other_systems">Other systems</h3>

<p>On other systems, consider installing a <a href="#Math_fonts">MATH font</a> using your package manager. Note that these fonts are generally delivered with TeX distributions such as <a href="https://www.tug.org/texlive/">TeX Live</a>, but you might need to follow specific instructions so that your system is aware of the fonts. As a last resort, install the <a href="https://addons.mozilla.org/firefox/addon/mathml-fonts/">MathML fonts add-on</a>.</p>

<h3 id="Arabic_Mathematical_Alphabetic_Symbols">Arabic Mathematical Alphabetic Symbols</h3>

<p>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 <a href="https://www.amirifont.org/">Amiri</a> fonts. A bug has been <a href="https://sourceforge.net/p/stixfonts/tracking/51/">reported to the STIX consortium</a> to add coverage for these characters.</p>

<h3 id="Reset_old_setup">Reset old setup</h3>

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

<ul>
 <li>The <a href="https://www.stixfonts.org/">STIX consortium</a> provides <a href="https://sourceforge.net/projects/stixfonts/files/Current%20Release/">several sets to use in various situations</a> ; the recommended one is now the <em>STIX Word</em> (<code>STIX-Regular.otf</code>, <code>STIX-Bold.otf</code>, <code>STIX-BoldItalic.otf</code> and more importantly <code>STIX-Math.otf</code>) while the <em>STIX General</em> set (about 30 files) is now deprecated. Similarly, the <em>MathJax TeX</em> fonts are now deprecated in favor of the <em>Latin Modern Math</em> font which provides the style of the popular <a href="https://en.wikipedia.org/wiki/Computer_Modern">Computer Modern</a>. If you don't need <em>STIX General</em> or <em>MathJax TeX</em> for another application, you can just uninstall them. At the moment, you can still use them but note that we plan to <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1007090">remove support for these fonts in the future</a>. Support for <em>MathJax TeX</em> fonts has been removed from Gecko 41.0 {{GeckoRelease("41.0")}}.</li>
 <li>If you had install the MathML fonts package using the Windows installer, you can uninstall it (this will remove the <em>STIX General</em>, <em>MathJax TeX</em> and <em>Asana Math</em> fonts).</li>
 <li>If you had install the <a href="https://addons.mozilla.org/en-US/firefox/addon/mathml-fonts/">MathML fonts add-on</a>, you can upgrade to version &gt;= 2.1 to use the new <em>XITS Math</em> and <em>Latin Modern Math</em> fonts.&nbsp; It might be a good idea to check the instructions below and uninstall the add-on if it is no longer necessary.</li>
 <li>If you had previously changed the <code>font.mathfont-family</code> preference, then it is best to reset this to the default value. To do this, enter the URL <code>about:config</code>, filter for <code>mathfont</code>, and reset to the default value through the context menu on the preference.</li>
</ul>

<h2 id="Fonts_with_a_MATH_table"><a name="MATH_fonts"></a>Fonts with a MATH table</h2>

<p>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.</p>

<p>Starting with Gecko 31 {{GeckoRelease("31.0")}}, 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 <a href="https://wiki.mozilla.org/MathML:Open_Type_MATH_Table">implementation status on the Mozila wiki</a>.</p>

<p>Here is a list of known fonts with a MATH table. Starting with Gecko 41.0 {{GeckoRelease("41.0")}},&nbsp; you can use the advanced font preference menu to configure the default for mathematics. Alternatively, you can try the <a href="https://addons.mozilla.org/en-US/firefox/addon/mathml-font-settings/">MathML-fontsettings add-on</a> for Gecko 31 {{GeckoRelease("31.0")}} and higher.</p>

<ul>
 <li><a href="https://www.ctan.org/tex-archive/fonts/Asana-Math/">Asana Math</a></li>
 <li><a href="https://www.microsoft.com/typography/fonts/family.aspx?FID=360">Cambria Math</a></li>
 <li><a href="https://www.gnu.org/software/freefont/">GNU FreeFont</a> since november 2013 (not released yet)</li>
 <li><a href="https://www.gust.org.pl/projects/e-foundry/lm-math">Latin Modern Math</a></li>
 <li><a href="https://github.com/khaledhosny/libertinus">Libertinus Math</a></li>
 <li><a href="https://tug.org/store/lucida/opentype.html">Lucida Bright Math</a></li>
 <li><a href="https://www.typoma.com/en/fonts.html">Minion Math</a></li>
 <li><a href="https://github.com/khaledhosny/euler-otf/releases">Neo Euler</a> (not released yet)</li>
 <li><a href="https://sourceforge.net/projects/stixfonts/files/Current%20Release/STIXv1.1.1-word.zip/download">STIX Math</a></li>
 <li><a href="https://www.gust.org.pl/projects/e-foundry/tg-math/download/index_html#Bonum_Math">TeX Gyre Bonum Math</a></li>
 <li><a href="https://www.gust.org.pl/projects/e-foundry/tg-math/download/index_html#Pagella_Math">TeX Gyre Pagella Math</a></li>
 <li><a href="https://www.gust.org.pl/projects/e-foundry/tg-math/download/index_html#Schola_Math">TeX Gyre Schola Math</a></li>
 <li><a href="https://www.gust.org.pl/projects/e-foundry/tg-math/download/index_html#Termes_Math">TeX Gyre Termes Math</a></li>
 <li><a href="https://github.com/khaledhosny/xits-math/releases">XITS Math</a></li>
</ul>

<h2 id="Using_mathematical_fonts_on_Web_pages">Using mathematical fonts on Web pages</h2>

<p>Starting with Gecko 31.0 {{GeckoRelease("31.0")}}, it is now easy to set up the CSS style (and optional WOFF fonts) to use on your Web site. See the <a href="/en-US/docs/Web/MathML/Authoring#Mathematical_fonts">Authoring MathML page</a> for details and try the <a href="https://developer.mozilla.org/en-US/docs/Mozilla/MathML_Project/MathML_Torture_Test">MathML Torture Test</a>. You can use <a href="https://www.fontforge.org/math.html">FontForge</a> and <a href="https://github.com/behdad/fonttools">FontTools</a> to edit the MATH table and create your own mathematical fonts.</p>
Revert to this revision