Enable MathML on other Platforms
The rendering of MathML in Mozilla is native. The MathML module is a built-in component of the Gecko layout engine and so it is not possible to use it in isolation outside of Mozilla. It is built upon APIs provided by Gecko, and incorporates elements needed for the particular aspects of MathML. However, it can be used wherever the Gecko layout engine is used. You can choose to embed Gecko in your application with MathML included alongside the other goodies that Mozilla provides. The activation of MathML has been designed to happen lazily (i.e., if/when a page with MathML content is encountered for the first time as the user browses), and measurements have shown that MathML has no perceptible impact on page load performance.
Since it is an add-on, it can be left out when you are initially porting Gecko to your platform, and once you have successfully ported Mozilla while disabling MathML (or with simple stubs for the extra APIs needed by the MathML component), there are essentially two main things that you need to do to hook MathML properly. The rest of the MathML renderer is entirely cross-platform but the two specific things that are needed to render MathML properly on your platform are vital. Both are related to fonts.
- Hook the
MathML processing involves special characters not found in ordinary fonts. The ucvmath module provides the necessary encoding data to access these.
The usual font metrics only provide an overall set of metrics that are meant to be a best fit for all characters in the font. Quality mathematical typesetting, however, requires the precise glyph outline of each character. The GetBoundingMetrics() function is used to obtain the metrics needed for precise MathML placements.
- ucvmath and GetBoundingMetrics() for TrueType fonts on Linux using the FreeType2 library:
- GetBoundingMetrics on BeOS:
- GetBoundingMetrics on the Mac:
- ucvmath to the Mac:
Roger B. Sidje <firstname.lastname@example.org>