GNU FriBidi
C Makefile C++ Meson M4 Shell Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.ci Build c2man on Travis Feb 14, 2018
bin Add support for building with the Meson build system Feb 19, 2018
doc Revert "Add an option to disable building documentation" Mar 19, 2018 gen-brackets-tab.c: Declare variables at top-of-block Feb 27, 2018
lib Fix memory leak Feb 27, 2018
m4 Less hackish cross compilation support. Jan 13, 2018
test Add test_CapRTL_isolate.* to test/ Mar 19, 2018 Simplify fribidi-types.h a bit Nov 15, 2017
.travis.yml Update .travis.yml Mar 19, 2018
AUTHORS Update AUTHORS file to reflect the current state more accurately. Feb 23, 2018
COPYING Update FSF address Dec 2, 2012
ChangeLog.old Misc. typos Feb 3, 2018
HISTORY Made the README and the HISTORY more up to date. Mar 18, 2018 build: dist Meson build files in autotools tarball Feb 19, 2018
NEWS Version 1.0.2 release update Mar 18, 2018
README Update Nov 7, 2017 Made the README and the HISTORY more up to date. Mar 18, 2018
THANKS Added some more thanks! Feb 23, 2018
TODO Add remaining issues before a release can be made. Jun 7, 2007
USERS Add AbsoluteTelnet. Dec 30, 2008 Replace bootstrap with simpler Feb 13, 2018 Revert "Add an option to disable building documentation" Mar 19, 2018 Remove more remnants of GLib support Nov 11, 2017 Update Jan 28, 2018 Version 1.0.2 release update Mar 18, 2018
meson_options.txt Remove glib dependancy from test.c and test-character.c . Mar 10, 2018

GNU FriBidi

The Free Implementation of the Unicode Bidirectional Algorithm.


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 needs to be implemented. It is our hope that this library will stimulate more free software in the Middle Eastern countries.

See HISTORY on how the project started and evolved.


It is our hope that this library will stimulate the implementation of Hebrew and Arabic support in lots of Free Software.

GNU FriBidi is already being used in projects like Pango (resulting in GTK+ and GNOME using GNU FriBidi), AbiWord, MLTerm, MPlayer, BiCon, and vlc.

See USERS for a list of projects using GNU FriBidi.


GNU FriBidi does not depend on any other library. It uses either the GNU Build System or meson for build and installation.


The latest version of GNU FriBidi may be found at:


Start with running the script and follow the instructions. Alternatively use meson.


GNU FriBidi 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.

GNU FriBidi 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 GNU FriBidi, in a file named COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Commercial licensing

For commercial licensing options, contact


The library implements the algorithm described in the "Unicode Standard Annex #9, The Bidirectional Algorithm", available at

The library uses Unicode (UTF-32) entirely. The character properties are automatically extracted from the Unicode data files, available from This means that every Unicode character is treated in strict accordance with the Unicode specification.

There is a limited support for character set conversion from/to the UTF-32 encoding. Data in these character sets must be converted into UTF-32 before the library may be used. iconv(3) can always do a better job on that, so you may find that the character sets conversion code is typically turned off on POSIX machines.

Conformance Status

GNU FriBidi has been tested exhaustively against the Unicode Reference Code, and to the best of our knowledge, it completely conforms to the specification, always producing the same result as the Reference Code.


The simplest way of accessing the API is through the convenience function fribibidi_log2vis which has the following signature:

fribidi_boolean fribidi_log2vis(
    /* input */
    FriBidiChar     *str,
    FriBidiStrIndex len,
    FriBidiCharType *pbase_dir,
    /* output */
    FriBidiChar     *visual_str,
    FriBidiStrIndex *position_L_to_V_list,
    FriBidiStrIndex *position_V_to_L_list,
    FriBidiLevel    *embedding_level_list


  • str is the Unicode input string.
  • len is the length of the Unicode string (str).
  • pbase_dir is the input and output base direction. If pbase_dir == FRIBIDI_TYPE_ON then fribidi_log2vis() calculates the base direction on its own, according to the bidi algorithm.
  • visual_str is 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. Here, even numerical levels indicate LTR characters, and odd levels indicate RTL characters. The main use of this list is in interactive applications where, for example, the embedding level determines cursor display.

If any of the output pointers is equal to NULL, then that information is not calculated.

Note that a call to fribidi_log2vis() is a convenience function to calling the following three functions in order:

  1. fribidi_get_bidi_types()
  2. fribidi_get_par_embedding_levels_ex()
  3. fribidi_reorder_line()

How it looks like

Have a look at test/ directory, to see some input and outputs.

The 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.


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 --help to learn about usage.

The command-line utility is known to have problems with line-breaking and logical-to-vertical/vertical-to-logical lists.

Bug Reports and Feedback

Report bugs and general feedback at:

The mailing list is the place for additional technical discussions and user questions:

Maintainers and Contributors

See also AUTHORS and THANKS for the complete list of contributors.