The contents of this page does compile and does work when you try to load the shared library file mentioned here fribidi_tcl.so.
However this DOES NOT take you to the required goal of rendering the Arabic text to be easily readable
Please move to this page [L1 ] to see a perfectly working method.
Hi.
This will help you build a shared library that will let you display mixed languages like Arabic and Latin characters in the proper visual way. FriBidi is the library which does it.
select one and only one of the following 3 options:
If you use tcl8.5-dev package then type in the terminal:
tcl_include=/usr/include/tcl8.5/
If you use tcl8.6-dev package then type in the terminal:
tcl_include=/usr/include/tcl8.6/
If you use ActiveTcl 8.6 package then type in the terminal:
tcl_include=/opt/ActiveTcl-8.6/include/
So I ask you to change the version of Tcl accordingly.
And then open a new ascii text file, using a text editor like gEdit or vi or kate. Name the file fribidi.i.
Add the following instructions used by swig to fribidi.i
%module fribidi %{ #include <fribidi/fribidi.h> %} %include "/usr/include/fribidi/fribidi-common.h"; %include "/usr/include/fribidi/fribidi-unicode.h"; %include "/usr/include/fribidi/fribidi-types.h"; %include "/usr/include/fribidi/fribidi-flags.h"; %include "/usr/include/fribidi/fribidi-bidi-types.h"; %include "/usr/include/fribidi/fribidi-bidi.h"; %include "/usr/include/fribidi/fribidi-joining-types.h"; %include "/usr/include/fribidi/fribidi-joining.h"; %include "/usr/include/fribidi/fribidi-mirroring.h"; %include "/usr/include/fribidi/fribidi-arabic.h"; %include "/usr/include/fribidi/fribidi-shape.h"; %include "/usr/include/fribidi/fribidi-char-sets.h"; %include "/usr/include/fribidi/fribidi-deprecated.h"; %include "/usr/include/fribidi/fribidi-begindecls.h"; %include "/usr/include/fribidi/fribidi-enddecls.h";
Run the following command:
swig -tcl fribidi.i
This will produce a new file named fribidi_wrap.c in the current directory.
The following is warning that will result from using swig. Ignore the warning:
/usr/include/fribidi/fribidi-unicode.h:55: Warning 451: Setting a const char * variable may leak memory
Then generate the object file free_wrap.o by compiling fribidi_wrap.c. Read carefully:
If you are on 32 bit system, run the following command on the terminal:
gcc -c fribidi_wrap.c -o fribidi_wrap.o -I $tcl_include
If you are on 64 bit system, run the following command on the terminal. Notice that we added the option -fPIC:
gcc -c fribidi_wrap.c -o fribidi_wrap.o -I $tcl_include -fPIC
finally we can get our shared library as the file fribidi_tcl.so, run the following command on the terminal :
gcc -Wall -shared -I $tcl_include fribidi_wrap.o -lm -lfribidi -o fribidi_tcl.so
Then in your Tcl code, you may use fribidi_tcl.so using the load command:
load fribidi_tcl.so
To see all the commands provided by fribidi_tcl.so, run the following command on the terminal
nm fribidi_tcl.so | more
The tcl terminal tkcon can also help in listing some of fribidi commands. Only type fribidi and use text completion by pressing the TAB key twice.