As some will have seen on xetex list, there has been some gentle pressure (from me and others:-) on xetex maintainers to adopt a model for writing direction closer to the omega/luatex model than the tex--xet model from etex that xetex currently uses.
But I thought I'd better check what I was asking for. The direction primitives are more or less undocumented in the luatex manual, mostly in reference to the changes from the original omega versions. However there are four direction values as in the subject line and (apparently) seven \*dir primitives \pagedir \bodydir \pardir \textdir \mathdir \boxdir \linedir which means that there are 4^7=16384 possible states for the direction primitives. Clearly not all those states are sensible but it's less clear how many of them are actually different (that is in what contexts the different primitives may be used to specify a direction and whether they have any effect at that point. I stated to make a pass at documenting them, starting with some text form the omega manual, adapted with some text from the luatex manual, bits gleaned from reading the luatex sources, and some experimentation, but it's incomplete and quite likely wrong in parts:-) If there is an existing more complete documentation I'd be happy to discard this, or failing that, if anyone has any further text or corrections I'll add and repost later, currently it's just plain text but if it was at all accurate and complete perhaps something could be added to the manual. David The luatex system distinguishes four different directions, TLT, TRT, RTT, LTL. each is designated by three parameters: 1. The beginning of the page is one of T(top), L(left), R(right). For English and Arabic, the beginning of the page is T; for Japanese it is R; for Mongolian it is L. 2. The beginning of the line is one of T(top), L(left), R(right). Defines where each line begins. For English, it is L; for Arabic, it is R; for Japanese and Mongolian, it is T. 3. The top of the line is one of T(top), L(left). Corresponds to the notion of ‘up’ within a line. These result in the following typical settings: TLT for English, TRT for Arabic, RTT for Japanese, LTL for Mongolian. The following primitives are used with these writing direction specifications. page (\pagedir) text (\textdir) mathematics (\mathdir) body (\bodydir) paragraph (\pardir) box (\boxdir) line (\linedir) Each of these primitives takes as primitive one of the above four writing directions. \pagedir〈direction〉 \bodydir ** Can this be different to \pagedir? If it is different get warning warning (backend): pagedir differs from bodydir, the output may be placed wrongly on the page ** \pardir This defines the direction of the paragraph building. I in the default \pagedir TLT \bodydir TLT \textdit TLT then TLT: paragraph indentation left of first line, at top. \rightskip fills from the right and \parfillskip fills the bottom line, from the right TRT: paragraph indentation left of first line, at top. \rightskip fills from the left and \parfillskip fills the bottom line from the left, LTL paragraph indentation left of first line, at top. \rightskip is a vertical skip after each line RTT paragraph indentation vertical above first line, at top. \rightskip is a vertical skip after each line \linedir *** not documented at all ??*** \boxdir *** mentioned in manual but undocumented? *** \textdir This primitive can appear anywhere in a text Grouping is respected, so it is possible to have inserts within a paragraph: these are implemented using the local paragraph mechanism described in the previous section. \mathdir Normally mathematics is done in the same direction as English, namely TLT There have been situations where it has been written TRT. TLT: left to right TRT: Right to left LTL: down with superscripts to the left RTT: down with superscripts to the right
