[STIX-web] text-italic used instead of math-italic
(Moving this here from another thread.)
@dpvc wrote:
MathJax v2 maps the MathML variants to the font files via a list of fonts to search sequentially, and for mathvariant="italic", it starts with STIXMathJax_Main-Italic followed by STIXMathJax_Normal-Italic. That means that if you use
<mi>f</mi>
(or<mi mathvariant="italic">f</mi>
), the "f" will be taken from STIXMathJax_Main-Italic, which is the text italic version, whereas<mi>𝑓</mi>
will be taken from STIXMathJax_Normal-Italic, the Plane1 version. The MathML spec says these should be treated the same, so this is technically an error.
This has to do with the font data for the STIX-Web font. You can use the remapping facilities in MathJax to adjust this.
MathJax.Hub.Register.StartupHook("SVG Jax Ready", function () {
var SVG = MathJax.OutputJax.SVG;
SVG.Augment({
FONTDATA: {
VARIANT: {
italic: {
offsetA: 0x1D434,
remap: {0x1D455: 0x210E}
},
'bold-italic': {
offsetA: 0x1D434,
remap: {0x1D455: 0x210E}
}
}
}
});
});
This will add a remapping of the alphabetic characters to the Plane1 positions, and remap the lower-case "h" back to the letter-like symbols (since unicode leaves some holes in Plane1 when there are similar glyphs elsewhere). This code can be added to mathjax-node so that you can use it there. Note that this does mean all the alphabetic characters in the italic and bold-italic fonts will be mapped to the Pane1 versions, which are slightly different, so you may notice some different layout. In addition to the "f", the "j" will also be noticeably affected, and this should help with "j" in superscripts, for example (there was an issue about this at one point, and I didn't think about the real issue, which is the incorrect use of text-italic for math-italic in the STIXMathJax fonts).
Technically, we should be mapping the normal and bold variants to their math counterparts as well, and also the greek letters, but I think that is probably overkill for your needs, but something to get right in v3.