emacs-bidi
[Top][All Lists]
Advanced

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

Re: [emacs-bidi] Where do I start?


From: Alex Schroeder
Subject: Re: [emacs-bidi] Where do I start?
Date: Tue, 13 Nov 2001 16:58:03 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i686-pc-linux-gnu)

Eli Zaretskii <address@hidden> writes:

> Okay, how's this sound: how about writing a visual-to-logical
> converter?

What do you think about the current status?  Perhaps it would be best
if I had new assignment instead of perfecting the existing code.

As to the status of bidi.el:

> Some preliminary thoughts:
>
>   - Ideally, the code will accept a paragraph of text (which can span
>     several lines), and produce a reordered paragraph.  But in
>     practice, it's possible that only a small part of the text is
>     passed (think about reading output of an async subprocess).  I
>     don't know what to do about this case; perhaps nothing for now.

I think paragraphs work.

>   - The paragraph could be left-justified (a mostly left-to-right text
>     with some right-to-left characters embedded), or right-justified.
>     In the latter case, you need to remove any padding blanks on the
>     left, as part of the conversion.

The algorithm seems to work correctly.

Here's the original:

                    this is a normal paragraph containing some
                    words in ARAB and HEBREW.  these strings need to be
                    reverted.  numbers like 123 should work, even when
                    ENCLOSED IN ARAB TEXT SUCH AS 4567.89 IS ON THIS LINE
                    AND ON THE NEXT.

Using bidi-visual-to-logical-paragraph and answering left-to-right:

                    this is a normal paragraph containing some
                    words in BARA and WERBEH.  these strings need to be
                    reverted.  numbers like 123 should work, even when
                    ENIL SIHT NO SI 4567.89 SA HCUS TXET BARA NI DESOLCNE
                    TXEN EHT NO DNA.

Using bidi-visual-to-logical-paragraph and answering right-to-left:

this is a normal paragraph containing some                    
these strings need to be  .WERBEH and BARA words in                    
reverted.  numbers like 123 should work, even when                    
ENIL SIHT NO SI 4567.89 SA HCUS TXET BARA NI DESOLCNE                    
.TXEN EHT NO DNA                    

Note the trailing whitespace in this case.  Do you think this is right
or wrong?  I didn't implement the following rule from L1, so perhaps
that is the problem?

L1. On each line, reset the embedding level of the following characters to the
paragraph embedding level:
    ...
 3. any sequence of whitespace characters preceding a segment separator or
    paragraph separator, and
 4. any sequence of white space characters at the end of the line.

>   - It would be nice if the code included detection of visual-order
>     bidi text, but it's not imperative.

Nothing was done in this respect.

>   - It would be nice if converting from logical to visual and then
>     back would be as close to the original as possible.  I think you
>     should be able to reproduce the original exactly if it contains no
>     explicit formatting codes; otherwise, you can't.

I think this mostly works.  What I'm still playing around with is
Ehud's idea of how to improve the visual-to-logical transformation.

> Oh, and I need this by today's noon, otherwise start typing your
> resume' ;-)  I'm your manager, remember?

Yeah I know, 6 days late.  :)

Alex.
-- 
http://www.emacswiki.org/



reply via email to

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