Skip to content
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

bold-italic issues on Chrome 32 #735

Closed
pkra opened this issue Feb 10, 2014 · 13 comments
Closed

bold-italic issues on Chrome 32 #735

pkra opened this issue Feb 10, 2014 · 13 comments
Labels
Accepted Issue has been reproduced by MathJax team Browser Bug Fixed Test Not Needed v2.4
Milestone

Comments

@pkra
Copy link
Contributor

pkra commented Feb 10, 2014

From a report on the User Group, there is an issue with the bold-italic TeX fonts.

Minimal example would be: \(\boldsymbol{x}\), say on http://cdn.mathjax.org/mathjax/latest/test/sample-dynamic-2.html. Note that this is Chrome 32 specific -- Chrome 33 has no issue.

This might be a duplicate of #716.

Since Chrome 33 works fine, this might be a won't-fix.

@dpvc
Copy link
Member

dpvc commented Feb 12, 2014

The problem appears to be a bug in Chrome 32.

When a bold or italic font is requested, if that weight or style is not available, the browser may generate the bold or italic version algorithmically from the normal version of the font. In the case of a web font, that may be replaced by the actual font when it arrives. But the sizes of the characters in the actual bold or italic version of the font may not correspond to the algorithmic one, so MathJax needs to be able to recognize the difference between the faked font and the real one.

To to this, MathJax's web fonts include special characters that allow MathJax to recognize the true bold or italic font as different from one generated algorithmically from the standard font. It uses these to wait for the real font to arrive rather than trying to use the algorithmic one.

What seems to be happening in Chrome 32 is this: MathJax requests the MathJax_Math-bold-italic, but Chrome uses MathJax_Math-italic to construct a bold form that is uses instead. MathJax recognizes that this is not the correct font and waits for the true one to arrive. What is supposed to happen is that the browser goes on to load the true font while MathJax is waiting, and then MathJax will detect it when it does. But what actually seems to happen is that Chrome doesn't make the font available until MathJax has given up waiting for it. MathJax waits for 15 seconds for the font, and then gives up. I can see that the font hasn't changed during those 15 seconds, and as soon as MathJax times out, the font is replaced, so something is wrong about Chrome's handling of the font or the screen refresh, or something related to that.

They seem to have resolved the problem in Chrome 33, according to Peter (I haven't upgraded to see). I will post some possible work-arounds shortly.

@dpvc
Copy link
Member

dpvc commented Feb 12, 2014

Some browsers have trouble with @font-face rules involving bold and italic, and so MathJax has a feature that causes it to load each font as a separate family (rather than trying to use style and weight on a single family). Using this will allow Chrome 32 to load the bold-italic font properly. So if you add

<script type="text/x-mathjax-config">
if (MathJax.Hub.Browser.isChrome && MathJax.Hub.Browser.version.substr(0,3) === "32.") {
  MathJax.Hub.Register.StartupHook("HTML-CSS Jax Config", function () {
    MathJax.OutputJax["HTML-CSS"].FontFaceBug = true;
  });
}
</script>

that will enable that feature when Chrome 32 is used. That should clear up the issue for you.

@dpvc
Copy link
Member

dpvc commented Feb 12, 2014

We can have the HTML-CSS output jax do this automatically.

@dpvc dpvc added this to the Bugfix Version milestone Feb 12, 2014
dpvc added a commit to dpvc/MathJax that referenced this issue Feb 12, 2014
@dpvc
Copy link
Member

dpvc commented Feb 14, 2014

=> Merged.

@dpvc dpvc closed this as completed Feb 14, 2014
dpvc added a commit to dpvc/MathJax that referenced this issue Feb 14, 2014
@smsti
Copy link

smsti commented Apr 19, 2014

I have upgraded Chrome to version 34 and the issue with bold fonts still remains. The above lines with javascript were helpful to fix that.

@dpvc
Copy link
Member

dpvc commented Apr 21, 2014

@smsti, I am using Chrome 34 on Mac OS X and the bold issue does not occur. What OS are you using? I believe Peter is using Linux.

@pkra
Copy link
Contributor Author

pkra commented Apr 21, 2014

I don't have Chrome 34 but I do see the problem on Chrome 35 beta -- with both 2.3 and on the develop branch :(

@dpvc
Copy link
Member

dpvc commented Apr 22, 2014

The patch is tied to version 32 explicitly. Maybe I should do it for version >= 32.

@smsti
Copy link

smsti commented Apr 22, 2014

To the question asked: I have installed Chrome on Win7 32 bit.

@pkra
Copy link
Contributor Author

pkra commented Apr 22, 2014

@dpvc that might be worth our while. On the bright side, Chrome seems to move towards the new CSS font loading API so maybe we can use that sooner than expected.

dpvc added a commit to dpvc/MathJax that referenced this issue Apr 22, 2014
@dpvc
Copy link
Member

dpvc commented Apr 22, 2014

OK, I've made the check for version > 32 rather than version == 32. See if that helps.

@pkra
Copy link
Contributor Author

pkra commented Apr 22, 2014

@dpvc
Copy link
Member

dpvc commented Apr 22, 2014

OK, thanks. I'll merge it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team Browser Bug Fixed Test Not Needed v2.4
Projects
None yet
Development

No branches or pull requests

3 participants