# [XeTeX] \beginL and colour

Sat Nov 13 12:55:41 CET 2004

Adam Lindsay said this at Sat, 13 Nov 2004 11:16:44 +0000:

>>> Is this a bug, or a complete lack of understanding on my part of the
>>> model?
>>
>>Looks like a bug to me. I wonder why it does that........
>
>Following a hunch this morning, I switched the black and red lines, and
>it came out as originally intended. Could it be the something in Apple's
>styled text system continues to scan from left to right for applying colours?

Yeah, it's looking like that's the case. If I put the colour switch
inside a \beginL, then it scans in the right order:

\TeXXeTstate=1
\def\babble{Wa dfonbds kmkn doni don cspdsc mpw mcpi kljndf l dlkn dmnde
knds, fdwih kdfj dowk. Ifskn nods ods  cskc vif kldn conc lc -- mioefj dinj
dfnwo dnnks kw mxzlkw mdow. }
\babble \par
\beginR
\babble
\beginL
\special{x:textcolor=FF0000}
hello there world
\special{x:textcolor=000000}
\endL
\babble
\endR \par
\babble
\end

...My guess is that ATSUI is following the script-determined direction,
regardless of the paragraph direction that XeTeX asserts.
And that to me sounds like a good reason for what HH was arguing for:

>> [I noted that words were in reverse order, but not the letters, when
>>  Roman AAT scripts were used with \beginR.]
>> This is because XeTeX also respects the inherent direction of the script
>> (from Unicode/the font itself), so insertion of a word of arabic, for
>> example, is correctly set right-to-left, even in a paragraph of LtoR roman.
>
>ha, funny side effect, somehow i think that this kind of automatisms are
>dangerous (same for language)
>
>so, maybe we're talking about \worddir as well
>
>i think that it makes sense to have an xtex switch for disabling this
>automatism: three states: font, font+tex, tex

I thought XeTeX was being really clever, so wasn't convinced by Hans at
the time. The above feature interaction has me convinced now, though!

cheers,