[luatex] bug in RTL typesetting?

Khaled Hosny khaledhosny at eglug.org
Sun Mar 29 15:21:44 CEST 2009


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\if at RTL
> \if at RTL\pagedir TRT \bodydir TRT \pardir TRT \textdir TRT \else \pagedir TLT \
> bodydir TLT \pardir TLT \textdir TLT \fi
> \def\setRTL{\@RTLtrue}
> \def\setLTR{\@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
%%%%%%

Regards,
 Khaled


-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://tug.org/pipermail/luatex/attachments/20090329/d99e1779/attachment-0001.bin 


More information about the luatex mailing list