# [XeTeX] color directives in RL context

François Charette firmicus at ankabut.net
Wed Apr 18 09:42:28 CEST 2007

```Thanks for your detailed and clear explanations, Jonathan. I had read
the documentation of e-TeX quite a while ago, and I knew that the hlist
of boxes was reversed in RL context, yet I nevertheless had the
impression that some information about direction was written in the dvi
output, and that it should be the job of the drivers to deal with it
properly... I must have confused it with Omega then.

> The alternative (and in my view preferable) approach is to treat
> color as an inherent attribute of the font, so that it stays with the
> glyphs regardless of how they get rearranged by the bidi processing
> (or any other processing). This also solves issues with insertions,
> page-breaks, etc., which can be tricky for the driver to get right
> for \special-based color in complex cases.
>
> XeTeX allows color to be specified on the font, and this should work
> properly with bidi. However, I think there are currently some
> differences between xdv2pdf and xdvipdfmx regarding exactly how this
> is implemented, and how it interacts with \special color if that is
> also used in the same document. I need to re-examine this...
Fine! Weirdly enough, I thought the possibility to set color at the
level of font features was only possible on MacOSX. But I had never
tried :-) Glad to see that this works. I have now changed the
documentation of my bidi package (available on CTAN since yesterday, so
this will be in the next release) on the basis of your reply. Thanks!

The motivation behind my query was an attempt to redefine the \textcolor
command so that it would still work in RL context. With the Hebrew
module of Babel this is achieved only partially, as it doesn't work when
the textual argument occurs on more than one line. Now I realize that
there is no easy way (if at all) to achieve more than that. In the next
version of my bidi package, whenever \textcolor occurs in RL context, a
warning is issued that encourages users to rely on XeTeX font features