Ligature Alternatives in LaTeX

Oct 16, 2009 03:21

I've been corresponding with Dario Taraborelli and Will Robertson, and we have concluded a couple things about LaTeX and alternative glyphs for ligatures:
  • Yes, the fontspec package supports them.
  • No, there isn't typically a good way to find out where they are.
  • If you don't care if your source code is portable (i.e., you don't care if it breaks when you update your fonts or move to a different computer with a different version of the same font), the easiest way to get at them is with \XeTeXglyph. To get a list of which values correspond to which glyphs, use a loop:

    \newcount\charcount
    \charcount=0
    \loop
    \number\charcount --- \XeTeXglyph\charcount
    \par
    \ifnum\charcount<1415 % My copy of Poetica Std has 1415 glyphs
    \advance\charcount1
    \repeatYou can use trial and error to find how many glyphs are in your font, though some programs will just straight-up tell you.
  • If you need your code to be portable, do not use \XeTeXglyph. The ligatures should be available through \fontspec[Alternate=X,Variant=Y] for certain values of X and Y. You can run opentype-info.tex (or aat-info.tex or whatever, depending on the font format) to find the maximum number of variants. I'm not aware of a way to find the maximum number of alternates installed.
  • If variants 1 and 2 aren't useful, don't give up on the rest! In Zapfino, for instance, \fontspec[Alternate=1,Variant=3] of the 'fl' ligature is different from variants 0 through 2, even though 0 through 2 are all identical in alternate 1. As far as I can tell, finding the right variant number is a trial-and-error process.
  • If you can't find the ligatures using the whole ligature itself, try using just the first letter and using higher values for X and Y. In Poetica Std, the 'ft' ligature glyphs can be accessed as alternative forms of just the 'f', with no 't' after it. I suspect this is a mistake in the font specification, but that's life.
  • Alternative glyphs, even for individual letters, cannot be transformed back into ASCII. This means it's gorgeous when you view it, but if you want a computer to process it (say, to read it aloud to a blind person who can't see the beautiful typography but still wants to know what it says), you're SOL. If you need to worry about accessibility issues, don't use alternates or variants of any kind!
So, I feel like I just leveled up in typography. Sure, this example is overly flowery to the point that the typesetting detracts from the poem itself, but it's more to illustrate a point than to make good typesetting. Note that I use two different glyphs for the 'ss' ligature, two different ones for 'ck', two different 'll's, and two different 'cl's. Also, I finally have a use for the dotless 'i' (in "Vine," my V of choice collided with the dot). Other fun typography tricks are scattered throughout, but they're more for my personal enjoyment than yours.

poetry, typesetting, latex, zapfino

Previous post Next post
Up