On 1/9/2016 4:47 AM, Mohammad Hossein Bateni wrote:
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.
It is a side effect of what the the par builder considers to be valid breakpoints. The current approach is playing very safe but after looking at it Taco and I decided that it can be a more tolerant with respect to end dirs so the next luatex version will have that. Anyway: You need to code carefully: the space after "TRT" in "\textdir TRT x" is meaningful so in your example you introduce spaces. Also, in context don't use \textdir etc directly, just use \lefttoright and \righttoleft in combination with \setupalign as I will not spend much time on side effects of interfering with these low level dir changers directly.
On Fri, Jan 8, 2016 at 10:40 PM, Mohammad Hossein Bateni
mailto:bateni@gmail.com> 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=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
___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------