I would like to get the variant option from fontspec working under Linux. Unfortunately, this option which works with the AAT font system is not compatible with the OpenType font mechanism used under Linux.
However, I dumped one of the Mac OS X fonts which contains such variant glyphs and I found that these variant glyphs can be easily got by using their name. Indeed their name are composed like this: "<name of the standard glyph>.<variant number>". For instance to get the second variant of a "d", just use the: \XeTeXglyph\XeTeXglyphindex "d.2". For a "é", it would be: \XeTeXglyph\XeTeXglyphindex "eacute.2" etc.
Thus I developed a little command to get the corresponding variant if present or use the default one otherwise:
\newcommand\variantChar[2]{%
\@tempcnta=\XeTeXglyphindex "#1.#2"\relax
\ifnum\@tempcnta>0
\XeTeXglyph\@tempcnta
\else
#1
\fi}
Right now I would like to construct a command which takes two arguments: the first one would be the variant number and the second one the sentence to write by using that variant. Unfortunately I don't know exactly how can I parse character by character the second argument and call the \variantChar command.
Last but not least, I would be interested by knowing a way to get the name of a glyph in order to take into account complexe glyphs name like "eacute" or ligature glyphs like "ft" etc. Is there a such command which takes as argument the glyph and returns the glyph name?
Otherwise do you know an other way to use variant glyphs available in MacOS X fonts under Linux?