MathJax
MathJax copied to clipboard
Please support font inheritance for more MathML elements
Currently font inheritance is only supported for <mtext> element when mtextFontInherit is set to true. Please allow font inheritance on more elements including <mn>.
MathJax needs to know details about the bounding boxes for the various characters in a font in order to be able to use it for mathematical layout. This is in order to be able to place accents, super and subscripts, square roots, and such properly. MathJax can not obtain this information for an arbitrary font since it is not available through a javascript API. In order to work around this problem, MathJax has extensive tables of bounding box information about the fonts that it uses; it does not have these for arbitrary fonts, and so MathJax will not be able to support font inheritance in general. It allows it within <mtext>
elements as a compromise because these don't usually involve the kinds of typesetting that requires precise height and depth information, and so it can get away with using the total height and depth of the font in this case without too much adverse consequences. This would not be the case in general. In addition, allowing this in arbitrary elements would mean that MathJax would have to measure every character that it uses, and since this requires the browser to reflow the, that would cause a serious performance degradation (and MathJax is already too slow as it is).
So the upshot is that this is not likely to occur within the current output renderers.
@dpvc Thanks a lot for the detailed explanation. Seems much more complex than what I expected. You guys are doing a great job.
Thanks for the kind words. We appreciate your taking time to make your suggestion, and are glad that you are able to make use of MathJax.
Question: What if MathJax provided a tool that users could run on a font file to extract the metrics and create a MathJax table of bounding box information for that specific font? The tool should have the capability to save off the table as a file that can be included in a locally run version of MathJax, or called from within a MathJax config file.
Is the effort to build such a tool completely beyond MathJax's developer/financial resources at this point?
Just wondering.
Thanks!
Hi @jeankaplansky our tools exist and are public at https://github.com/mathjax/MathJax-dev/tree/master/fonts. For fonts with OpenType MATH tables, this process should be relatively automatic. Improving the tool is possible but not high on our priority list. However, this would only help add new font options and would not enable font mixing (i.e., would not help with font inheritance).