Re: JavaScript & Fonts

From: Steven Siebert (smsiebe@gmail.com)
Date: Sun Nov 01 2009 - 22:10:09 CST

  • Next message: vanisaac@boil.afraid.org: "Re: JavaScript & Fonts"

    Mike,

    JavaScript does not have the ability to determine the client fonts available
    - the common approach to determine if a client has an appropriate font is to
    attempt to use it and measure the difference between that font set and the
    system default. This guessing relies on the premise that different fonts
    have different widths and heights. For what I believe you are trying to
    accomplish, this really isn't going to be a good solution for you.

    Flash, however, does have this ability - you can get an array of available
    fonts for a client programmatically. Looking at your production, I don't
    think Flash is somewhere you want to go either. Optionally, you can always
    provide the cubed root symbol as an image when the html canvas tag isn't
    supported - this will still provide the graceful degradation you are looking
    for while not having to maintain a massive amount of JavaScript logic.

    I hope this helps. Your calculator looks good. Good luck.

    Steve

    On Sun, Nov 1, 2009 at 10:34 PM, <vanisaac@boil.afraid.org> wrote:

    > > Hello,
    > >
    > >
    > > Is there a way within a JavaScript program to enumerate
    > > all of the available fonts on a system and then to check
    > > them for support for a particular Unicode character? I
    > > need to find a font that can draw the cube root symbol
    > > U+221B for my web calculator when the new html canvas tag
    > > is not supported (such as on Internet Explorer).
    > >
    > >
    > > Thanks,
    > >
    > >
    > > Mike
    > >
    > >
    > > P.S. see http://mikestoolbox.com/calc-help.html if you are
    > > interested in the calculator
    >
    > Sorry Mike, I don't know the answer to this question. Unfortunately, a lot
    > of the people who probably do are between the WG2 and UTC meetings, so it
    > might be a week or so before a lot of people will be able to put together
    > the puzzle.
    >
    > Van
    >
    >
    >
    >



    This archive was generated by hypermail 2.1.5 : Sun Nov 01 2009 - 17:12:10 CST