jsMath-Fonts and Typeface

  • Navid Nikpour

    Navid Nikpour - 2008-10-28

    Hey Guys,
    I just stumbled over a Typeface (http://typeface.neocracy.org), a alternative way to embed fonts on a html site using HTML, CSS and JS.

    It comes with a js-library and is featured with a perl module that is used to generate a js file from a ttf file for their use with the js-library.

    So, I don't know if and how it's can be done, but is there a possibility to use that with Js Math ?
    That would get us rid of the "getting the visitor to install some fonts-or-use the images/sprites with it's caveat problems", wouldn't it ?

    Give it a look and let's discuss about it...

    so long

    • Davide P. Cervone

      I saw that project as well, and it does look interesting.  I'm not sure how well it will work with jsMath, however, as it creates CANVAS elements for the text to be rendered into.  Each character used by jsMath would have to be rendered into a separate canvas (or jsMath would have to be totally rewritten), and that sounds pretty inefficient to me.  Plus jsMath stores its internal equations as strings, not DOM elements, as it builds the equation, and it may not be efficient to convert the canvas into and out of string form frequently (which jsMath has to do as it measures the size of various parts of the equation).  JsMath is already slow enough without adding more overhead for that type of rendering.  But it might be worth a try to see how bad it is.  Using the native fonts will always be faster, more reliable, and higher quality, it seems to me, so I would still want to encourage users to install the fonts even if this approach did work.

      I wonder about the print quality of the results.  A quick test shows that (in Safari), the example pages print with screen resolution rather than printer resolution (as though they were images).  JsMath's current approach allows for higher quality printing for its image-based fonts (though you do have to request it by hand).  It also appears that you would lose any interactivity with the mathematics (no links within the math, for example) unless additional modifications were made to jsMath to implement that itself.  I was going to say that you would lose CSS style control as well, but they do seem to have addressed at least the most important CSS attributes.

      In any case, there are some issues to be considered, but it does look like an interesting idea that is worth looking into.



Log in to post a comment.