[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 20:47:27 +0300 |
> From: Yuan Fu <casouri@gmail.com>
> Date: Fri, 19 Jun 2020 13:22:18 -0400
> Cc: Lars Ingebrigtsen <larsi@gnus.org>,
> emacs-devel@gnu.org
>
> > 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?
>
> Oooh so there are four cases: LRT text in LTR paragraph, LRT text in RTL
> paragraph, RTL text in RTL paragraph, and RTL text in LTR paragraph. And the
> order in which the iterator draws glyphs depends on the paragraph order
> (although it doesn’t know it). Am I right?
You can say that there are 4 cases, yes. But from the iterator POV,
there are only 2: either the text of the same direction as the
paragraph, or of the opposite direction.
> > אבגד הוזחטיכך למנן 我今天看来了本书,感觉挺有意思,名字是
> > 《钢铁是怎样炼成的》。
> >
> > (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?
>
> Kinsoku looks right, yes. However the period (“。”) seems to be interpreted as
> RTL text, not sure why.
That's expected, since the period has a "weak directionality", so at
the end of the paragraph it takes the paragraph direction.
> > 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.
> >
>
> I see. However, I suggest to define EOL and BOL (in kinsoku) in terms of
> visual edges, instead of the logical order. Because we are using this
> information (NOT_AT_BOL, etc) for visual layout. When we are at a window edge
> and ask if this character can appear at this edge, we are interested in the
> visual aspect rather than the logical order, if you get what I mean.
If that works, then fine.
> BTW, what does it->bidi_p mean exactly? Does it mean bidi-display-reordering
> is t, or current paragraph is ‘right-to-left, or the char at point is RTL, or
> something else?
It means bidi reordering is in effect. For displaying buffer text, it
is determined by bidi-display-reordering.
> Can I know whether I’m at the left edge or the right edge?
You can, but why do you need to?