[FriBidi] Experience of reducing FriBidi size?

Mikael Hedlund mikael.hedlund at mecel.se
Tue Dec 7 10:51:48 PST 2010


Hi!

I am about to implement support for Arabic script in an embedded system, 
where small footprint in flash and particularly RAM is important.
The system does also handle languages using the latin alphabet. The 
handling and rendering of Arabic script will be pretty basic, and the plan 
is
to support only the 28 basic characters including positional forms and the 
ligature lam + alef, and also the Arabic-Indic numerals. I hope that's
"decent enough", or are there some other arabic characters/glyphs that I 
"must" support? (I don't speak/read/write Arabic, so I am not 100% sure 
here)
 
Support for Arabic script should preferably not add much more than 40-50 
kB to my current binary, although 80 kB might be ok. However, 100 kB would 
probably
be too much. Since limited memory is a big issue, I currently see two main 
options (since I reckon using the ICU lib would not be acceptable from 
memory point of view):

a) The preferred way: Use the FriBidi in a reduced version where I 
comment/configure out or remove parts I don't need. As I understand, the 
latest version fully complies with the Unicode BiDi algorithm,
including the bidi control codes, and is practically bug free. In addition 
it also supports Arabic shaping. That all makes FriBidi attractive, but 
currently the footprint is unfortunately too big for me.

b) Second way out: Use for instance the C reference implementation of the 
Unicode Bidi algorithm (by adding the necessary wrapping) + write my own 
code to handle the Arabic shaping.

For reference: when I compiled using GCC on Ubuntu, the C ref 
implementation binary was about 20 kB (dynamically linked) and the FriBidi 
lib was about 165 kB (dynamically linked).

1) Are there some easy steps to reduce the size of the FriBidi binary, and 
does anyone have any experience how much the FriBidi binary in that case 
could be reduced?
    From a quick look in the code there seemed to be some fairly large 
tables which I assume could be reduced, plus some Hebrew related 
conversion routines to/from Unicode that are not needed in my case.
    Are there any nifty defines or other config parameters I have missed, 
that would reduce size?
 
2) If I don't succeed in reducing FriBidi enough, does anyone have a rough 
clue or experience of how much time it might take to implement a basic 
version of Arabic shaping based on my needs,
    or have any clue/experience of how much that could add to the 
footprint? 
    Implementing the Arabic shaping doesn't seem extremely hard given the 
pretty basic shaping I need, but I am sure there are problems I don't 
foresee, so I guess I shouldn't say anything until I have tried. :-)


Best regards,
Mikael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/fribidi/attachments/20101207/787d7b57/attachment.htm>


More information about the fribidi mailing list