[Top][All Lists]
[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: |
Sun, 18 Nov 2001 18:01:27 +0100 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i686-pc-linux-gnu) |
"Eli Zaretskii" <address@hidden> writes:
> It's very hard to look at this without a few debugging aids. One such
> tool that helps a lot is to print the input string with final resolved
> levels under every character. Could you add such a feature and post
> the results with the problematic strings?
Sure. Perhaps it makes sense to read this mail using
outline-minor-mode. :)
* Problem:
(bidi-visual-to-logical "<123H/>shalom<123H>" 'R2L)
returns "<Hshalom<123</H123>"
instead of "<H123>shalom</H123>"
(bidi-pretty-print "<123H/>shalom<123H>")
" < 1 2 3 H / > s h a l o m < 1 2 3 H >"
The R2L context means that the paragraph embedding level is set to 1.
In the end, this is what will be evaluated:
(bidi-reorder-string
str
(bidi-resolve-implicit-levels
(bidi-resolve-weak-types (bidi-get-types str) (oddp paragraph-level))
(make-list (length str) paragraph-level))))
Here's some debugging info. I always put the piece of code I used
followed by the output generated. Below this output, I list
information from further up such as to keep the info together.
Example:
CODE1
RESULT1
CODE2
RESULT2 (output generated)
RESULT1 (information from furhter up)
** bidi-get-types
(bidi-pretty-print
(bidi-get-mnemonics
(bidi-get-types "<123H/>shalom<123H>")))
" ON EN EN EN R ES ON L L L L L L ON EN EN EN R ON"
" < 1 2 3 H / > s h a l o m < 1 2 3 H >"
** bidi-resolve-weak-types
(bidi-pretty-print
(bidi-get-mnemonics
(bidi-resolve-weak-types
(bidi-get-types "<123H/>shalom<123H>") t)))
" R EN EN EN R R R L L L L L L L L L L R R"
" ON EN EN EN R ES ON L L L L L L ON EN EN EN R ON"
" < 1 2 3 H / > s h a l o m < 1 2 3 H >"
** bidi-resolve-implicit-levels
(let ((str "<123H/>shalom<123H>"))
(bidi-pretty-print
(bidi-resolve-implicit-levels
(bidi-resolve-weak-types (bidi-get-types str) t)
(make-list (length str) 1))))
" 1 2 2 2 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1"
" R EN EN EN R R R L L L L L L L L L L R R"
" ON EN EN EN R ES ON L L L L L L ON EN EN EN R ON"
" < 1 2 3 H / > s h a l o m < 1 2 3 H >"
* Possible fix: string-reverse
When reversing input and output:
(string-reverse
(bidi-visual-to-logical
(string-reverse "<123H/>shalom<123H>") 'R2L))
returns "<H123>shalom</H123>" as required
This solves the immediate problem, but fails with the following:
(string-reverse
(bidi-visual-to-logical
(string-reverse "<h123>MALAAS</h123>") 'L2R))
return "<hSAALAM<123</h123>"
instead of "<h123>SAALAM</h123>"
(bidi-pretty-print "<h123>MALAAS</h123>")
" < h 1 2 3 > M A L A A S < / h 1 2 3 >"
** bidi-get-types
(bidi-pretty-print
(bidi-get-mnemonics
(bidi-get-types "<h123>MALAAS</h123>")))
" ON L EN EN EN ON R R R R R R ON ES L EN EN EN ON"
" < h 1 2 3 > M A L A A S < / h 1 2 3 >"
** bidi-resolve-weak-types
This is without reversing the string:
(bidi-pretty-print
(bidi-get-mnemonics
(bidi-resolve-weak-types
(bidi-get-types "<h123>MALAAS</h123>"))))
" L L L L L L R R R R R R L L L L L L L"
Here the reversed string is passed to the bidi functions:
(bidi-pretty-print
(nreverse
(bidi-get-mnemonics
(bidi-resolve-weak-types
(bidi-get-types
(string-reverse "<h123>MALAAS</h123>"))))))
" L L EN EN EN R R R R R R R L L L L L L L"
" ON L EN EN EN ON R R R R R R ON ES L EN EN EN ON"
" < h 1 2 3 > M A L A A S < / h 1 2 3 >"
** bidi-resolve-implicit-levels
(let ((str (string-reverse "<h123>MALAAS</h123>")))
(bidi-pretty-print
(nreverse
(bidi-resolve-implicit-levels
(bidi-resolve-weak-types
(bidi-get-types str))
(make-list (length str) 1)))))
" 2 2 2 2 2 1 1 1 1 1 1 1 2 2 2 2 2 2 2"
" L L EN EN EN R R R R R R R L L L L L L L"
" ON L EN EN EN ON R R R R R R ON ES L EN EN EN ON"
" < h 1 2 3 > M A L A A S < / h 1 2 3 >"
Alex.
--
http://www.emacswiki.org/
- Re: [emacs-bidi] Where do I start?, (continued)
- Re: [emacs-bidi] Where do I start?, Eli Zaretskii, 2001/11/13
- Re: [emacs-bidi] testing bidi.el with the pgba tests, Alex Schroeder, 2001/11/15
- Re: [emacs-bidi] testing bidi.el with the pgba tests, Eli Zaretskii, 2001/11/15
- Re: [emacs-bidi] mirroring of glyphs, Alex Schroeder, 2001/11/15
- Re: [emacs-bidi] mirroring of glyphs, Alex Schroeder, 2001/11/15
- Re: [emacs-bidi] mirroring of glyphs, Alex Schroeder, 2001/11/16
- Re: [emacs-bidi] mirroring of glyphs, Eli Zaretskii, 2001/11/16
- Re: [emacs-bidi] mirroring of glyphs, Ehud Karni, 2001/11/16
- Re: [emacs-bidi] mirroring of glyphs, Alex Schroeder, 2001/11/17
- Re: [emacs-bidi] mirroring of glyphs, Eli Zaretskii, 2001/11/17
- Re: [emacs-bidi] mirroring of glyphs,
Alex Schroeder <=
- Re: [emacs-bidi] mirroring of glyphs, Eli Zaretskii, 2001/11/19
- Re: [emacs-bidi] mirroring of glyphs, Alex Schroeder, 2001/11/19
- Re: [emacs-bidi] mirroring of glyphs, Eli Zaretskii, 2001/11/19
- Re: [emacs-bidi] mirroring of glyphs, Alex Schroeder, 2001/11/19
- Re: [emacs-bidi] mirroring of glyphs, Eli Zaretskii, 2001/11/19
- Re: [emacs-bidi] mirroring of glyphs, Alex Schroeder, 2001/11/19
- Re: [emacs-bidi] mirroring of glyphs, Eli Zaretskii, 2001/11/20
- Re: [emacs-bidi] mirroring of glyphs, Alex Schroeder, 2001/11/20
- Re: [emacs-bidi] mirroring of glyphs, Eli Zaretskii, 2001/11/20
- Re: [emacs-bidi] mirroring of glyphs, Alex Schroeder, 2001/11/18