LordLing LordLing - 1 year ago 110
HTML Question

MathML in HTML5: changing math font

Let's say I have an HTML5 document with some MathML in it. I set the font of the body of the page but it doesn't change the font used for MathML characters:

<!DOCTYPE html>
<html lang="en">
<title>Example of MathML embedded in an HTML5 file</title>
<meta charset="utf-8" />
<body style="font-family: courier;">
Quadratic formula
<mo form="prefix">−</mo>

This will display the text "Quadratic formula" in courier but the MathML stays in the default page font. How can I change the font used for MathML?

Answer Source

You should probably read this document on the Mozilla Developer Network. I'm guessing the following paragraph is applicable in your case:

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.

One of the Mozilla MathML developers seems to blog quite regularly. There are two recent posts which will be of interest to you:

  1. Installation of mathematical fonts
  2. About mathematical fonts

The upshot seems to be that, in order to guarantee decent rendering of MathML, you need your users to install either MathJax, STIX or Asana Math fonts.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download