summaryrefslogtreecommitdiff
path: root/README
blob: 928714548f76586a91127d59ac3bb7d5d8fee7e9 (plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
This is is FriBidi, a Free Implementation of the Unicode BiDi algorithm.

Background
==========
One of the missing links stopping the penetration of free software in Middle
East is the lack of support for the Arabic and Hebrew alphabets. In order to
have proper Arabic and Hebrew support, the BiDi algorithm should have been
implemented. It is our hope that this library will stimulate more free
software in the Middle Eastern countries.

Audience
========
It is our hope that this library will stimulate the implementation of Hebrew
and Arabic in lots of free software. Here is a small list of projects that
would benifit from the use of the FriBidi library, but of course there are
many more: Wine, Mozilla, Qt, KDE, AbiWord, lynx, OpenOffice.

It may be interesting for you to know that Fribidi is already being used in
projects like Gnome, GTK+, Pango, and Xterm.

Downloading
===========
The latest version of FriBidi may be found at:

   http://fribidi.sourceforge.net/

Building
========
See INSTALL for a description of how to build and install this library.

Copyright
=========
Fribidi is:
Copyright (C) 1999,2000 Dov Grobgeld, and
Copyright (C) 2001,2002 Behdad Esfahbod.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this library, in a file named COPYING; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA  02111-1307  USA

For licensing issues, contact <dov@imagic.weizmann.ac.il> and
<fwpg@sharif.edu>.

Implementation
==============
The library implements the algorithm described in the "Unicode Standard
Annex #9, The Bidirectional Algorithm", available at
http://www.unicode.org/unicode/reports/tr9/. Fribidi has been tested
exhaustively against the Unicode Reference Code, and due to our knowledge,
it completely conforms to the specification, always producing the same
result as the Reference Code.

In the API we were inspired by the document "Bi-Di languages support
- BiDi API propasal", http://www.langbox.com/AraMosaic/mozilla/BiDi_API.html,
by Franck Portaneri <franck@langbox.com> which he wrote as a proposal for
adding BiDi support to Mozilla.

Internally, the library uses Unicode entirely. The character property
function was automatically created from the Unicode property list document
PropList.txt available from the Unicode FTP site. This means that every
Unicode character is treated in strict accordance with the Unicode
specification. The same is true for the mirroring of characters, which also
works for all the characters listed as mirrorable in the the Unicode
specification.

Other character sets must be converted into Unicode before the library
may be used. In order to use, e.g. iso8859-8, the function

     void
     fribidi_iso8859_8_to_unicode(guchar *s,
             	                  /* output */
	    	                  FriBidiChar *us)

must be called which translates the guchar string *s to a unicode 
string. There is also a corresponding fribidi_unicode_to_iso8859_8
that may be called to convert the string back to iso8859_8 for output.

The reordering of characters is done through the function:
      
     void
     fribidi_log2vis(/* input */
		     FriBidiChar *str,
		     int len,
		     FriBidiCharType *pbase_dir,
		     /* output */
		     FriBidiChar *visual_str,
		     gint        *position_L_to_V_list,
		     gint        *position_V_to_L_list,
		     gint8       *embedding_level_list
		     )
    

where
     str                    is the Unicode input string
     len                    is the length of the unicode string
     pbase_dir              is the input and output base direction. If 
                            base == FRIBIDI_TYPE_ON then fribidi_log2vis 
                            calculates the base direction on its own
                            according to the BiDi algorithm.
     visual_str             The reordered output unicode string.
     position_L_to_V_list   Maps the positions in the logical string to 
                            positions in the visual string.
     position_V_to_L_list   Maps the positions in the visual string to 
                            the positions in the logical string.
     embedding_level_list   Returns the classification of each character. Even
                            levels indicate LTR characters, and odd levels
                            indicate RTL characters. The main use of this
                            list is in interactive applications when the
                            embedding e.g. level determines cursor display.

In any of the output pointers == NULL, then that information is not 
calculated.

How it looks like
=================

Have a look at tests directory, to see some input and outputs, which
CapRTL charset means that CAPITAL letters are right to left, and digits
6, 7, 8, 9 are Arabic digits, try 'fribidi --charsetdesc CapRTL' for the
full description.

Executable
==========
There is also a command line utilitity called fribidi that loops over
the text of a file and performs the BiDi algorithm on each line, also
used for testing the algorithm. Run fribidi with the --help option to
learn about usage.

Bugs and comments
=================

Report FriBidi bugs at:

	http://fribidi.sourceforge.net/bugs.php

And send your comments to:

	fribidi-discuss@lists.sourceforge.net