[Top][All Lists]

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

Re: Line wrap reconsidered

From: Eli Zaretskii
Subject: Re: Line wrap reconsidered
Date: Fri, 19 Jun 2020 15:38:15 +0300

> From: Yuan Fu <casouri@gmail.com>
> Date: Fri, 19 Jun 2020 08:04:47 -0400
> Cc: Lars Ingebrigtsen <larsi@gnus.org>,
>  emacs-devel@gnu.org
> > 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.

What do you mean by "in the RTL context"?

Remember: bidi reordering can take place in two different situations:
then the paragraph direction is left-to-right, and when it's
right-to-left.  In the former situation, the lines begin on the left,
in the latter they begin on the right.  But LTR text, such as CJK
characters, will always be rendered left-to-right, no matter what is
the paragraph direction.

So which "RTL context" did you mean 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
> 我今天看来了本书,感觉挺有意思,名字是
> 《钢铁是怎样炼成的》。

What do you see in the text below?

אבגד הוזחטיכך למנן 我今天看来了本书,感觉挺有意思,名字是

(I assume you are reading your email in Emacs; if not, copy/paste this
text into an Emacs buffer whose bidi-paragraph-direction is nil, and
look at the resulting display.)

Does the above look correct, from the Kinsoku POV?  This is how LTR
CJK text will be displayed in a paragraph with right-to-left base
direction.  Do you still think something needs to be flipped here?

> 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.

We must use BOL and EOL in their logical-order meanings, otherwise the
result will be utter confusion.  In the above example, the EOL
character in the first line is 是, and it is not at the left edge of
the line.  It is at the logical-order end of the line, i.e. the
character after it in the buffer position order is the newline.  But
if we had RTL characters instead of the CJK text above, the character
at EOL would indeed have been displayed at the left edge of the line.

> [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]