Re: Using Javascript to Detect Script Support in a Browser

From: Ed Trager (
Date: Tue Jun 22 2010 - 08:40:36 CDT

  • Next message: Marc Durdin: "RE: Using Javascript to Detect Script Support in a Browser"

    Hi, Andrew,

    On Tue, Jun 22, 2010 at 12:17 AM, Andrew Cunningham
    <> wrote:
    > hi Ed,
    > On 22 June 2010 11:51, Ed Trager <> wrote:
    >> Thanks, Andrew!  I like Keith's approach.
    >> I have been looking at Lanna a little bit and I am not sure if *any*
    >> OS shaper currently really has fully implemented correct shaping
    >> support for Lanna?  In any event, Lanna is quite similar to Myanmar,
    >> so Keith's approach could be used very successfully.
    > since there are no specific guidance for developing Lanna or Myanmar
    > OpenType fonts, I assume that Lanna fonts have developed using some of
    > the more generic OpenType features much like Myanmar and thus should
    > shape correctly on the same platforms as Myanmar Unicode fonts do.
    > I guess the key issue is who your target audience are

    Currently the target audience for Lanna is still mostly just myself
    for development experiments: I chose to use Lanna as a "guinea pig"
    for the implemention of a new JSON-based keyboard map in my new
    Javascript-based virtual keyboard and input methods engine. In my
    "old" implementation, my keyboard maps contained only the key
    remapping data. In my new implementation, of which my Lanna keyboard
    is the first and currently only example, the keyboard map is augmented
    with various meta data.

    The really interesting meta data are new "suggestedFont" and
    "suggestedFontFilename" properties. The idea here is that if the
    Javascript engine detects that the UA is rendering square boxes, then
    the engine can add an @font-face rule on the fly to download and use a
    font for the target script (Lanna, in this case, but could be anything
    of course). I've already implemented this, and it works nicely. But
    it still doesn't guarantee correct rendering. Keith Stribley's
    Javascript implementation for detecting whether Myanmar is actually
    being shaped correctly is --as you note-- generalizable to these other
    S / SE Asian scripts like Lanna. So I'm going to work on that
    generalization next: that is, at a minimum, I'll get the detection
    part working for Myanmar, Lanna, and probably Khmer -- and add other
    scripts in the future.

    > and what is the
    > oldest OS versions likely to be used on your site?

    I'm currently really only looking at the modern non-IE browsers (FF,
    Safari, Chrome, Opera) on WinXP, Win7, OS X, and current Linux. I
    hope to look at rendering on portable devices like iPhones too. We'll

    > Out of curiosity, which OpenType fonts are you using for Lanna?

    I first looked at Octra Bond's page as a reference for a Lanna keyboard layout.

    Bond's Tai Khuen-style glyphs are good for onscreen display. However,
    I'm personally much more comfortable reading the Lanna style glyphs
    such as shown in the illustrations on this wikipedia page:


    ... and so what I really want to do is implement my own Unicode font
    for Lanna using this more calligraphic glyph style. But that's a lot
    of work! (Fonts in this other style already exist, but are not
    Unicode fonts). Not sure whether or when I'll actually get around to
    doing this ...

    > When experimenting with Myanmar web fonts, I made one big mistake,
    > relied on some of the web based tools for generating web fonts, which
    > broke the complex rendering. Best to generate the web fonts form
    > available command line tools.

    OK. Currently I'm going to stick with the original OpenType files and
    not attempt to generate eots or woffs. Doing so at this point would
    just introduce extraneous variables and more bugs.

    >> It might be interesting to see if Keith's approach can be generalized
    >> a bit to detect whether correct rendering is available for a number of
    >> those related S and SE Asian scripts: Myanmar, Lanna, Khmer, Kannada,
    >> etc.
    > should be possible.

    Yep. As mentioned I'm going to try that.

    > --
    > Andrew Cunningham
    > Senior Project Manager, Research and Development
    > Vicnet
    > State Library of Victoria
    > Australia

    This archive was generated by hypermail 2.1.5 : Tue Jun 22 2010 - 08:43:41 CDT