[XeTeX] Fine tune selecting alternate glyphs
David J. Perry
hospes.primus at verizon.net
Tue Feb 9 06:24:36 CET 2010
I've been thinking about this issue for a while. Let me address Szabolcs's
specific question and then raise a larger issue.
> 1. This method switches the letter shapes for all of δ, ζ, and Ξ. Is it
> possible to switch only some of them?
Peter's suggestion to declare a new font (or, perhaps better, a new font
instance; see the FontSpec manual, p. 5, for the difference) works. But if
your whole document (or a significant chunk of it) is in GFS Neohellenic you
could use addfontfeature, like this:
By putting the whole command in curly brackets you prevent all subsequent
instances of delta from taking on the alternate form. You could use the
LaTeX \newcommand feature to make this even shorter, something like:
Now whenever you type \d1 you will get the alternate delta. See any LaTeX
tutorial for help with this.
Peter's suggestion to use the codepoints may or may not work. Some font
developers give their alternate glyphs Unicode values in the Private Use
Area and some do not. The latter is really the way things should be, but
because so few applications support stylistic alternates some developers do
provide PUA values. I haven't looked at the GFS fonts you mention, but if
they have PUA values you can use the command \char"xxxx where xxxx is the
If the fonts in question do not give PUA assignments to their alternate
glyphs, and if the Alternates=1 doesn't work, you can access glyphs directly
by their glyph ID, using the command \XeTeXglyphxxxx. To do this, you must
know the glyph ID of the alternate you want. You can find this by opening
the font in a font editor, if you have one, or with the Windows TrueType
Viewer by Rogier van
Dalen, http://home.kabelfoon.nl/~slam/fonts/truetypeviewer.html, or the SIL
ViewGlyph application, http://scripts.sil.org/ViewGlyph_home. Glyph IDs are
not something that users normally deal with, so you need specialized
software to see them.
Now the more general issue:
XeTeX comes with that nifty utility that allows one to identify the OT or
AAT features that exist in a font. It would be very helpful if there were a
similar utility that would identify which characters have stylistic
alternates. Running such a utility on a font would produce a list like
a - 5 variants, b - 1 variant, e - 4 variants, g - 6 variants, etc.
One could then construct a test document to see which alternates are
accessed with which numbers. This is an important issue because some font
makers don't provide exact information about what characters have alternate
glyphs, even if they tell you that the font does contain stylistic
alternates. (I guess they assume everyone uses an application like InDesign
or Quark that comes with a palette to show the alternates.) Without this
information XeTeX users can't access the variants since they have to be
called numerically. Anybody want to write something like this? (I would do
it but I don't have the programming skills.).
More information about the XeTeX