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: Ehud Karni
Subject: Re: [emacs-bidi] Where do I start?
Date: Wed, 7 Nov 2001 20:04:21 +0200

On Wed, 07 Nov 2001 16:04:19 +0100, Alex Schroeder <address@hidden> wrote:
>
> What I found is the following (and related functions).
>
> ELISP> (winvert-string "foo and אבגדהוזחטיךכלםמןנסעףפץצקרשת and foo")
> "foo and תשרקצץפףעסנןמםלכךיטחזוהדגבא and foo"

Please note the dependency on the reading direction (right2left-on).


> >   - 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.
>
> ELISP> (winvert-list (split-string "there is אבגדהוזחטיךכלם\nand foo and 
> מןנסעףפץצקרשת and\nfoo" "\n"))
> "there is םלכךיטחזוהדגבאand תשרקצץפףעסנןמ and foo andfoo"

I don't think `winvert-list' is suitable for this, you can use use
`winvert-string' but you must wrap it in another way.

> Some more magic would be required to add the right spaces.  The simple
> solutions of replacing "\n" with "\n " or " \n" don't work because
> that results in either two or no spaces.
>
> Anyway, I hope Ehud will speak up if this is on the wrong track.

The way to do it is to "invert" the whole paragraph (winvert each line)
and then reflow it. like this:
  1. narrow-to-region (include just this paragraph)
  2. (invert-all-lines)
  3. (fill-region-as-paragraph (point-min) (point-max) JUSTIFY)
  4. (invert-all-lines right2left-1st-col)
  5. widen
`invert-all-lines' is defined in hebeng.el.

> (defun get-bidi-type (char)

This is only for ISO-8859-8 and pure 8 bits (unibyte).

My code is not UTR#9 compliant although it does the same reordering
most of the time. This is an alternative reordering method that (I
think so) does a better job (needs less formatting characters) in
many cases (mostly with combination of numerals and punctuation).

Ehud.


--
 @@@@@@ @@@ @@@@@@ @    @    Ehud Karni                       ינרק דוהא
     @    @      @  @@  @    Senior System Support   בשחמ תוכרעמב הכימת
     @    @ @    @ @  @@     Mivtach - Simon               ןומיס - חטבמ
     @    @ @    @ @    @    Insurance agencies          חוטבל תויונכוס
 Better  Safe  Than  Sorry   Tel: +972-3-7966-561  Fax: +972-3-7966-667
 http://www.simonwiesel.co.il        mailto:address@hidden



reply via email to

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