emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Line wrap reconsidered


From: Yuan Fu
Subject: Re: Line wrap reconsidered
Date: Fri, 19 Jun 2020 08:04:47 -0400


> On Jun 19, 2020, at 2:17 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Thu, 18 Jun 2020 17:46:53 -0400
>> Cc: Lars Ingebrigtsen <larsi@gnus.org>,
>> emacs-devel <emacs-devel@gnu.org>
>> 
>> I have to do another change for kinsoku.el to work right in bidi. Kinsoku.el 
>> defined NOT_AT_BOL and NOT_AT_EOL categories. These categories are flipped 
>> in bidi paragraphs: what was EOL becomes BOL and vice versa. So I flipped 
>> them in my predicate function depending on it->bidi_p.
> 
> I don't think I understand what you mean here.  BOL and EOL are
> logical-order terminology, and bidi reordering doesn't change their
> meaning.
> 
> Maybe I don't understand the exact meaning of NOT_AT_EOL/NOT_AT_BOL
> that Kinsoku assigns to that.  Can you provide a formal definition of
> that, or point me to some document where that is explained?  

Since kinsoku.el is for asian characters which are all LTR[1], the exact 
meaning of NOT_AT_EOL/NOT_AT_BOL in bidi context probably doesn’t really 
matter, but to make kinsoku retain the same behavior (thus looks right) in both 
RTL and LTR lines, I choose to define BOL as left edge and EOL as right edge. 
So NOT_AT_EOL means can’t be the right-most character in a line.

From your message I thought in RTL lines the iterator draws from right to left 
(you said each glyph is prepended to the previous one). So in RTL context when 
we are at the end of a logical line, we are at the left edge; on the other 
hand, in normal LTR context when we are at the end of a logical line, we are at 
the right edge. Hence the flip.

> The
> important aspect of this is that in bidi-reordered text the character
> that appears at the left edge of a line is not necessarily the first
> character of the line after the preceding newline.  So the issue is
> what does Kinsoku say about such situations?  IOW, definitions that
> assume strict LTR text will not help us here.

As I mentioned above, I don’t think kinsoku cares/is defined for this 
situation. And I took the definition to assume strict LTR, mapping BOL to left 
and EOL to right. The ultimate effect is that, no matter what the bidi context 
is, NOT_AT_EOL character, like 《, never appears at the right edge. So we don’t 
get


我今天看来了本书,感觉挺有意思,名字是《
钢铁是怎样炼成的》。

Instead, we have

我今天看来了本书,感觉挺有意思,名字是
《钢铁是怎样炼成的》。


Now, is that mapping TRT for other characters? I don’t know. But I think it 
make sense for kinsoku (again, asian text, all LRT). IMHO, maybe for a generic 
definition we can define BOL as left edge for LTR character and right edge for 
RTL character. I think that will look good for most text.

Yuan

[1] There is also a top-down layout, but I don’t think we need to worry about 
that.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]