[FriBidi] Attributed unicode

Robin Becker robin at reportlab.com
Tue Feb 6 14:50:34 UTC 2018


 > We really should try to migrate the various bindings to github/fribidi .
 >
 > There is no reason why the python binding does not return all the
 > output from the C function, and I think it should be fixed.

I modified my local version of pyfribidi to work against latest fribidi source 
and also allowed pyfribidi.log to return either the vis or (vis,l_to_v) ie a 
tuple of visual and the logical to visual map.


So I get this running on

fribidi/test/test_ISO8859-8_hebrew.input


$ RETPOS=1 python t.py
u'\xf9\xec\xe5\xed abc' --> (u'\xf9\xec\xe5\xed abc', (0, 1, 2, 3, 4, 5, 6, 7))
u'abc \xf9\xec\xe5\xed' --> (u'abc \xf9\xec\xe5\xed', (0, 1, 2, 3, 4, 5, 6, 7))
u'abc \xf9\xec\xe5\xed cde' --> (u'abc \xf9\xec\xe5\xed cde', (0, 1, 2, 3, 4, 5, 
6, 7, 8, 9, 10, 11))
u'he said: "\xe6\xe4 \xec\xe0 \xf0\xeb\xe5\xef!"' --> (u'"!he said: "\xe6\xe4 
\xec\xe0 \xf0\xeb\xe5\xef', (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 
17, 18, 19, 20, 21, 1, 0))
u'he said: "\xe6\xe4 \xec\xe0 \xf0\xeb\xe5\xef!\xfe"' --> (u'"he said: "\xe6\xe4 
\xec\xe0 \xf0\xeb\xe5\xef!\xfe', (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 
15, 16, 17, 18, 19, 20, 21, 22, 0))
u'(\xf9\xec\xe5\xed) abc' --> (u'abc (\xf9\xec\xe5\xed)', (9, 5, 6, 7, 8, 4, 3, 
0, 1, 2))
u'abc (\xf9\xec\xe5\xed)' --> (u'abc (\xf9\xec\xe5\xed)', (0, 1, 2, 3, 4, 5, 6, 
7, 8, 9))
u'  #@$ \xf9\xec\xe5\xed' --> (u'\xf9\xec\xe5\xed $@#  ', (9, 8, 7, 6, 5, 4, 0, 
1, 2, 3))
u'<h1>\xf9\xec\xe5\xed</h1>' --> (u'<h1>\xf9\xec\xe5\xed</h1>', (12, 1, 2, 3, 4, 
5, 6, 7, 8, 9, 10, 11, 0))
u'\xf9\xec\xe5\xed 23 \xf9\xec\xe5\xed abc' --> (u'\xf9\xec\xe5\xed 23 
\xf9\xec\xe5\xed abc', (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15))
u'\xf9\xec\xe5\xed ~~~23%%%  \xf9\xec\xe5\xed abc' --> (u'\xf9\xec\xe5\xed 
~~~23%%%  \xf9\xec\xe5\xed abc', (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 
14, 15, 16, 17, 18, 19, 20, 21, 22))
u'\xf9\xec\xe5\xed abc ~~~23%%%  \xf9\xec\xe5\xed abc' --> (u'\xf9\xec\xe5\xed 
abc ~~~23%%%  \xf9\xec\xe5\xed abc', (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,          26))
u'\xf9\xec\xe5\xed abc at 23@cde \xf9\xec\xe5\xed' --> (u'\xf9\xec\xe5\xed 
abc at 23@cde \xf9\xec\xe5\xed', (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 
15, 16, 17, 18, 19))
u'\xf9\xec\xe5\xed abc 23 cde \xf9\xec\xe5\xed' --> (u'\xf9\xec\xe5\xed abc 23 
cde \xf9\xec\xe5\xed', (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 
16, 17, 18, 19))
u'\xf9\xec\xe5\xed abc 23 \xf9\xec\xe5\xed abc' --> (u'\xf9\xec\xe5\xed abc 23 
\xf9\xec\xe5\xed abc', (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 
16, 17, 18, 19))
u'<\xf9\xec\xe5\xed>Shalom</\xf9\xec\xe5\xed>' --> 
(u'<\xf9\xec\xe5\xed>Shalom</\xf9\xec\xe5\xed>', (18, 1, 2, 3, 4, 5, 6, 7, 8, 9, 
10, 11, 12, 13, 14, 15, 16, 17, 0))
u'\xf9a 2 \xf9' --> (u'\xf9a 2 \xf9', (0, 1, 2, 3, 4, 5))
u'' --> (u'', ())

if any of this is useful I can put it into a visible repos somewhere.
-- 
Robin Becker
On 06/02/2018 09:12, Dov Grobgeld wrote:

> 
> Somewhat unrelated, I just stub for a wiki at fribidi . It might be
.........


More information about the fribidi mailing list