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

Fedora 18, Firefox, and local STIX fonts #501

Closed
pkra opened this issue Jun 15, 2013 · 24 comments

Comments

Projects
None yet
5 participants
@pkra
Copy link
Member

commented Jun 15, 2013

This was first reported on g+.

There is an odd bug on Fedora 18 with Firefox (reported for FF21, confirmed on a fresh install with FF17). The HTML-CSS output is quite broken (see screenshots above, but all kinds of buggy stuff shows up).

Fedora 18 comes with STIX fonts installed (though there's also a stix-math-fonts package whose installations did not help). The MathJax about page states that local STIX fonts are used.

I'm guessing something goes wrong in the font detection. For comparison, Chromium 27 went straight to webfonts.

As a workaround for Firefox, installing Fred's mathml-fonts extension resolves the issues (as does removing the STIX fonts -- the MathJax webfonts work fine).

@fred-wang

This comment has been minimized.

Copy link
Contributor

commented Jun 27, 2013

The rendering of the circle integral is also "scaled" with the MathML output, so the fonts do not seem to be found. One bug that I can think about is https://bugzilla.mozilla.org/show_bug.cgi?id=821442 but it is supposed to be fixed in Firefox 20.

@pkra

This comment has been minimized.

Copy link
Member Author

commented Jun 27, 2013

I'm guessing this is a Fedora issue. Just not sure where to report this upstream. (On the side, we don't have a label for that if it's not a browser bug.)

@QuLogic

This comment has been minimized.

Copy link

commented Jun 27, 2013

Let me know if you want me to file a bug in Fedora. But it would be nice to have a smaller example than all of MathJax, if possible.

@pkra

This comment has been minimized.

Copy link
Member Author

commented Jun 28, 2013

@QuLogic thanks, that would be great. Maybe @fred-wang can advise how to narrow it down a bit.

@QuLogic

This comment has been minimized.

Copy link

commented Jul 27, 2013

FYI, I just updated to Fedora 19 (with Firefox 22), and it still appears to be problematic.

@smidm

This comment has been minimized.

Copy link

commented Nov 5, 2013

I got the same issue on Fedora 19. I filled a bug report https://bugzilla.redhat.com/show_bug.cgi?id=1026871

@QuLogic

This comment has been minimized.

Copy link

commented Jan 20, 2014

So, recently, Fedora started packaging MathJax for easier usage as web assets. A consequence of this packaging is the inclusion of several new packaged fonts (see package tree here). For whatever reason, these fonts are packaged separately (all are required for the MathJax package, of course). Since they're separate, though, it makes it easy to test them out individually.

After trying out all the packaged fonts, it appears that the mathjax-size1-fonts package fixes the display of MathJax in most cases (some of the horizontal lines seem wrong to me, but this may not be a font problem).

Here is the HTML-CSS mode for the front page demo with this package installed:
screenshot from 2014-01-20 01 23 50

Here are the font files as installed by the packages:

$ rpm -ql stix-fonts
/etc/fonts/conf.d/61-stix.conf
/usr/share/fontconfig/conf.avail/61-stix.conf
/usr/share/fonts/stix
/usr/share/fonts/stix/STIX-Bold.otf
/usr/share/fonts/stix/STIX-BoldItalic.otf
/usr/share/fonts/stix/STIX-Italic.otf
/usr/share/fonts/stix/STIX-Regular.otf

$ rpm -ql stix-math-fonts
/etc/fonts/conf.d/61-stix-math.conf
/usr/share/fontconfig/conf.avail/61-stix-math.conf
/usr/share/fonts/stix
/usr/share/fonts/stix/STIXMath-Regular.otf

$ rpm -ql mathjax-size1-fonts.noarch
/usr/share/fonts/mathjax
/usr/share/fonts/mathjax/MathJax_Size1-Regular.eot
/usr/share/fonts/mathjax/MathJax_Size1-Regular.otf
/usr/share/fonts/mathjax/MathJax_Size1-Regular.svg

So, I guess the question is, what's the difference between these MathJax fonts and normal STIX?

@QuLogic

This comment has been minimized.

Copy link

commented Jan 20, 2014

Note, the packaged version of the font is from MathJax 2.2.

@pkra

This comment has been minimized.

Copy link
Member Author

commented Jan 21, 2014

@QuLogic Thanks for the update. For full functionality, all those font files are necessary -- the MathJax fonts are split up into pieces so that the download as webfonts is faster. Compare this to files in https://github.com/mathjax/MathJax/tree/master/fonts/HTML-CSS/TeX/woff (on the other hand, you only need one format, otf or woff is usually the choice for a modern system).

@QuLogic

This comment has been minimized.

Copy link

commented Jan 21, 2014

Right, but the original issue is that, having installed STIX locally, MathJax never tried to load any webfonts, and apparently, the packaged STIX fonts don't contain these size1 glyphs. Since the MathJax fonts are split up already, is there a way that MathJax can test in a more fine-grained manner whether to load a webfont?

@QuLogic

This comment has been minimized.

Copy link

commented Jan 21, 2014

Alternatively, if you can tell me how MathJax attempts to use the size1 glyphs, maybe I can figure out if there's a packaging error for the STIX fonts.

@dpvc

This comment has been minimized.

Copy link
Member

commented Jan 22, 2014

@QuLogic, by default, MathJax looks for fonts in the following order:

  1. Locally installed MathJax fonts
  2. Locally installed STIX fonts (original form, not Word form; see below)
  3. Web fonts (usually the MathJax fonts, but as of v2.3 there are additional options)
  4. Image fonts if none of the others are available

The STIX fonts come in several forms. The original STIX fonts are a set of 29 fonts with names like STIXGeneral, STIXVariants, STIXSizeOneSym, and so on. Several years ago, the fonts were repackaged to work better with MS Word; there are only five fonts, and they are in two families: STIX and STIXMath. Because of the organization of these fonts, MathJax can't use them (many of the characters are inaccessible to the browser). These are the ones that you have listed in the stix-fonts and stix-math-fonts packages, so these are not usable by MathJax, and they should have no effect on your use of MathJax. But apparently Fedora comes with the original STIX fonts installed by default (or as part of some other package, like texlive).

The MathJax fonts are a set of 26 different fonts similar to the STIX ones, with names like MathJax_Main, MathJax_Math, and MathJax_SIze1.

To determine if you have the (original) STIX fonts installed, MathJax looks for the STIXSizeOneSym font, and if you have that, it assumes you have the complete set of STIX fonts. Similarly, to determine if the MathJax fonts are installed locally, MathJax will look for the MathJax_Size1 font. If this font is on your system, it assumes that you have the full set.

So what MathJax does is first look for MathJax_Size1, then STIXSizeOneSym, and if neither is available, it uses the MathJax web fonts. So initially (before you installed any of the packages), MathJax doesn't find MathJax_Size1, but does find STIXSizeOneSym, so tries to use these. But they seem not to work properly, as reported in the original messages.

After installing MathJax_Size1, however, MathJax finds that before looking for STIX fonts, and so thinks you have the MathJax fonts locally installed, and switches to those. But you don't have all the MathJax fonts installed; fortunately, MathJax checks each font as it is requested, and if you don't have it, it will load the web version, so having MathJax_Size1 installed is enough to make MathJax work, since that one font will be taken locally and the others as web fonts. (This is not possible with the original STIX fonts, because of their size. They are too big to use as web fonts practically.)

Since the MathJax fonts are split up already, is there a way that MathJax can test in a more fine-grained manner whether to load a webfont?

I'm not sure what you are after, but I think it already does that, as I described above, at least when local MathJax fonts are detected.

As an aside, whoever put the MathJax font package together didn't really understand them. First, there is no reason to make separate packages for each font, as they are not really useful separately, but only as a set. So they should be all in one package. Second, the only font that is really useful on a Linux system is the .otf version. There is no point (that I know of) for the .eot version, which is a Microsoft format, and the .svg form is inferior to the .otf form, and don't see any need for them when you have the .otf versions. So a package with the 26 .otf fonts would make a better package.

@QuLogic

This comment has been minimized.

Copy link

commented Jan 22, 2014

These are the ones that you have listed in the stix-fonts and stix-math-fonts packages, so these are not usable by MathJax, and they should have no effect on your use of MathJax. But apparently Fedora comes with the original STIX fonts installed by default (or as part of some other package, like texlive).

No, there are no other copies of STIX installed besides the ones I mentioned. There is a texlive-stix package, but I do not have it installed.

So what MathJax does is first look for MathJax_Size1, then STIXSizeOneSym, and if neither is available, it uses the MathJax web fonts. So initially (before you installed any of the packages), MathJax doesn't find MathJax_Size1, but does find STIXSizeOneSym, so tries to use these. But they seem not to work properly, as reported in the original messages.

OK, I see what the issue is, then. The stix-fonts package contains a fontconfig file that sets up aliases for all the STIX 1.0 names to the generic 1.1 name (e.g., STIXSizeOneSym->STIX). And apparently, STIX 1.1.0 is not a 1-to-1 replacement for its old names?

As an aside, whoever put the MathJax font package together didn't really understand them. First, there is no reason to make separate packages for each font, as they are not really useful separately, but only as a set. So they should be all in one package. Second, the only font that is really useful on a Linux system is the .otf version. There is no point (that I know of) for the .eot version, which is a Microsoft format, and the .svg form is inferior to the .otf form, and don't see any need for them when you have the .otf versions. So a package with the 26 .otf fonts would make a better package.

I believe these are the standard packaging rules, one package per family. If you're saying each font file is part of the same family, then yes the package should be changed. As for the .eot and .svg files, those packages are intended for web servers, so I think they're supposed to be there.

@dpvc

This comment has been minimized.

Copy link
Member

commented Jan 22, 2014

Thanks for the additional information.

The stix-fonts package contains a fontconfig file that sets up aliases for all the STIX 1.0 names to the generic 1.1 name (e.g., STIXSizeOneSym->STIX). And apparently, STIX 1.1.0 is not a 1-to-1 replacement for its old names?

OK, that makes sense. No, STIX is not a replacement for the original STIX fonts, especially fonts like STIXSizeOneSym (the characters for this font are in STIX, but not at the same locations, and indeed they are not accessible from most browsers). So this seems like a bad idea. It certainly confuses MathJax.

I suppose it might be possible for MathJax to recognize STIX when STIXSizeOneSym is mapped to it, but I'd have to check into that.

I believe these are the standard packaging rules, one package per family. ... As for the .eot and .svg files, those packages are intended for web servers, so I think they're supposed to be there.

OK, good point about the server. I didn't think of that.

@QuLogic

This comment has been minimized.

Copy link

commented Jan 28, 2014

OK, that makes sense. No, STIX is not a replacement for the original STIX fonts, especially fonts like STIXSizeOneSym (the characters for this font are in STIX, but not at the same locations, and indeed they are not accessible from most browsers). So this seems like a bad idea. It certainly confuses MathJax.

Would this change of locations make it impossible to use the characters from fontconfig as well? If that's the case, then the aliases would be useless, and I could possibly open a bug in Fedora stating such.

@dpvc

This comment has been minimized.

Copy link
Member

commented Feb 20, 2014

Sorry for the long delay in getting back to you on this.

I think that aliasing things like STIXSizeOneSym to STIX is a bad idea, as it will never give the desired results, and is at best a poor approximation. It definitely confuses MathJax, and so I would consider that a bug in the font configuration. If you want to file a bug, that would be great.

@QuLogic

This comment has been minimized.

Copy link

commented Feb 22, 2014

Maybe it just wasn't explained well, but the Fedora maintainer seems pretty dead-set on keeping the aliases for backwards-compatibility or something.

Would it be possible to check for the (4 text + symbol) fonts in preference to the 29 separate font setup?

@dpvc

This comment has been minimized.

Copy link
Member

commented Feb 22, 2014

Would it be possible to check for the (4 text + symbol) fonts in preference to the 29 separate font setup?

MathJax can not use those fonts because many of the needed characters are not in locations within the font that browsers can access.

the Fedora maintainer seems pretty dead-set on keeping the aliases for backwards-compatibility

Backward incompatibility is more like it. Mapping things like STIXSizeOneSym to STIX is simply wrong, and provides no backward compatibility. At best, you get similar but wrongly sized glyphs. Hardly compatible.

@dpvc dpvc removed the Investigate label Feb 22, 2014

@dpvc

This comment has been minimized.

Copy link
Member

commented Feb 22, 2014

I will try to see if I can put something together that recognizes the difference between the true STIXSizeOneSym and the STIX word font.

@dpvc dpvc added this to the Bugfix Version milestone Feb 22, 2014

@pkra

This comment has been minimized.

Copy link
Member Author

commented Feb 22, 2014

@QuLogic do you have a link to a public discussion? I'm pretty sure we could get some STIpub folks to comment on the situation.

@QuLogic

This comment has been minimized.

Copy link

commented Feb 22, 2014

@QuLogic do you have a link to a public discussion? I'm pretty sure we could get some STIpub folks to comment on the situation.

@pkra Yea, it's at the bug report posted by @palmstrom.
https://bugzilla.redhat.com/show_bug.cgi?id=1026871

@dpvc

This comment has been minimized.

Copy link
Member

commented Feb 22, 2014

@QuLogic, Thanks for the pointer. Frankly, the maintainer has no idea what he is talking about when he discusses the STIX fonts. The STIX-1.1 fonts include the STIXGeneral distribution as well as the STIX Word fonts. The STIX repository at SourceForge has four distribution files: STIXv1.1.1-webfonts.zip, which include the original STIXGeneral (called stix-web) as well as the STIX-MathJax web fonts; STIXv1.1.1-word.zip, which is the 5-font version in families STIX and STIXMath packaged for use with Word (the ones used by Fedora); STIXv1.1.0-latex.zip, which is the fonts packaged for use with TeX; and STIXv1.1.0.zip, which includes the original STIXGeneral as well as the STIX Word fonts. Note that all of these are STIX v1.1, the current version.

The first and last of these include the STIXGeneral fonts (updated to the v1.1 glyphs and positions), and these are the most recent files. Indeed, the STIX-webfonts archive is from this year, and includes the STIXGeneral packaging (not the word format). To say that STIpub as abandoned the STIXGeneral format is to deeply misunderstand the current situation. The STIXGeneral fonts are not v1.0, they are v1.1, just as STIX Word is. They are not an older version, and not obsolete or outdated. The Fedora aliasing of these names to STIX Word is broken, plain and simple.

His claim that MathJax hasn't bothered to update is again a statement that is ignorant of the facts. It is not that MathJax doesn't want to use the STIX Word fonts, it is that it can not, because the organization of the fonts makes many of the characters inaccessible to the browser. There are some proposals for CSS that will give browsers access to those via the "font features" mechanism, but these are not yet implemented in most browsers, and so at this point, the STIX Word fonts are unusable by MathJax, not matter what would would like to do. The maintainer's claims, at best, based on a lack of understanding of the situation.

He can make complaints about browsers not wanting to change, or MathJax not wanting to update, but the fact of the matter is that he is the one who is making things break for Fedora users. Personally, I don't have any particular interest in Fedora, but if he wants his user's experience to be sub-standard, then that's up to him, I guess.

dpvc pushed a commit to dpvc/MathJax that referenced this issue Mar 4, 2014

Davide P. Cervone
Work around stupid Fedora stix font package that incorrectly aliases …
…all STIXGeneral fonts to STIX-Word fonts. Resolves issue mathjax#501.
@dpvc

This comment has been minimized.

Copy link
Member

commented Mar 4, 2014

OK, I've added a test that checks for Fedora's broken font aliasing.

@dpvc

This comment has been minimized.

Copy link
Member

commented Mar 15, 2014

=> Merged.

@dpvc dpvc added Merged and removed Ready for Review labels Mar 15, 2014

@dpvc dpvc closed this Mar 15, 2014

@dpvc dpvc added v2.4 and removed Merged labels Jun 30, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.