From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-bidi@gnu.org, emacs-devel@gnu.org
Subject: Re: Mixed L2R and R2L paragraphs and horizontal scroll
Date: Fri, 05 Feb 2010 11:50:58 +0200 [thread overview]
Message-ID: <83tytwf1tp.fsf@gnu.org> (raw)
In-Reply-To: <jwvsk9gr6zg.fsf-monnier+emacs@gnu.org>
> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Cc: ehud@unix.mvs.co.il, emacs-bidi@gnu.org, emacs-devel@gnu.org
> Date: Thu, 04 Feb 2010 17:13:29 -0500
>
> >> This how it is done in Hebrew newspapers and in HTML, and this is how
> >> Hebrew readers are used to it (of course newspapers and HTML don't
> >> breaks words, but that is the only difference).
> > Please! Newspapers don't have truncated and continued lines, they
> > have newlines between every two lines. With newlines, the bidi
> > display will show exactly what you (and every other Hebrew reader)
> > expect.
>
> I'm not sure whether newpapers really have such newlines (at least for
> paper newspapers, it's a philosophical question). But I think Ehud's
> argument makes sense if you consider that currently (i.e. in L2R only
> text), adding a newline where Emacs wraps a line, leads to "the same
> display" (modulo line-wrapping glyphs in the fringe and things like
> that, obviously). And I understand Ehud's argument as saying that the
> same should hold for R2L and mixed text.
>
> It seems at least a reasonable point of view. Is your point of view
> based on the fact that it seems difficult/impossible to implement, or is
> it based on the fact that you think Ehud's expectation is weird?
I'm sorry I didn't make myself clear enough on that, to the degree
that such a question should at all be asked.
Like Ehud, I think that it would be swell to have what he wants. But,
possibly unlike Ehud, I think that what I have now it not a disaster,
and we can live with it for the time being, maybe even longer.
The reasons for my decision to implement truncation and continuation
as I did are:
. It is the only reasonable way to go that does not call for a very
serious surgery, perhaps even a total rewrite, of the display
engine code.
. I saw no other editor that supports truncation and behaves
otherwise. (I don't know about any editors that support
continuation lines like Emacs does.) See below.
. The issue pops up only in relatively rare situations: mixed
L2R/R2L text that gets truncated/continued within a stretch of
text whose directionality is against the paragraph direction.
> If it's just "difficult", then (just like rigid scrolling), it can be
> kept as a known shortcoming.
It is either VERY difficult or very slow.
The current display code lays out glyphs in each ``glyph row'' one by
one, in the visual order. Thus, for the portion of text that is
reversed from its logical order, the bidi reordering code effectively
delivers the characters backwards to this glyph layout code, in the
decreasing order of buffer positions. That is, the glyphs assembled
first are the last ones to be read. Then you hit the window margin,
and know that there isn't enough place for the whole line. Only then
you know how many characters will fit on this line. But you know that
in terms of the last portion of the text in the reading order, which
tells you very little about how many characters at the beginning of
this stretch of text you could display instead. (Remember that Emacs
supports variable size characters and different fonts on the same
line, so just counting characters will not do.)
What would be nice is to scan the text to be reversed in the logical
order, and find the part of it that will fit on this screen line.
Then we could reorder only that part. But to do that, we need to try
every possibility by actually doing most of the display work behind
the scenes, because of the complications with different font sizes,
faces, composite characters and issues like ligatures and the like,
which change the amount of screen estate taken by a portion of a line,
even if you just juxtapose the same two characters.
With a newline marking the end of the line, it's easy: the bidi
reordering ends at the newline, then restarts after it. By contrast,
to support ``bidi-smart continuation'', we need to find the place
where to break the line, and that is impossible without actually
trying to display it.
In the example below
word1 word2 WORD1 WORD2
to be displayed as
word1 word2 2DROW 1DROW
if the window is only wide enough to display
word1 word2 1DROW
we need to try displaying in order
word1 word2 1
word1 word2 1D
word1 word2 1DR
word1 word2 1DRO
word1 word2 1DROW
word1 word2 1DROW
word1 word2 W 1DROW
until we discover where we should stop. (We could do a binary search,
of course, but that's details.) I don't think that's reasonable, and
I have no idea what will this do to the redisplay speed.
> How do other line-wrapping text editors with bidi support behave with
> such long mixed-L2R-R2L lines?
MS Word truncates in the visual order, like I suggest. It doesn't
have continuation lines (it re-flows instead, which is the same as our
fill-paragraph, and that works like Ehud wants already.) I didn't
have a chance of checking OpenOffice; I can do that next week, if no
one beats me to it.
I have Yudit installed, but I cannot get it to display Hebrew text (it
shows hex numbers instead); if someone knows how to do that on
Windows, please tell. But someone told in this thread that it, too,
re-flows. If that's true, we have no prior art that's different from
what I have now in the bidi Emacs.
Of course, Emacs breaks ground where many other similar tools punt...
next prev parent reply other threads:[~2010-02-05 9:50 UTC|newest]
Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-30 13:44 Mixed L2R and R2L paragraphs and horizontal scroll Eli Zaretskii
2010-01-30 15:14 ` David De La Harpe Golden
2010-01-30 15:33 ` Eli Zaretskii
2010-01-30 16:36 ` martin rudalics
2010-01-30 17:01 ` Eli Zaretskii
2010-01-30 17:22 ` martin rudalics
2010-01-30 17:52 ` Eli Zaretskii
2010-01-30 18:31 ` martin rudalics
2010-01-30 19:12 ` Eli Zaretskii
2010-01-30 19:45 ` martin rudalics
2010-01-30 21:40 ` Eli Zaretskii
2010-01-31 9:36 ` martin rudalics
2010-01-31 18:02 ` Eli Zaretskii
2010-01-31 20:01 ` martin rudalics
2010-01-31 21:53 ` Miles Bader
2010-02-01 4:12 ` Eli Zaretskii
2010-02-01 8:34 ` martin rudalics
2010-02-01 4:11 ` Eli Zaretskii
2010-02-01 8:34 ` martin rudalics
2010-02-01 20:21 ` Eli Zaretskii
2010-02-02 8:08 ` martin rudalics
2010-02-02 19:30 ` Eli Zaretskii
2010-02-03 16:06 ` martin rudalics
2010-02-01 21:05 ` Richard Stallman
2010-02-02 8:08 ` martin rudalics
2010-02-02 13:23 ` tomas
2010-02-02 14:39 ` martin rudalics
2010-02-02 19:32 ` Eli Zaretskii
2010-02-06 6:29 ` tomas
2010-02-02 21:21 ` Richard Stallman
2010-02-06 6:35 ` tomas
2010-02-06 14:46 ` David De La Harpe Golden
2010-02-06 22:55 ` Richard Stallman
2010-02-02 21:21 ` Richard Stallman
2010-01-30 23:26 ` David De La Harpe Golden
2010-01-31 12:42 ` Richard Stallman
2010-01-31 15:02 ` David De La Harpe Golden
2010-01-31 18:20 ` Eli Zaretskii
2010-01-31 18:16 ` Eli Zaretskii
2010-02-01 21:05 ` Richard Stallman
2010-02-01 21:51 ` Eli Zaretskii
2010-02-02 21:21 ` Richard Stallman
2010-02-01 14:00 ` Ehud Karni
2010-02-01 20:18 ` Eli Zaretskii
2010-02-01 22:05 ` [emacs-bidi] " Ehud Karni
2010-02-02 20:04 ` Eli Zaretskii
2010-02-03 13:10 ` Ehud Karni
2010-02-03 18:59 ` Eli Zaretskii
2010-02-04 11:01 ` Richard Stallman
2010-02-04 15:14 ` [emacs-bidi] " Stefan Monnier
2010-02-04 15:57 ` David Kastrup
2010-02-04 17:21 ` Davis Herring
2010-02-04 19:33 ` Eli Zaretskii
2010-02-04 20:46 ` [emacs-bidi] " tomas
2010-02-04 22:23 ` Eli Zaretskii
2010-02-06 6:41 ` [emacs-bidi] " tomas
2010-02-04 22:05 ` Stefan Monnier
2010-02-04 19:12 ` Eli Zaretskii
2010-02-05 12:44 ` Richard Stallman
2010-02-05 13:30 ` Eli Zaretskii
2010-02-05 18:06 ` [emacs-bidi] " Stefan Monnier
2010-02-05 21:48 ` Eli Zaretskii
2010-02-06 22:55 ` Richard Stallman
2010-02-07 4:08 ` Eli Zaretskii
2010-02-07 8:35 ` David Kastrup
2010-02-07 15:05 ` Richard Stallman
2010-02-04 14:02 ` [emacs-bidi] " Ehud Karni
2010-02-04 19:30 ` Eli Zaretskii
2010-02-04 19:48 ` [emacs-bidi] " Eli Zaretskii
2010-02-06 6:52 ` tomas
2010-02-03 21:02 ` Davis Herring
2010-02-04 4:16 ` Bidirectional embeddings (was: Mixed L2R and R2L paragraphs and horizontal scroll) Eli Zaretskii
2010-02-04 16:21 ` [emacs-bidi] Mixed L2R and R2L paragraphs and horizontal scroll Ehud Karni
2010-02-04 19:40 ` Eli Zaretskii
2010-02-04 22:13 ` [emacs-bidi] " Stefan Monnier
2010-02-05 9:50 ` Eli Zaretskii [this message]
2010-02-05 10:47 ` Eli Zaretskii
2010-02-05 18:06 ` [emacs-bidi] " Stefan Monnier
2010-02-06 13:39 ` David De La Harpe Golden
2010-02-06 15:45 ` Ehud Karni
2010-02-06 19:38 ` Eli Zaretskii
2010-02-06 21:18 ` [emacs-bidi] " David De La Harpe Golden
2010-02-11 21:40 ` Beni Cherniavsky
2010-02-12 11:03 ` Eli Zaretskii
2010-02-12 12:36 ` Eli Zaretskii
2010-02-05 12:21 ` [emacs-bidi] " Ehud Karni
2010-02-05 13:47 ` Eli Zaretskii
2010-02-05 14:22 ` Miles Bader
2010-02-05 14:52 ` Eli Zaretskii
2010-02-06 1:07 ` Miles Bader
2010-02-06 9:03 ` Eli Zaretskii
2010-02-06 9:32 ` Miles Bader
2010-02-06 15:42 ` [emacs-bidi] " Ehud Karni
2010-02-06 19:14 ` Eli Zaretskii
2010-02-03 13:22 ` [emacs-bidi] " Ehud Karni
2010-02-03 19:01 ` Eli Zaretskii
2010-02-04 14:08 ` [emacs-bidi] " Ehud Karni
2010-02-01 15:36 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83tytwf1tp.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-bidi@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).