Options

Check support of OpenType features in browser by JavaScript

Has anyone found a way to check in JavaScript whether certain OpenType features are supported by a certain browser that don't involve rasterization and bitwise comparison of Webfonts or similar voodoo?

Most tests fail because the CSS properties are indeed supported, but they are not executed for all features.
For instance, font-feature-settings is supported in Safari, which is true because it supports features like liga and calt, but no Stylistic Sets and other dubious features.

Then, even if not executed, Safari would add ss01 to its style elements. So a comparison between style objects is not productive.

Comments

  • Options
    I think we found voodoo is the best science on CSS feature support.
  • Options
    i tested liga support recently at work by creating a single ot liga sub which, if successful, would sub in a zero-width glyph and measuring the width of an off-screen span. it's less voodoo-ey, but it's still a bit gross but it lets you do things like var ligaSupported = $(el).width() === 0;

    Does anyone have other tricks?
  • Options
    yanoneyanone Posts: 129
    Nice one!
Sign In or Register to comment.