Re: [emacs-bidi] Re: improving bidi documents display

"Martin J. Dürst" <[email protected]> Fri, 04 Mar 2011 19:34:39 +0900
Newsgroups gmane.emacs.devel,gmane.emacs.bidi
Organization Aoyama Gakuin University
Message-ID <[email protected]>
Hello Eli,

On 2011/03/02 13:02, Eli Zaretskii wrote:
>> Date: Wed, 02 Mar 2011 10:50:19 +0900
>> From: "Martin J. D=FCrst"
>>   <[email protected]>
>> CC: [email protected], [email protected], [email protected],
>>          [email protected], [email protected]
>>
>> Okay, we'll wait. But please note that we are interested not in the
>> reordering of the text inside each property, but in the text inside th=
e
>> properties participating in the overall bidi algorithm and reordering =
of
>> the underlying text.
>
> For that, the display strings don't need to have text in them.  You
> can just have an overlay with a special property, no?

That would be possible. It would essentially mean simulating Bidi=20
control characters/structure with overlays. As an example, to simulate=20
embeddings and override (I'll call these bidi ranges from now on), we=20
would need an overlay that covers the bidi range, with a new property=20
(let's name it bidi-range just for the moment) that takes four different=20
values corresponding to LRE, RLE, LRO, and RLO. Because the overlay=20
indicates the extent of the bidi range, there is no need for something=20
like the PDF character.

As an equivalent for LRM and RLM, the most straightforward way to=20
implement them would be a property (maybe the same as above) that can=20
take the values LRM-before, LRM-after, RLM-before, and RLM-after.

The above is a very direct simulation; I don't know how much easier it=20
would be to implement than just Bidi processing the before and after=20
text in an overlay.

There are some issues with the proposal above. First, if two overlays=20
indicating bidi ranges overlap without one of them completely being=20
contained in the other, then it has to be defined exactly what that=20
means. (It's not possible to have such a case when using bidi control=20
characters.) Second, there may be a case where one wants a Bidi mark=20
(LRM or RLM) both before and after a character (or range of characters).=20
Actually, that's quite a frequent case. That could be addressed by=20
having bidi-mark-before and bidi-mark-after properties (or two separate=20
overlays).

It may also be possible to have some more elaborate bidi properties on=20
overlays. One example would be to have a property to set the bidi class=20
of a character. Strong LTR and strong RTL in particular would be quite=20
helpful. Currently, we simulate them by having LRMs or RLMs before and=20
after a character. Another idea is to have something equivalent to bidi=20
insulation as currently being discussed for HTML5/CSS3. See
http://www.w3.org/International/docs/html-bidi-requirements/#bidi-isolati=
on=20
for a problem description,=20
http://dev.w3.org/html5/spec/Overview.html#the-bdi-element for the HTML5=20
solution, and
http://dev.w3.org/csswg/css3-writing-modes/#unicode-bidi for the=20
corresponding piece of technology in CSS. Bidi isolation can be=20
simulated with the existing bidi control characters, but it's necessary=20
to look at the bidi classes of surrounding characters.

Regards,    Martin.

--=20
#-# Martin J. D=FCrst, Professor, Aoyama Gakuin University
#-# http://www.sw.it.aoyama.ac.jp   mailto:[email protected]