[XeTeX] How to use ucharclasses

Mike Maxwell maxwell at umiacs.umd.edu
Sun Feb 19 23:42:20 CET 2012

(This is addressed to Michiel Kamermans, but I'm putting it here on the XeTeX list in case it helps 

I'm trying to figure out how best to use your 'ucharclasses' program, and I'm a little confused 
(TeX/ LaTeX not being my main programming language).

I'm working with a couple right-to-left scripts, Thaana and Arabic, in the context of grammars 
written in English.  Both the R2L scripts often incorporate ASCII punctuation characters, which are 
generally present in the fonts for those scripts.  So what I *think* I want is the ff:

\setTransitionsFor{Latin}{\fontspec{Charis SIL}\setLR}{}
\setTransitionsFor{Phonetics}{\fontspec{Charis SIL}\setLR}{}
\setTransitionTo{Thaana}{\fontspec{Mv Elaaf Normal}\setRL}

What I'm confused about is that no-op line for Punctuation: Maybe I don't need it.  I just want to 
make sure that ucharclasses doesn't automatically (and incorrectly) set the directionality when it 
hits an ASCII punctuation character.  So I put this command in so as to override any behavior that 
punctuation might inherit from Latin (i.e. from BasicLatin).  If that's correct--if I need to 
override the behavior that punctuation would otherwise get from Latin--do I need to do the 
\setTransitionsFor{Punctuation} before or after the \setTransitionsFor{Latin} command?

Also, is there any reason here to use \setTransitionFrom?  I don't see any, so long as I cover all 
the transitions *to* a block, but maybe I'm missing s.t.  In the sample file (ucharclasses.tex), 
Michiel of course does do a transition out of right-to-left when exiting the Arabic block; but I 
explicitly do not want to do this when encountering punctuation.

Finally, I'm assuming space characters in the XeLaTeX input don't trigger any kind of transition 
(despite the fact that the ASCII space char is in BasicLatin).  Otherwise the L2R and R2L 
transitions surely wouldn't work right.
	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