Skip to content

rendering problems in Safari 5.1.1 #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghazel opened this issue Oct 17, 2011 · 5 comments
Closed

rendering problems in Safari 5.1.1 #178

ghazel opened this issue Oct 17, 2011 · 5 comments

Comments

@ghazel
Copy link

ghazel commented Oct 17, 2011

On OS X Lion in Safari 5.1.1, there are several serious rendering issues. The sqrt line and parenthesis are mis-placed in the examples:

http://s4.postimage.org/utsmgtvo/Screen_Shot_2011_10_16_at_6_33_36_PM.png

@dpvc
Copy link
Member

dpvc commented Oct 17, 2011

OS X 10.7 (Lion) ships with the STIX fonts installed, and MathJax will use those in preference to its web-based fonts. Unfortunately, there appears to be an incompatibility with the STIX fonts and recent versions of WebKit that causes the fonts to be rendered over italicized (it looks like they have had an italic algorithm applied to them even though they are already italic). It is not actually the parenthesis that is misplaced, it is the preceding f that is over italicized.

One solution is to use FontBook to disable the STIX fonts (if you aren't using them in other contexts). Or you could download and install the MathJax web fonts (since local copies of them will be used in preference to local STIX fonts). Alternatively, if you are the author of the web page using MathJax, you can change your configuration to remove the STIX fonts from the availableFonts array in the HTML-CSS block of your configuration. E.g.

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    "HTML-CSS": {
      availableFonts: ["TeX"]
    }
  });
</script>

Davide

@dpvc
Copy link
Member

dpvc commented Oct 17, 2011

This is a duplicate of issue #152

@ghazel
Copy link
Author

ghazel commented Oct 17, 2011

Ok, thank you!

@dpvc
Copy link
Member

dpvc commented Jan 18, 2012

OK, I've finally had the chance to come up with a work-around to the STIX font problem on OS X Lion. It turns out that WebKit seems to be replacing font-family:STIXGeneral with the equivalent of font-family:STIXGeneral; font-style:italic whenever the italic font includes the corresponding character, and replacing font-family:STIXGeneral; font-style:italic by an extra italic version of STIXGeneral (algorithmically generated). All of this is unrelated to MathJax, as it occurs in a page with just text and CSS to change the fonts. (It also adversely affects the native MathML in WebKit.)

Fortunately, it is still possible to access the STIXGeneral font via font-family:STIXGeneral-Regular and the italic version by font-family:STIXGeneral-Italic (without the font-style:italic). It is also possible to tell MathJax to set up its references that way. To do so, include the following before loading MathJax.js

<script type="text/x-mathjax-config">
MathJax.Hub.Register.LoadHook("[MathJax]/jax/output/HTML-CSS/fonts/STIX/fontdata.js", function () {
  var HTMLCSS = MathJax.OutputJax["HTML-CSS"];

  MathJax.Hub.Browser.Select({
    Safari: function (browser) {
      browser.STIXfontBug = browser.versionAtLeast("5.1") && browser.isMac;
    },
    Chrome: function (browser) {
      var match = navigator.appVersion.match(/AppleWebKit\/(\d+)/);
      if (match && parseInt(match[1]) > 534) {browser.STIXfontBug = true}
    }
  });
  if (MathJax.Hub.Browser.STIXfontBug) {
    HTMLCSS.FONTDATA.FONTS["STIXGeneral"].family = "STIXGeneral-Regular";
    HTMLCSS.FONTDATA.FONTS["STIXGeneral-italic"].family = "STIXGeneral-Italic";
    delete HTMLCSS.FONTDATA.FONTS["STIXGeneral-italic"].style;
    HTMLCSS.FONTDATA.FONTS["STIXNonUnicode"].family = "STIXNonUnicode-Regular";
    HTMLCSS.FONTDATA.FONTS["STIXNonUnicode-italic"].family = "STIXNonUnicode-Italic";
    delete HTMLCSS.FONTDATA.FONTS["STIXNonUnicode-italic"].style;
  }
});
</script>

This will be included in MathJax v2.0. This should allow the STIX fonts to be used correctly with MathJax, without having your users disable STIX, or disabling STIX fonts for non-WebKit browsers.

Hope that helps.

Davide

@dpvc
Copy link
Member

dpvc commented Feb 8, 2012

It turns out that the STIX NonUnicode fonts also need to be adjusted similarly to STIXGeneral (I have tested all the other fonts, and they seem to be OK. This seems only to affect the ones that have italic versions). I have edited my code snippet above to include the additional fonts.

dpvc added a commit to dpvc/MathJax that referenced this issue Feb 8, 2012
…e fonts also needed to be adjusted). Resolves issues mathjax#152 and mathjax#178.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants