Fonts for Mozilla 2.0's MathML engine 编辑
Quick Instructions
Try this test page to quickly determine whether you need to install additional fonts and to follow the instructions below. You may also want to check out the Mozilla MathML torture test to test your installation against concrete examples.
- On Windows: On Windows 7, use this MathML fonts installer.
- On Mac OS X Lion (10.7) and higher versions, STIX fonts are already installed and can be used for MathML.
- On most Linux distributions and similar open source platforms, you can install math fonts (STIX, Asana or MathJax fonts) from your package manager or get them from this zip archive.
- On Android, FirefoxOS and other platforms where the instructions above do not work: install the MathML-fonts add-on. This requires Gecko 15.0 (Firefox 15.0 / Thunderbird 15.0 / SeaMonkey 2.12) or higher.
Overview
Mathematical formulas make use of various symbols represented by specific Unicode characters. Mozilla can display any of these symbols provided suitable Unicode fonts are installed. 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's system. If no appropriate font is ultimately found for a given character, Mozilla will instead display a box containing the hexadecimal representation of the Unicode code point for the character.
Some mathematical operators are also drawn by using glyphs for larger variants of the character (e.g. summation symbol) or by assembling glyphs for a few pieces of the character (e.g braces). These variant or part glyphs do not in general have Unicode assignments, and so font-specific support is required for some characters. Mozilla has general support for the common delimiters and arrows that have the necessary Unicode assignments. For other characters, Mozilla has font-specific support. In general, if the necessary glyphs are not available on the system then Mozilla tries to stretch symbols using scale transforms, but that may result in a less pleasant rendering.
To see MathML as intended, you need sufficient font support, which may mean installing some fonts. Note that some Web sites may provide the required mathematical fonts as Web fonts. In that case, you will see the correct rendering on these pages if you use Gecko 15.0 (Firefox 15.0 / Thunderbird 15.0 / SeaMonkey 2.12) or greater.
Recommended Fonts
The STIX Fonts Project has been developing a comprehensive set of fonts that cover all the symbols in MathML and also contains glyphs to stretch mathematical operators. They are available under the SIL Open Font License and should be installed for best MathML rendering. Note that currently, only the fonts in /Fonts/STIX-General/
are used for stretching mathematical operators with STIX fonts. Asana Math is also freely available under the SIL Open Font License and has good support for mathematical characters. Starting in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4), Mozilla can also use the glyphs contained in that font for stretchy operators. Starting in Gecko 13.0 (Firefox 13.0 / Thunderbird 13.0 / SeaMonkey 2.10), MathJax fonts are used as the default fonts for mathematical text and symbol stretching. These fonts are freely available under the Apache License. They are close to LaTeX rendering and should look more familiar to scientists. MathJax fonts also improves support for mathvariant attribute (e.g. to write double-struck, script or fraktur text).
All the fonts mentioned above may already be installed by default on your system or can easily be installed via your software manager. For convenience we provide a zip archive of MathML fonts. The fonts may be installed by extracting the font files (which have the .otf
extension) from the zip archive, then following instructions for Microsoft Windows, or copying the files to a ~/Library/Fonts
folder on Mac OS X, or to a ~/.fonts/
directory (which may need to be created) on Unix/Linux systems. Alternatively, follow dafont's "How to install a font". These fonts are OpenType PostScript fonts, which are supported by most modern operating systems. However some operating systems may not support these fonts. On such systems, it will be necessary to convert the fonts to a supported format. For example Asana Math is available in TrueType format and there is an unofficial TrueType conversion for STIX fonts.
The following fonts are not necessary when the above fonts are installed, but are worth noting because of their Unicode support for many mathematical characters.
DejaVu Serif and DejaVu Sans are freely available and installed with many Linux distributions. They contain support for many mathematical characters, and Mozilla will display some MathML reasonably on systems with these fonts installed, even without STIX fonts. The font only contains glyphs for stretchy operators that have Unicode assignments.
Cambria Math is preinstalled on Microsoft Windows Vista, and also comes with Miscrosoft Office 2007 or Microsoft PowerPoint Viewer 2007. The font has good support for mathematical characters, and so, with any of these products installed, Mozilla will be able to display some MathML reasonably even without STIX fonts. The font contains the necessary glyphs for stretchy operators but Mozilla does not yet make use of all of these. The license allows you to "use this font as permitted by the EULA for the product in which this font is included to display and print content", so consulting your lawyer is recommended if considering installing this on systems without the associated product.
Reset old preferences
If users have previously changed the "font.mathfont-family" preference for a previous version of Mozilla, 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论