[XeTeX] redefining Unicode characters

Mike Maxwell maxwell at umiacs.umd.edu
Tue Jan 15 05:45:18 CET 2013

We are typesetting a grammar that has instances of 'a' + combining macron + combining acute.  The 
publisher requires us to use a font that does not produce stacked diacritics well (the acute accent 
overwrites the macron, rather than appearing above it).

The publisher's solution in this font (which won't work in every case, but will for this particular 
sequence) is to replace the sequence 'a' + combining macron + combining acute with a single 
pre-composed character in the Private Use Area of Unicode.

There are several ways we could do this.  One would be to convert all the sequences in our document 
once and for all; but that has the disadvantage that the characters will show up as boxes in the 
source code (we aren't using and don't particularly want to use the publisher's font in our editor, 
for reasons I won't go into).  It has the further disadvantage that if anyone later on adds another 
instance of this sequence, we may forget to convert it (and XeLaTeX will not produce an error, just 
a bad looking output).

Another way would be to insert a pre-processing step that uses a stream editor (like sed) to convert 
the sequence to the PUA character.  Clumsy, but perhaps preferable to the first method.

My preference would be if it were possible for XeLaTeX itself to do the conversion.  Note that I do 
not want to create a command (prefixed by a \ and using {}, I suppose) to do this; that would be 
almost as bad as the first method.  Is there any way to tell XeLaTeX to map a particular sequence of 
Unicode code points to a different code point?  I didn't see anything obvious in the fontspec manual.

I'm assuming there's no straightforward way to tell XeTeX to place an acute slightly higher when it 
immediately follows a macron.  Such a solution would solve problems that will arise later when we 
have other sequences of stacked diacritics, which are not given pre-composed forms in the 
publisher's font.
	Mike Maxwell
	maxwell at umiacs.umd.edu
	"My definition of an interesting universe is
	one that has the capacity to study itself."
         --Stephen Eastmond

More information about the XeTeX mailing list