Search code examples
htmlxhtmlcssfontsopentype

How can I call 'Swash'/'Stylistic Set' Characters from an OpenType font in HTML?


I'm working on a project right now that within the OpenType font has several variations of the same character. All the characters have the same Unicode ID but have different GID numbers and some other reference like Swash or Stylistic SetXX (ss01) (found this information in indesign). Is there any way to use these characters in an HTML document?

Example: J (normal), J (with speed blur), J (made out of chains), All have unicode id: 004A, but have GID values of 43, 206 and 233 respectively.


Solution

  • font-variant-alternates is what you want: http://www.w3.org/TR/css3-fonts/#font-variant-alternates-prop

    I don't know how widely supported it is yet, and bet that it's not in IE.

    This page shows support for OTF in general: http://caniuse.com/#feat=ttf ; It is not clear whether complete support is really complete, in this sense.

    Demos of Firefox and IE support: http://ie.microsoft.com/testdrive/Graphics/opentype/opentype-fontfont/index.html