[XeTeX] color directives in RL context

Jonathan Kew jonathan_kew at sil.org
Tue Apr 17 14:43:42 CEST 2007


On 17 Apr 2007, at 1:34 pm, Bruno Voisin wrote:

> Le 17 avr. 07 à 14:25, Bruno Voisin a écrit :
>
>> - With fontspec, in right-to-left mode word ordering is reversed, but
>> not the individual letters within each word, yielding
>>
>> 	yz vwx stu pqr mno jkl ghi def abc
>>
>> - Without fontspec, not only word ordering is reversed but also the
>> individual letters within each word, yielding
>>
>> 	zy xwv uts rqp onm lkj ihg fed cba
>>
>> Which of these two behaviours is the intended one? Or are things as
>> they should?
>
> Answering my own question: the culprit seems to be either the Latin
> Modern fonts, or fontspec.
>
> Taking the previous example:
>
> \documentclass{article}
> \usepackage{fontspec}
> \TeXXeTstate=1
> \begin{document}
> \everypar={\setbox0=\lastbox \beginR \box0 }
> abc def ghi jkl mno pqr stu vwx yz
> \end{document}
>
> one can try several configurations (on the Mac):
>
> - Call fontspec as above, and use xdv2pdf. Output is nonsense, and
> one gets in the console:
>
> ## xdv2pdf: use of uninstalled fonts (specified by filename) such as
> ##   [/usr/local/texlive/2007/texmf-dist/fonts/opentype/public/lm/
> lmroman10-regular.otf]
> ## is not supported; try using the xdvipdfmx driver instead.

Right; fontspec defaults to loading LM fonts by explicit filename,  
which is unsupported in xdv2pdf. So you get garbage (and a warning).

>
> - Call fontspec as above, and use xdvipdfmx. Output is:
>
> yz vwx stu pqr mno jkl ghi def abc

Here, the LM font is being used as a Unicode/OpenType font, so within  
each word, the directionality of the characters is controlled by  
their Unicode properties. So you get left-to-right text within each  
word, even though the overall paragraph direction is right-to-left.

>
> - Call fontspec with option [cm-default]. With both xdv2pdf and
> xdvipdfmx, output is:
>
> zy xwv uts rqp onm lkj ihg fed cba

With TFM-based fonts, the directionality from \beginR applies at the  
level of the individual characters (as they have no inherent  
directionality of their own, and no reliably-known association with  
Unicode values).

So your observation is as expected; the bidi behavior is slightly  
different depending whether you're using TFMs or not. Of course, this  
isn't important for any "normal" use, only for strange things such as  
"right-to-left English" (for which you'd need to use Unicode  
directional overrides if you really want it to work with Unicode/OT  
fonts).

JK



More information about the XeTeX mailing list