On Sun, 29 Mar 2009, Khaled Hosny wrote:

> On Sun, Mar 29, 2009 at 11:05:43PM +1100, ??? ????? wrote:
> > one more question, why if I use \setRTL at the beginning of the document it
> > does not works which is defined as
> >
> > \newif...@rtl
> > \...@rtl\pagedir TRT \bodydir TRT \pardir TRT \textdir TRT \else \pagedir 
> > TLT \
> > bodydir TLT \pardir TLT \textdir TLT \fi
> > \def\setrt...@rtltrue}
> > \def\setlt...@rtlfalse}
>
> I don't know much about TeX macros, but I'd rather use lua here.
> For example, this macro will switch direction based on the current text
> direction. Not exactly what you are doing, but shows some of LuaTeX's
> flexibility.
>
> %%%%%%
> \catcode`|=\active
>
> \def|#1|{%
> \directlua{%
>   if tex.textdir == "TLT" then
>     tex.print("{".."\luaescapestring{\textdir TRT}".."#1".."}")
>   elseif tex.textdir == "TRT" then
>     tex.print("{".."\luaescapestring{\textdir TLT}".."#1".."}")
>   else
>     texio.write_nl("I don't know how to deal with "..tex.textdir.."
> direction")
>     tex.print("#1")
>   end
> }}
>
> \obeylines
> Hello |World| of wonders!
> \textdir TRT
> Hello |World| of wonders!
> \textdir TLB
> Hello |World| of wonders!
> \bye
> %%%%%%

nice example! However i don't know what to do in the TLB case. Currently
the glyphs hang down from the text baseline (as shown in the example),
but maybe in TLB mode also the glyph baselines should be aligned with
the text baseline. Any idea what's right?

Regards, Hartmut

Reply via email to