Beginning on October 25th, 2016, Persona will no longer be an option for authentication on BMO. For more details see Persona Deprecated.
Bug 701758 - (mathjax-fonts) Support for MathJax fonts
 (mathjax-fonts) Summary: Support for MathJax fonts
 Status: RESOLVED FIXED dev-doc-complete Core Components MathML (show other bugs) Trunk All All -- normal with 1 vote (vote) mozilla13 Frédéric Wang (:fredw) Anthony Jones (:kentuckyfriedtakahe, :k17e) mathml-in-mathjax Show dependency tree / graph

Reported: 2011-11-11 09:46 PST by Frédéric Wang (:fredw)
Modified: 2012-03-24 06:34 PDT (History)
3 users (show)
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Attachments
Experimental patch (2.33 KB, patch)
2011-11-11 09:46 PST, Frédéric Wang (:fredw)
no flags Details | Diff | Splinter Review
Screnshot of MathML torture test with patch applied (20.57 KB, image/png)
2011-11-11 09:49 PST, Frédéric Wang (:fredw)
no flags Details
Patch - part 2 (13.12 KB, patch)
2011-11-21 04:32 PST, Frédéric Wang (:fredw)
no flags Details | Diff | Splinter Review
Screnshot of MathML torture test with patches applied (16.10 KB, image/png)
2011-11-23 02:42 PST, Frédéric Wang (:fredw)
no flags Details
Add stretchy operator table for MathJax fonts (15.24 KB, patch)
2011-12-08 10:41 PST, Frédéric Wang (:fredw)
karlt: review+
Details | Diff | Splinter Review
Add page to convert MathJax font table into our own format (7.63 KB, patch)
2011-12-08 10:41 PST, Frédéric Wang (:fredw)
karlt: review+
Details | Diff | Splinter Review
Add stretchy operator table for MathJax fonts (V2) (15.24 KB, patch)
2012-02-27 22:35 PST, Frédéric Wang (:fredw)
no flags Details | Diff | Splinter Review

 Frédéric Wang (:fredw) 2011-11-11 09:46:56 PST Created attachment 573836 [details] [diff] [review] Experimental patch (In reply to Frédéric Wang from comment #3) > MathJax also has its own Open Type fonts, which look closer to LaTeX fonts > and thus are often preferred by MathJax users. That may be interesting to > see if we can support them. They do not seem to contain an OpenType MATH > table, though. MathJax fonts can be downloaded with the command: wget -r -np -nd http://cdn.mathjax.org/mathjax/latest/fonts/HTML-CSS/TeX/otf/ -P MathJax-fonts/ The attached patch add support for token elements (other than mo). It also improves the rendering of mathvariant. Frédéric Wang (:fredw) 2011-11-11 09:49:58 PST Created attachment 573838 [details] Screnshot of MathML torture test with patch applied Frédéric Wang (:fredw) 2011-11-19 04:08:59 PST Comment on attachment 573836 [details] [diff] [review] Experimental patch I've started to add a converter from MathJax font table to our own format. https://raw.github.com/fred-wang/MozillaCentralPatches/master/MathJax-fonts.diff https://raw.github.com/fred-wang/MozillaCentralPatches/master/MathJax-fonts-2.diff https://raw.github.com/fred-wang/MozillaCentralPatches/master/MathJax-fonts-3.diff When I test on texvsmml.xhtml, symbols like sum seems to be read correctly from mathfontMathJax_Main.properties, but not other like parentheses or braces. Frédéric Wang (:fredw) 2011-11-21 04:32:07 PST Created attachment 575831 [details] [diff] [review] Patch - part 2 I'm still not able to get the symbols built by parts used. I'm probably doing something wrong, but I can't see where the problem is. When I use MathJax_Size4 as the base font instead of MathJax_Main, that seems to work. However, it looks like the definitions are taken from mathfontUnicode.properties. Frédéric Wang (:fredw) 2011-11-21 04:41:25 PST The horizontal braces are not currently included. The middle char needs to be drawn with 2 glyphs. I don't know if the code for composite char is still working? Karl Tomlinson (:karlt) 2011-11-22 19:23:59 PST Can you verify that mathfontMathJax_Main.properties is opened and read? Perhaps the "_" might be getting filtered out somewhere. (In reply to Frédéric Wang from comment #4) > I don't know if the code for composite char is still working? I'd guess not, but much of the code is still there, so it may not be too difficult to revive it. Frédéric Wang (:fredw) 2011-11-23 02:42:14 PST Created attachment 576433 [details] Screnshot of MathML torture test with patches applied OK, the problem was just that duplicate entries were generated for stretchy characters built by parts that also have variants. I've updated the patches. Frédéric Wang (:fredw) 2011-11-23 15:00:03 PST MathJax 2.0 is expected to be released before the end of the year, so probably before a fix to this bug is going to be included in a Firefox release. MathJax 2.0 adds support for more stretchy characters so I've included these changes in the set of patches (you have to use http://devel.mathjax.org/testing/mathjax/dpvc/v2.0-candidate/unpacked/MathJax.js in MathJaxFonts.html). I think I will deal the case of horizontal braces in a separate bug, since it requires to restore the composite char support. Frédéric Wang (:fredw) 2011-12-06 13:32:24 PST Testing with attachment 579435 [details], it seems that extenders of stretchy arrows are displayed as large black box with the MathJax fonts. Frédéric Wang (:fredw) 2011-12-07 11:02:14 PST (In reply to Frédéric Wang from comment #8) > Testing with attachment 579435 [details], it seems that extenders of > stretchy arrows are displayed as large black box with the MathJax fonts. OK, there was a typo in MathJaxFonts.html. Now the result is better. However, the following chars do not seem to build correctly: 2961, 21BE, 21A7, 2960, 295C, 21B1, 2951, 295D, 21B0, 27FE, 294F, 21C2, 23B4, 21BF, 21A0, 23B5, 21C3, 21A5 Frédéric Wang (:fredw) 2011-12-07 11:32:27 PST > However, the following chars do not seem to build correctly: > 2961, 21BE, 21A7, 2960, 295C, 21B1, 2951, 295D, 21B0, 27FE, 294F, 21C2, > 23B4, 21BF, 21A0, 23B5, 21C3, 21A5 There is a typo in MathJax development version for "21A0", which prevents the character to stretch properly. The other characters have scale factor on each individual part, so we ca not use them. Frédéric Wang (:fredw) 2011-12-08 10:41:27 PST Created attachment 580098 [details] [diff] [review] Add stretchy operator table for MathJax fonts Frédéric Wang (:fredw) 2011-12-08 10:41:59 PST Created attachment 580099 [details] [diff] [review] Add page to convert MathJax font table into our own format Frédéric Wang (:fredw) 2011-12-08 10:47:55 PST Ideally, if we want to render equations like MathJax we should use MathJax_Math font for mi MathJax_Main font for other token elements MathJax_AMS font for mathvariant="double-struck", MathJax_Script font for mathvariant="*script" MathJax_Fraktur font for mathvariant="*fraktur" MathJax_SansSerif for mathvariant="*serif*" MathJax_Typewriter for mathvariant="monospace" However, that seems difficult to do that only in mathml.css, because there are other cases to take into account (fallback the user does not have MathJax fonts, interaction with the fontfamily, style, mathvariant attribute, etc). So I won't do that for the moment. Frédéric Wang (:fredw) 2011-12-08 10:51:03 PST (In reply to Frédéric Wang from comment #13) > However, that seems difficult to do that only in mathml.css, because there > are other cases to take into account (fallback the user does not have > MathJax fonts, interaction with the fontfamily, style, mathvariant > attribute, etc). So I won't do that for the moment. https://tbpl.mozilla.org/?tree=Try&rev=217be55d56ac The patch I have not attached yet for mathml.css seems to cause the following issue: layout/reftests/bugs/355548-3.xml layout/reftests/bugs/355548-4.xml Karl Tomlinson (:karlt) 2012-02-27 19:30:20 PST Comment on attachment 580098 [details] [diff] [review] Add stretchy operator table for MathJax fonts Do you think perhaps that STIX fonts should be preferred over MathJax fonts for stretchy characters until mathml.css uses MathJax fonts by default for non-stretchy characters (if that turns out to be workable)? >+external.6 = MathJax_Main-bold The PostScript name is MathJax_Main-Bold IIUC, but nsMathMLChar currently deals only with family names, not PostScript names. This doesn't matter too much because all the @6 entries are commented out, but perhaps it would be worth commenting out external.6 for now and capitalizing "Bold". Frédéric Wang (:fredw) 2012-02-27 22:35:22 PST Created attachment 601183 [details] [diff] [review] Add stretchy operator table for MathJax fonts (V2) Frédéric Wang (:fredw) 2012-02-27 22:41:11 PST OK, I've made the proposed changes. I'm wondering whether with these patches Web page authors will be able to use MathJax downloadable fonts in MathML formulas. If someone wants to try, the fonts are here: http://cdn.mathjax.org/mathjax/latest/fonts/HTML-CSS/TeX/woff/ Karl Tomlinson (:karlt) 2012-02-28 14:24:19 PST (In reply to Frédéric Wang from comment #17) > I'm wondering whether with these patches Web page authors will be able to > use MathJax downloadable fonts in MathML formulas. I don't think the changes here, on their own, will improve the situation with downloaded fonts. I've noted the reason in bug 663740 comment 8. Ryan VanderMeulen [:RyanVM] 2012-02-28 15:43:56 PST https://hg.mozilla.org/integration/mozilla-inbound/rev/1b6a03443c78 https://hg.mozilla.org/integration/mozilla-inbound/rev/6a39c6d4fbf3 Matt Brubeck (:mbrubeck) 2012-02-29 11:19:48 PST https://hg.mozilla.org/mozilla-central/rev/1b6a03443c78 https://hg.mozilla.org/mozilla-central/rev/6a39c6d4fbf3 Frédéric Wang (:fredw) 2012-03-09 01:44:32 PST I have reorganized the font installation instructions: https://developer.mozilla.org/en/Mozilla_MathML_Project/Fonts but we could probably explain better which font files to install and how. Frédéric Wang (:fredw) 2012-03-09 04:44:06 PST (In reply to Frédéric Wang from comment #21) > but we could probably explain better which font files to install and how. I've modified that section (I assume that bug 732834 will be taken for Firefox 13). It remains to update the doc "Firefox 13 for developers" for this bug and bug 732834 (when it is pushed). Florian Scholz [:fscholz] (MDN) 2012-03-24 06:34:15 PDT (In reply to Frédéric Wang from comment #22) > It remains to update the doc "Firefox 13 for developers" for > this bug and bug 732834 (when it is pushed). Added a note to https://developer.mozilla.org/en/Firefox_13_for_developers#MathML

 Note You need to log in before you can comment on or make changes to this bug.