ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: wrong behaviour with ConTeXt unicode bidi
Date: Wed, 11 Sep 2013 14:37:35 +0200	[thread overview]
Message-ID: <5230640F.9060203@wxs.nl> (raw)
In-Reply-To: <CAJZ8fyqEQ8Hp9MpFWSjYM6RprW8UHtsBiaNLNya=o7cf1OXabg@mail.gmail.com>

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2013-09-11 12:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-10 12:57 Vafa Khalighi
2013-09-10 15:26 ` Hans Hagen
2013-09-10 15:45   ` Vafa Khalighi
2013-09-10 16:20     ` Vafa Khalighi
2013-09-11  9:47       ` Vafa Khalighi
2013-09-11 11:34         ` Vafa Khalighi
2013-09-11 12:37           ` Hans Hagen [this message]
2013-09-11 15:24             ` Khaled Hosny
2013-09-11 17:10               ` Hans Hagen
2013-09-12 14:19                 ` Vafa Khalighi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5230640F.9060203@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).