# [dev-context] BiDi in ConTeXt

Hans Hagen pragma at wxs.nl
Thu Nov 11 18:06:19 CET 2004

```Adam Lindsay wrote:
> Hans Hagen said this at Thu, 11 Nov 2004 17:07:31 +0100:
>
>
>>
>>
>>>Anyway, I cooked up a quick simulation of the Omega \pardir command as
>>>used in m-gamma. It only supports \pardir TRT and \pardir TLT, but is it
>>>a way people want to progress?
>>
>>as long as we consider it a low level command ...
>>
>>
>>>Also, is dev-context the right place for a discussion like this?
>>
>>sure
>>
>>i can imagine that we cook up a bit higher level interface once we know what
>>we're dealing with
>>
>>Anyhow, I can add this to syst-etx:
>
>
> Thus ends the tutorial at the feet of the master.
>
> Yeah, that works fine with XeTeX as well, but know that XeTeX's behaviour
> isn't exactly the same as eTeX... [see attached]
>
> 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

(what happen swith arabic in rl mode? does it get reversed due to the font?)

another interesting feature can be a kind of hook into this language mechanism,
like

\XeTeXbeginlanguage{en}{tokens}
\XeTeXendlanguage{en}{tokens}

and that these are expanded automatically when a language switches.

btw, i didn't test that yet, but xetex could be a nice fo engine [i'm currently
working on foxet]

Hans

-----------------------------------------------------------------