Last modified: 2014-09-03 18:41:02 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T67532, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 65532 - Fonts for native MathML
Fonts for native MathML
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Math (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 65341 70360
  Show dependency treegraph
 
Reported: 2014-05-20 13:44 UTC by Frédéric Wang
Modified: 2014-09-03 18:41 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Frédéric Wang 2014-05-20 13:44:49 UTC
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).

2) 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.

3) 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.
Comment 1 Frédéric Wang 2014-05-20 13:47:47 UTC
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');   
}
Comment 2 Gerrit Notification Bot 2014-05-20 14:42:30 UTC
Change 134362 had a related patch set uploaded by Frédéric Wang:
Fonts for native MathML

https://gerrit.wikimedia.org/r/134362
Comment 3 Frédéric Wang 2014-05-20 14:47:52 UTC
https://www.mediawiki.org/wiki/Extension:UniversalLanguageSelector seems very specific to language support, I'm not sure we can use that. The change only adds one WOFF font, so I guess that should be fine. I've dropped the mtext font-family too, as I'm not sure what's best.

I opened https://gerrit.wikimedia.org/r/134362 to keep that in mind when we have the MathML mode available and used with Gecko.
Comment 4 Gerrit Notification Bot 2014-06-10 11:11:11 UTC
Change 134362 merged by jenkins-bot:
Fonts for native MathML

https://gerrit.wikimedia.org/r/134362

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links