From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/93241 Path: news.gmane.org!not-for-mail From: Mohammad Hossein Bateni Newsgroups: gmane.comp.tex.context Subject: Re: Paragraph breaking bug with BiDi text Date: Fri, 8 Jan 2016 22:47:56 -0500 Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2766365546775102574==" X-Trace: ger.gmane.org 1452311310 19821 80.91.229.3 (9 Jan 2016 03:48:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Jan 2016 03:48:30 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Jan 09 04:48:20 2016 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aHkVn-0001rs-H1 for gctc-ntg-context-518@m.gmane.org; Sat, 09 Jan 2016 04:48:19 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 203475D94; Sat, 9 Jan 2016 04:48:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8jLw3vIMEf5w; Sat, 9 Jan 2016 04:48:10 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 72A3C5D88; Sat, 9 Jan 2016 04:48:10 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 147BD5D88 for ; Sat, 9 Jan 2016 04:48:09 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CwgHggscwWAc for ; Sat, 9 Jan 2016 04:48:08 +0100 (CET) Original-Received: from mail-ob0-f169.google.com (mail-ob0-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 4F5A75D7F for ; Sat, 9 Jan 2016 04:47:58 +0100 (CET) Original-Received: by mail-ob0-f169.google.com with SMTP id xn1so95651251obc.2 for ; Fri, 08 Jan 2016 19:47:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=mvd2uQYhwTsGzN4anY3pY1aPDoW8ViBlcNNmQDSxmQg=; b=qLYW5IoEscjEyhEIoQxjYnFDdQxSNdDU6/4Z7g7NgT2YBS/xSidSLRMCnHNY3SRBEc CI5Hr43aZgGgI0Vtm3/mhSWxxX1AwUFllwweEa+sv6xDvDZICRCVGZd1BS+Wio7OIegW BcPFhMYa+UslD9G4e6F0jNEtGggWmXnbOtoFAG0GVJf0wMMOEz6FyesBmioU/mm/ITXz gbNHkzSsTFZEI8Lshyx1nqBProNdcldNOOeCij7nNDQocJX93r6FjtcEASdXj8oMHvll qJdCpTzGqeWd2yreuNyS5FYPcECeJIXQdmgFGduKCnd8VHgzp8kcIbtYrLksiEJ9KPvC k5Nw== X-Received: by 10.182.18.105 with SMTP id v9mr83173882obd.59.1452311276622; Fri, 08 Jan 2016 19:47:56 -0800 (PST) Original-Received: by 10.202.57.86 with HTTP; Fri, 8 Jan 2016 19:47:56 -0800 (PST) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:93241 Archived-At: --===============2766365546775102574== Content-Type: multipart/alternative; boundary=001a11c33278bf1cc60528de9109 --001a11c33278bf1cc60528de9109 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Minor point: changing "\pardir TLT" to "\pardir TLT\textdir TLT" in the last paragraph produces better visual, however, the previous paragraphs already demonstrate the problem sufficiently. On Fri, Jan 8, 2016 at 10:40 PM, Mohammad Hossein Bateni wrote: > 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=3Darabic,range=3Darabic] > \setupalign[r2l] > \setupwhitespace[big] > \showframe > > \starttext > > % 10 copies of Persian word "hello" stay on one line. > \dorecurse{10}{=D8=B3=D9=84=D8=A7=D9=85 } > % 20 copies makes a 2-line paragraph. > \dorecurse{20}{=D8=B3=D9=84=D8=A7=D9=85 } > > % one copy of the word goes into the margin although the Latin letters > perfectly fit the line. > \dorecurse{10}{=D8=B3=D9=84=D8=A7=D9=85 } > {\textdir TLT\dorecurse{20}{a}} > \dorecurse{10}{=D8=B3=D9=84=D8=A7=D9=85 } > > % although the Latin string extends into the margin, TeX still puts one > copy of "hello" there as well. > \dorecurse{10}{=D8=B3=D9=84=D8=A7=D9=85 } > {\textdir TLT\dorecurse{30}{a}} > \dorecurse{10}{=D8=B3=D9=84=D8=A7=D9=85 } > > % something similar happens here with the opposite par/text dir > \pardir TLT > \dorecurse{10}{bidi } > {\textdir TRT\dorecurse{20}{=D8=A2}} > \dorecurse{10}{bidi } > > \stoptext > > > The problem seems to be that after typesetting the LTR text within the RT= L > 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 th= at > that it discovers we ran into the margin! > > =E2=80=94MHB > > --001a11c33278bf1cc60528de9109 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Minor point: changing "\pardir TLT" to "\pa= rdir TLT\textdir TLT" in the last paragraph produces better visual, ho= wever, the previous paragraphs already demonstrate the problem sufficiently= .

On Fri, Ja= n 8, 2016 at 10:40 PM, Mohammad Hossein Bateni <bateni@gmail.com> wrote:
Hello,
<= br>
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).=C2=A0 Here is an example with corresponding output:
=

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

\starttext

% 10 copies of Persian word "hello= " stay on one line.
\dorecurse{10}{=D8=B3=D9=84=D8=A7=D9=85 }
% = 20 copies makes a 2-line paragraph.
\dorecurse{20}{=D8=B3=D9=84=D8=A7=D9= =85 }

% one copy of the word goes into the margin although the Latin= letters perfectly fit the line.
\dorecurse{10}{=D8=B3=D9=84=D8=A7=D9=85= }
{\textdir TLT\dorecurse{20}{a}}
\dorecurse{10}{=D8=B3=D9=84=D8=A7= =D9=85 }

% although the Latin string extends into the margin, TeX st= ill puts one copy of "hello" there as well.
\dorecurse{10}{=D8= =B3=D9=84=D8=A7=D9=85 }
{\textdir TLT\dorecurse{30}{a}}
\dorecurse{10= }{=D8=B3=D9=84=D8=A7=D9=85 }

% something similar happens here with t= he opposite par/text dir
\pardir TLT
\dorecurse{10}{bidi }
{\textd= ir TRT\dorecurse{20}{=D8=A2}}
\dorecurse{10}{bidi }

\stoptext

The problem seems to be that after typesetti= ng 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!

=E2= =80=94MHB


--001a11c33278bf1cc60528de9109-- --===============2766365546775102574== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============2766365546775102574==--