emacs-bidi
[Top][All Lists]
Advanced

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

Re: [emacs-bidi] mirroring of glyphs


From: Alex Schroeder
Subject: Re: [emacs-bidi] mirroring of glyphs
Date: Sat, 17 Nov 2001 15:55:58 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i686-pc-linux-gnu)

"Eli Zaretskii" <address@hidden> writes:

>> (bidi-visual-to-logical "<123H/>shalom<123H>" 'R2L)
>> 
>>  => "<Hshalom<123</H123>"
>> 
>> instead of
>> 
>> "<H123>shalom</H123>"
>> 
>> I tried playing around with it: I tried reversing the input string and
>> reversing the result in order to mirror any asymmetries in the bidi
>> algorithm.
>
> Did you mirror the < and > characters?

No, I don't think that makes a difference.  Anyway, here's a resumé of
what I did.  Perhaps you see something I am missing.  I list various
definitions of bidi-visual-to-logical, together with input, output,
and expected output.

In all cases I redefined bidi-visual-to-logical and ran my list of
tests.  I then copied the first one that fails.


(unless (fboundp 'string-reverse)
  (defun string-reverse (str)
    "Reverse STR."
    (apply 'string (nreverse (string-to-list str)))))


(defun bidi-visual-to-logical (str context)
  "Reorder STR line by line.
See `bidi-reorder' for a description of CONTEXT."
  (bidi-reorder str context))

(bidi-visual-to-logical "<123H/>shalom<123H>" 'R2L)
"<Hshalom<123</H123>"                        
"<H123>shalom</H123>"


(defun bidi-visual-to-logical (str context)
  "Reorder STR line by line.
See `bidi-reorder' for a description of CONTEXT."
  (string-reverse
   (bidi-reorder (string-reverse str) context)))

(bidi-visual-to-logical "<h123>MALAAS</h123>" 'L2R)
"<hSAALAM<123</h123>"
"<h123>SAALAM</h123>"


(defun bidi-visual-to-logical (str context)
  "Reorder STR line by line.
See `bidi-reorder' for a description of CONTEXT."
  (if (eq context 'R2L)
      (string-reverse
       (bidi-reorder (string-reverse str) context))
    (bidi-reorder str context)))

(bidi-visual-to-logical "abc ECNO abc ~~~23%%% TSET" 'R2L)
"TEST 23%%%~~~ abc ONCE abc"
"TEST abc ~~~23%%% ONCE abc"


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



reply via email to

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