[NTG-context] Paragraph breaking bug with BiDi text

Mohammad Hossein Bateni bateni at gmail.com
Sat Jan 9 04:40:10 CET 2016


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:

\setmainfont[ALM Fixed][features=arabic,range=arabic]


% 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 }


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!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20160108/9ea0fa82/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bidi-par-bug.pdf
Type: application/pdf
Size: 6055 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20160108/9ea0fa82/attachment-0001.pdf>

More information about the ntg-context mailing list