[luatex] \enddir

Khaled Hosny khaledhosny at eglug.org
Thu Dec 13 11:59:12 CET 2012


On Thu, Dec 13, 2012 at 11:11:50AM +0100, Taco Hoekwater wrote:
> On 12/13/2012 09:38 AM, Joseph Wright wrote:
> >Hello all,
> >
> >If you insert something like
> >
> >   \hbox{\textdir TRT ABC}
> >
> >and look at the shipout, you get
> >
> >   ..\hbox(6.83331+0.0)x21.8056, direction TLT
> >   ...\begindir TRT
> >   ...\tenrm A
> >   ...\tenrm B
> >   ...\tenrm C
> >   ..\glue 0.0 plus 1.0fill
> >
> >On the other hand, adding a group
> >
> >   \hbox{{\textdir TRT ABC}}
> >
> >leads to
> >
> >   ..\hbox(6.83331+0.0)x21.8056, direction TLT
> >   ...\begindir TRT
> >   ...\tenrm A
> >   ...\tenrm B
> >   ...\tenrm C
> >   ...\enddir TRT
> >   ..\glue 0.0 plus 1.0fill
> >
> >which includes an \enddir. Both of these seem to work the same way in
> >practice (the direction does not 'leak' from the first case), but I
> >wonder if the \enddir has any importance.
> 
> Normally, the code that exports the box to PDF/DVI takes care of
> closing up the open direction nodes based on the box's 'box direction'.
> But if there is a group involved, then the box does not give enough
> hints, hence the explicit \enddir in that case.
> 
> The missing \enddir is a number-of-nodes optimization from Omega that
> Hans is not too happy about as it is both confusing and makes it a
> little hard to process the node list directions in lua, so it will
> likely go away at some point, and explicit \enddirs will be present
> always at some point in the future.
> 
> >For testing, I tried
> >
> >   \hbox{\textdir TRT ABC\textdir TLT D}
> >
> >which gives the slightly odd
> >
> >   ..\hbox(6.83331+0.0)x29.4445, direction TLT
> >   ...\begindir TRT
> >   ...\tenrm A
> >   ...\tenrm B
> >   ...\tenrm C
> >   ...\begindir TRT
> >   ...\begindir TLT
> >   ...\tenrm D
> >   ..\glue 0.0 plus 1.0fill
> >
> >(Can't imagine this is deliberate.)
> 
> Code copied from Omega, and there were no comments in that code
> anywhere, so I just kept it as is originally. But it does look
> weird, so I made a local change to produce \enddir TRT instead
> of the second \begindir TRT. For this source:
> 
>   (\hbox{\textdir TRT ABC\textdir TLT DEF})
> 
> The change actually changed the output PDF from (old):
> 
>   (DEFCBA)
> 
> to (new)
> 
>   (CBADEF)
> 
> which to my layman's eyes appears to make more sense (the second
> \textdir now actually replaces the first, instead of starting an
> implied direction group).

So what happens with
(\hbox{\textdir TRT{\textdir TRT ABC\textdir TLT DEF}})

or:

(\textdir TRT\hbox{\textdir TRT ABC\textdir TLT DEF})

It should be (DEFCBA), I think.

Regards,
Khaled


More information about the luatex mailing list