# Fonts for native MathMLClosed, ResolvedPublicActions

Assigned To
None
Authored By
 fredw May 20 2014, 1:44 PM2014-05-20 13:44:00 (UTC+0)
Referenced Files
None
Subscribers

# Description

The change to use the old math fonts with native MathML (MathJax and STIXGeneral) was not integrated in the initial part of Moritz's work because of concerns with Web fonts. I guess there is already an exception with MathJax which uses its own resource loader system to handle Web fonts ; but we can probably do better with native MathML here. In particular, I think MediaWiki has some code to handle Web fonts for specific languages and scripts, so we can certainly reuse that for math (I'll need to check what is done).

At the moment, the status is that:

1. There are known bugs in OpenType MATH fonts, the most serious one is an ascent/descent bug with some of them (including STIX or Latin Modern fonts).
1. For stretchy operators, WebKit still only supports Unicode-based construction and my patches to support OpenType MATH fonts are unlikely to be integrated into release builds soon. The initial plan was to not enable MathML on WebKit by default, so we can probably ignore it for now.
1. Gecko 31 (corresponding to the next Firefox ESR) will have support for OpenType MATH fonts and is scheduled for the end of July. There is a workaround for the ascent/descent bug of 1) on Linux/Mac/Mobiles and Cambria Math is not affected on Windows.

Regarding fonts, I'm working to make OpenType MATH fonts installed by default but at the moment:

1. On Windows 7 or higher (i.e. the version officially maintained by Microsoft), Cambria Math is installed by default and can be used for Gecko 31
2. On Mac 10.8 or higher, STIX is installed by default but I'm not sure it is the version with a MATH table. Older Mac versions don't have it installed.
3. On Linux and other desktop platforms, many packages are available but not necessarily installed by default.
4. Mobile platforms don't have MATH fonts by default.
5. TeX distributions (TeX Live, MiKTeX etc) contains MATH fonts (e.g. Latin Modern Math or STIX), so in theory TeX users should already have appropriate fonts on their systems.

So my proposal would be:

@namespace url('http://www.w3.org/1998/Math/MathML');
math {

// Start with "Cambria Math" (Gecko 31 on Windows >= 7)
// Then try "Latin Modern Math" or "STIX Math" since they are very common on desktop (Gecko 31 on desktop when e.g. a TeX distribution or STIX are installed). More can be added (there are 12 MATH fonts)
// Then try "Latin Modern Math" as a web font (mobile platforms and other systems missing MATH fonts)
// Then try the old math fonts MathJax_Main and STIXGeneral (backward compatibility). More can be added (cf Gecko's mathml.css ua stylesheet)
font-family: "Cambria Math", "Latin Modern Math", "STIX Math", LatinModernWOFF, MathJax_Main, STIXGeneral, serif;

}
mtext {

// use the same font-family as the surrounding text or reset to 'initial'
// (for example if someone uses non-Latin scripts in \text)
font-family: ...;

}
@font-face {

// Latin Modern Math
// http://fred-wang.github.io/MathFonts/LatinModern/latinmodern-math.woff
font-family: LatinModernWOFF;
src: url('latinmodern-math.woff');

}

Note that this will be *only* adding a 472kb web font in contrast to the previous attempts with STIXGeneral and MathJax fonts. Also, this Web font fallback is unlikely to be used on Windows and on desktop platforms when a TeX distribution is installed.

Version: unspecified
Severity: normal

Reference
bz65532

# Related ObjectsSearch...

ResolvedNone
Resolvedfredw
ResolvedNone

### Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:26 AM
bzimport set Reference to bz65532.
bzimport added a subscriber: Unknown Object (MLST).

In a more compact form:

@namespace url('http://www.w3.org/1998/Math/MathML');
math {

font-family: "Cambria Math", "Latin Modern Math", "STIX Math", LatinModernWOFF, MathJax_Main, STIXGeneral, serif;

}
mtext {

font-family: initial;

}
@font-face {

font-family: LatinModernWOFF;
src: url('latinmodern-math.woff');

}