[NTG-context] wrong behaviour with ConTeXt unicode bidi

Hans Hagen pragma at wxs.nl
Wed Sep 11 14:37:35 CEST 2013


On 9/11/2013 1:34 PM, Vafa Khalighi wrote:
> Also the itemize environment is broken too (perhaps same issue is here too):
>
> \setupitemize[left=(, right=), margin=4em, stopper=]
> \starttext
> \setupalign[r2l]
> \definefont[arabicfont][Arial*arabic at 20pt]
> \setupdirections[bidi=global,method=default]
> \arabicfont
> \startitemize[a]
> \item اولی
> \item دومی
> \stopitemize
> \stoptext
>
> and if I swap right and left parentheses, I get the following error:

thanks for testing

the problem is that sometimes it's hard to deduce the state so i've added

\righttolefthbox \rtlhbox
\lefttorighthbox \ltrhbox
\righttoleftvbox \rtlvbox
\lefttorightvbox \ltrvbox
\righttoleftvtop \rtlvtop
\lefttorightvtop \ltrvtop

\autodirhbox
\autodirvbox
\autodirvtop

some cases are (using the default parser, which is a one-pass forward 
scanner) tricky to determine

                   \hbox{\righttoleft(0001)}\par
    \dontleavehmode\hbox{\righttoleft(0002)}\par
                        {\righttoleft(0003)\par}
                        {\righttoleft(0004)}\par
         \dontleavehmode{\righttoleft(0005)\par}
         \dontleavehmode{\righttoleft(0006)}\par
                \rtlhbox{(0007)}\par
                \ltrhbox{(0008)}\par
\dontleavehmode\rtlhbox{(0009)}\par
\dontleavehmode\ltrhbox{(0010)}\par

                   \hbox{(0011)}\par
    \dontleavehmode\hbox{(0012)}\par

the other parsers do several passes and are slower can can handle some 
cases better

anyway, it would be nice to see where the three methods fail:

\setuplayout[middle]

\starttext

\setupalign[r2l]

\definefont[arabicfont][Arial*arabic at 20pt]

\enabletrackers[typesetters.directions.default]
\enabletrackers[typesetters.directions.one]
\enabletrackers[typesetters.directions.two]

\setupdirections[bidi=global,method=default]
% \setupdirections[bidi=global,method=one]
% \setupdirections[bidi=global,method=two]

\arabicfont \setupinterlinespace

                   \hbox{\righttoleft(0001)}\par
    \dontleavehmode\hbox{\righttoleft(0002)}\par
                        {\righttoleft(0003)\par}
                        {\righttoleft(0004)}\par
         \dontleavehmode{\righttoleft(0005)\par}
         \dontleavehmode{\righttoleft(0006)}\par
                \rtlhbox{(0007)}\par
                \ltrhbox{(0008)}\par
\dontleavehmode\rtlhbox{(0009)}\par
\dontleavehmode\ltrhbox{(0010)}\par

                   \hbox{(0011)}\par
    \dontleavehmode\hbox{(0012)}\par

\setupitemize[left=(,right=),distance=1em]

\startitemize[a]
\item اولی
\item دومی
\stopitemize

(1984)

این (آزمایش 1363] و یک (آزمایش 1984] خوب است  و باقی ماجرا. \blank

این (آزمایش (oeps 1363)) و یک (آزمایش 1984) خوب است  و باقی ماجرا. \blank

این (آزمایش (oeps 1363)) و یک \blank

این (آزمایش [oeps 1363]) و یک \blank
این (آزمایش [oeps 1363)] و یک \blank

\stoptext


Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list