ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Mohammad Hossein Bateni <bateni@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Paragraph breaking bug with BiDi text
Date: Fri, 8 Jan 2016 22:40:10 -0500	[thread overview]
Message-ID: <CAMHZ1dZ0=BFnz3x-SC1iBK=5ytoxfXRFOuKPXQqHqoi5Bu-gSA@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1344 bytes --]

Hello,

When a line ends with a sequence whose direction differs from that of the
paragraph, we risk pushing some text into the margin (when not necessary).
Here is an example with corresponding output:


\usemodule[simplefonts]
\setmainfont[ALM Fixed][features=arabic,range=arabic]
\setupalign[r2l]
\setupwhitespace[big]
\showframe

\starttext

% 10 copies of Persian word "hello" stay on one line.
\dorecurse{10}{سلام }
% 20 copies makes a 2-line paragraph.
\dorecurse{20}{سلام }

% one copy of the word goes into the margin although the Latin letters
perfectly fit the line.
\dorecurse{10}{سلام }
{\textdir TLT\dorecurse{20}{a}}
\dorecurse{10}{سلام }

% although the Latin string extends into the margin, TeX still puts one
copy of "hello" there as well.
\dorecurse{10}{سلام }
{\textdir TLT\dorecurse{30}{a}}
\dorecurse{10}{سلام }

% something similar happens here with the opposite par/text dir
\pardir TLT
\dorecurse{10}{bidi }
{\textdir TRT\dorecurse{20}{آ}}
\dorecurse{10}{bidi }

\stoptext


The problem seems to be that after typesetting the LTR text within the RTL
paragraph, TeX thinks the current text ends at the left end of the LTR
portion; hence, it tries to add something to the line; it's only after that
that it discovers we ran into the margin!

—MHB

[-- Attachment #1.2: Type: text/html, Size: 1556 bytes --]

[-- Attachment #2: bidi-par-bug.pdf --]
[-- Type: application/pdf, Size: 6055 bytes --]

[-- Attachment #3: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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:[~2016-01-09  3:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-09  3:40 Mohammad Hossein Bateni [this message]
2016-01-09  3:47 ` Mohammad Hossein Bateni
2016-01-11 13:43   ` Hans Hagen
2016-01-11 16:58     ` Mohammad Hossein Bateni
2016-01-11 19:24       ` Wolfgang Schuster
2016-01-11 21:52       ` Hans Hagen

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='CAMHZ1dZ0=BFnz3x-SC1iBK=5ytoxfXRFOuKPXQqHqoi5Bu-gSA@mail.gmail.com' \
    --to=bateni@gmail.com \
    --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).