Local fonts not being used

28 views
Skip to first unread message

Dr. Drang

unread,
Dec 14, 2010, 5:52:44 PM12/14/10
to mathja...@googlegroups.com
I cannot get MathJax to use my local fonts. I am running Mac OSX and have the STIX fonts installed. I can seen them in FontBook and can use them in programs like Pages and TextEdit.

The HTML-CSS section of config/MathJax.js says (after removing the comments)

  "HTML-CSS": {
    
    scale: 100,
    availableFonts: ["STIX","TeX"],
    preferredFont: "STIX",
    webFont: "TeX",
    imageFont: "TeX",
    showMathMenu: true,
    styles: {},
    tooltip: {
      delayPost: 600,          // milliseconds delay before tooltip is posted after mouseover
      delayClear: 600,         // milliseconds delay before tooltip is cleared after mouseout
      offsetX: 10, offsetY: 5  // pixels to offset tooltip from mouse position
    }
  },

To me, this means MathJax should use the local STIX fonts in preference to the TeX web fonts, but that's not what happens. It always downloads the web font. If I set the webFont parameter to null, it uses images instead of web fonts . The local STIX fonts are never used.

What am I missing or doing wrong?

Davide P. Cervone

unread,
Dec 15, 2010, 9:47:05 AM12/15/10
to mathja...@googlegroups.com
Here are some questions that might help us address your issue:

1. What browser are you using, and what version?

2. Is MathJax coming from a server, or being loaded locally from the
hard disk?

3. What version of the STIX fonts are you using?

For number 3, you need to use the actual distribution copy of SITX
fonts, not one of the earlier beta versions. There were a lot of
changes made from the beta versions to the final release, and most of
the earlier versions would not work properly with MathJax.

Davide

Dr. Drang

unread,
Dec 15, 2010, 11:18:54 AM12/15/10
to mathja...@googlegroups.com
On Wed, Dec 15, 2010 at 8:47 AM, Davide P. Cervone <dp...@union.edu> wrote:
Here are some questions that might help us address your issue:

1.  What browser are you using, and what version?

I'm using Safari, Version 5.0.3 (6533.19.4), but I get the same behavior in Chrome 8.0.552.224 and Firefox 3.6.8.
 

2.  Is MathJax coming from a server, or being loaded locally from the hard disk?

I've done it both ways and get the same behavior.
 

3.  What version of the STIX fonts are you using?

For number 3, you need to use the actual distribution copy of SITX fonts, not one of the earlier beta versions.  There were a lot of changes made from the beta versions to the final release, and most of the earlier versions would not work properly with MathJax.

According to FontBook, my office machine has Version 1.0.0, downloaded by following the links on the MathJax site. I'm not sure what my home computer (which has the same problem) has, but they were downloaded from the official site just a few days ago, so they should be current.

Another request: As best as I can tell, my local TeX fonts aren't being used, either. I see messages about downloading webfonts whizzing by in the little info box in the lower left corner. I have local TeX fonts (a holdover from jsMath), but I'm not sure I have them in the form or with the names MathJax wants. Can you also point me to the best set of TeX fonts to use?

Davide P. Cervone

unread,
Dec 17, 2010, 3:37:53 PM12/17/10
to mathja...@googlegroups.com
Well, I don't see why these browsers would be giving you any trouble.  They work fine for me.  I assume you restarted them after installing the fonts?  And that there are no older versions of the fonts also installed anywhere else on the system?

As for local TeX fonts, MathJax can't use them because they are not in a format (or a location) that the browsers can use.  The old jsMath fonts will not be a help, as MathJax doesn't have data for them, and so won't use them.  You could install the OTF fonts in the MathJax/fonts/HTML-CSS/TeX/otf directory, and that should work (except for MSIE, which would need a couple others that aren't there).

You can use the About MathJax entry in the MathJax contextual menu (ctrl-click or right-click on an equation typeset by MathJax) to find out what font set it is using.

Davide

Dr. Drang

unread,
Dec 18, 2010, 11:03:37 AM12/18/10
to mathja...@googlegroups.com
On Fri, Dec 17, 2010 at 2:37 PM, Davide P. Cervone <dp...@union.edu> wrote:
Well, I don't see why these browsers would be giving you any trouble.  They work fine for me.  I assume you restarted them after installing the fonts?  And that there are no older versions of the fonts also installed anywhere else on the system?

Because of a recent system software upgrade, I not only restarted the browsers, I've restarted the entire computer. And one of the computers with this problem is brand new, so it can't have an older version of the fonts.
 
You can use the About MathJax entry in the MathJax contextual menu (ctrl-click or right-click on an equation typeset by MathJax) to find out what font set it is using.

Here's a funny thing I just discovered (I'd had showFontMenu set to false until a few minutes ago): the equations render the same whether I choose Auto, TeX (local), TeX (web), or STIX (local) from the Font Preference contextual menu. (TeX (image) is different and does use images.)

Maybe I've got something else screwed up in my configuration file and the isn't with my computer but with my site. What do you see when you look at it?

Davide P. Cervone

unread,
Dec 18, 2010, 12:27:21 PM12/18/10
to mathja...@googlegroups.com
I see the math rendered with local STIX fonts, as would be expected for your configuration.  This is in Safari 5.0.3.  

You might try removing the MathJax menu cookie for your site, to see if there is anything there that is forcing it to chose the wrong fonts.

Davide

Dr. Drang

unread,
Dec 19, 2010, 6:48:31 PM12/19/10
to mathja...@googlegroups.com
On Sat, Dec 18, 2010 at 11:27 AM, Davide P. Cervone <dp...@union.edu> wrote:
I see the math rendered with local STIX fonts, as would be expected for your configuration.  This is in Safari 5.0.3.

In a way, I'm glad to see that others are getting what I intend. It is frustrating, though, that *I* don't see what I want. There's also the higher bandwidth.

You might try removing the MathJax menu cookie for your site, to see if there is anything there that is forcing it to chose the wrong fonts.

That didn't change things either. I also changed my STIX font installation from ~/Library/Fonts to /Library/Fonts with no change in the rendering.

I installed the TeX fonts locally using your instructions, and now my page is using them instead of the web fonts, which is an improvement. Thanks for making my pages load faster.

One thing I've noticed in using Safari's Web Inspector is that the font-family for the equations is

    font-family: MathJax_Main, MathJax_Size1, MathJax_AMS;

which, after I installed the TeX fonts, are the names of fonts on my system. Before I installed the TeX fonts, they were available only as web fonts.

But shouldn't it be asking for fonts with names like "STIXGeneral" if it's going to use the STIX fonts? Did I miss some essential step?

Thanks for your patience.

Davide P. Cervone

unread,
Dec 20, 2010, 5:07:11 PM12/20/10
to mathja...@googlegroups.com
> I see the math rendered with local STIX fonts, as would be expected
> for your configuration. This is in Safari 5.0.3.
>
> In a way, I'm glad to see that others are getting what I intend. It
> is frustrating, though, that *I* don't see what I want. There's also
> the higher bandwidth.

I'm stumped at the moment about that. I really don't know what to
look at, as I am not able to reproduce the problem.

I may be able to give you some diagnostic code to print out more data
about what is going on, and perhaps that will help me understand what
the issue is. The font-detection code is delicate, and there may be
an interaction with your setup that is causing the problem.

> One thing I've noticed in using Safari's Web Inspector is that the
> font-family for the equations is
>
> font-family: MathJax_Main, MathJax_Size1, MathJax_AMS;
>
> which, after I installed the TeX fonts, are the names of fonts on my
> system. Before I installed the TeX fonts, they were available only
> as web fonts.
>
> But shouldn't it be asking for fonts with names like "STIXGeneral"
> if it's going to use the STIX fonts? Did I miss some essential step?

The styles set on the equations is dependent on what fonts MathJax
detects as being available. It would only put out STIXgeneral if it
had determined that those fonts were present, and it doesn't think
they are. When it uses the web-based TeX fonts, it will use the names
that you refer to above.

Davide

Dr. Drang

unread,
Dec 21, 2010, 2:51:23 AM12/21/10
to mathja...@googlegroups.com
Davide,

I posted this comment on my blog, and figured it should be added to this thread.

-----------------------------

Maybe I'm delirious because I'm up past my bedtime, but…

Acting on Tony's suggestion [in an earlier comment], I deleted the STIX fonts via Font Book, then reinstalled them by dragging the STIXxxx.otf files into my ~/Library/Fonts folder—I didn't use Font Book. Upon relaunching Safari, the equation above was rendered in STIX.

While I was happy to see this, it made no sense; copying files into Fonts folders is what Font Book does. So I decided to run another test.

I dragged the fonts back out of ~/Library/Fonts and checked to make sure Safari went back to using the TeX fonts. It did. Now I had a clean system for testing.

I reinstalled the STIX fonts using Font Book. Specifically, I selected the STIXxxx.otf files in the Finder from ~/Downloads/STIXv1.0.0/Fonts and dragged them into the "User" collection in the sidebar of the Font Book window. This put them in ~/Library/Fonts. When I relaunched Safari and opened this page, the equation above was rendered in "local STIX fonts."

Another test: I deleted the STIX fonts via Font Book again and reinstalled them via Font Book, this time dragging them into the "Computer" collection so they'd be copied into /Library/Fonts. When I relaunched Safari and opened this page, the equation above was again rendered in "local STIX fonts."

If you're keeping score at home, here's the order of what I did and the results:

1. Install in ~/Library/Fonts via Font Book—not recognized.
2. Install in /Library/Fonts via Font Book—not recognized.
3. Install in ~/Library/Fonts via direct copy—recognized.
4. Install in ~/Library/Fonts via Font Book—recognized.
5. Install in /Library/Fonts via Font Book—recognized.

I have absolutely no idea why 1 differed from 4 and 2 differed from 5, but they did. This is the kind of thing that drives programmers crazy. In this case, fortunately, I'm not the programmer.

--------------------

I don't know where this leaves you, except that if you do come up with some debugging code I wouldn't be the right person to run it because I'm not having the problem any more. One of my readers is still seeing TeX fonts when he should see STIX; if you want to pursue this I can put you in touch with him.

Davide P. Cervone

unread,
Dec 21, 2010, 8:14:22 AM12/21/10
to mathja...@googlegroups.com
OK, thanks for the update.

I think I understand what you did for 2 through 5, as these are
described in your message below. Can you tell me exactly what 1 and 2
mean? I will see if I can reproduce. If not, then at least it seems
you have come up with a way to get them installed so that they do
work, and we can tell people how to do it if they are having
problems. It also accounts for why I was seeing the STIX fonts, since
I usually install by hand rather than through Font Book.

Davide

Dr. Drang

unread,
Dec 21, 2010, 9:20:18 AM12/21/10
to mathja...@googlegroups.com
On Tue, Dec 21, 2010 at 7:14 AM, Davide P. Cervone <dp...@union.edu> wrote:
OK, thanks for the update.

I think I understand what you did for 2 through 5, as these are described in your message below.  Can you tell me exactly what 1 and 2 mean?  I will see if I can reproduce.  If not, then at least it seems you have come up with a way to get them installed so that they do work, and we can tell people how to do it if they are having problems.  It also accounts for why I was seeing the STIX fonts, since I usually install by hand rather than through Font Book.

Honestly, I can't think of any difference between 1 and 4 or between 2 and 5. I downloaded the fonts from the STIX site, unzipped the file, and dragged the files from ~/Downloads/STIXv1.0.0/Fonts into Font Book. The same installation technique I've used with many other fonts (and the same technique I used in 2 and 4).

The weird thing is that although installing "by hand" did work, so did installing through Font Book, but only after I'd done an install-and-remove by hand. (I should emphasize that for each of the five cases, I removed the fonts by the same technique as I installed them.)

Finally, I realized this morning that I *can* try running any debugging code you come up. The STIX fonts are detected on only one of my two computers. My iMac, which has the STIX fonts installed in ~/Library/Fonts via Font Book, is still showing equations in the TeX fonts. I'd be happy to run any tests you can think of to learn why the local STIX fonts aren't being detected.

Davide P. Cervone

unread,
Dec 21, 2010, 10:07:32 AM12/21/10
to mathja...@googlegroups.com
> Finally, I realized this morning that I *can* try running any
> debugging code you come up. The STIX fonts are detected on only one
> of my two computers. My iMac, which has the STIX fonts installed in
> ~/Library/Fonts via Font Book, is still showing equations in the TeX
> fonts. I'd be happy to run any tests you can think of to learn why
> the local STIX fonts aren't being detected.

OK, the first thing to try is seeing whether the STIX fonts show up in
other applications, like TextEdit.

If they don't show up, then it is some sort of system-level problem,
and there probably is nothing I can do about it from MathJax's side of
things. If they do show up, then it may be a problem of MathJax
detecting the fonts rather than their availability. In that case, I
will send an HTML file that will help test if the browser has access
to the fonts, but MathJax isn't picking that up.

Davide

Dr. Drang

unread,
Dec 21, 2010, 3:46:14 PM12/21/10
to mathja...@googlegroups.com
On Tue, Dec 21, 2010 at 9:07 AM, Davide P. Cervone <dp...@union.edu> wrote:
Finally, I realized this morning that I *can* try running any debugging code you come up. The STIX fonts are detected on only one of my two computers. My iMac, which has the STIX fonts installed in ~/Library/Fonts via Font Book, is still showing equations in the TeX fonts. I'd be happy to run any tests you can think of to learn why the local STIX fonts aren't being detected.

OK, the first thing to try is seeing whether the STIX fonts show up in other applications, like TextEdit.

They do. That was one of the first things I checked before starting this absurdly long thread.
 
If they don't show up, then it is some sort of system-level problem, and there probably is nothing I can do about it from MathJax's side of things.  If they do show up, then it may be a problem of MathJax detecting the fonts rather than their availability.  In that case, I will send an HTML file that will help test if the browser has access to the fonts, but MathJax isn't picking that up.

Thanks. I'll test it out and report back. 

Davide P. Cervone

unread,
Dec 21, 2010, 4:48:18 PM12/21/10
to mathja...@googlegroups.com, drd...@gmail.com
I've attached an HTML file that should check whether the STIX fonts are available to the browser.  You should see two lines of text at the top; the first should be in the STIX fonts, and the second in the browser's sans-serif font.  If the top one looks just like the bottom, then the browser doesn't seem to have access to the STIX fonts. If they look different, then it does.  (The file should print a third line indicating which it thinks is the case.)

Let me know what you see for this file.

Davide

PS, I'm not sure what Google Groups will do with this attachment, so I've copied you directly so that you should at least get the attachment that way.
STIX-test.html

Dr. Drang

unread,
Dec 22, 2010, 10:38:48 AM12/22/10
to Davide P. Cervone, mathja...@googlegroups.com
The test file suggests that the STIX fonts are being detected. I've attached a screenshot from Safari 5.0.3 (zoomed in several steps); the results are the same in Chrome 8.0.552.231 and Firefox 3.6.8. These browsers are, however, still using TeX fonts when visiting my site.

A minor point: I had to change the font-family style declarations in the test file from "sansserif" to "sans-serif," as none of the browsers recognized "sansserif." I've attached the changed test file so you can see it.
STIX-test.html
STIX-test.png

Davide P. Cervone

unread,
Dec 22, 2010, 1:54:16 PM12/22/10
to Dr.Drang, mathja...@googlegroups.com
OK, thanks for the update.  It looks like MathJax is having trouble detecting the local fonts, so that will take some more testing.  I'll send you another test file as soon as I get the chance.  In the meantime, what happens if you use the MathJax font menu to select local STIX fonts and then view the MathJax/test/sample-tex.html page through your server?  Do you get the STIX fonts or TeX fonts?

Davide

PS, sorry about the sans-serif typo.  My default font is sans-serif, so I didn't notice the error.


<STIX-test.html><STIX-test.png>

Reply all
Reply to author
Forward
0 new messages