[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] evas arabic support



hi everyone,

i recently started a small app to help me learn arabic with etk and evas.

after finishing the gui i realized evas text handling doesn't support arabic.

after a bit work i've managed to get it working.

basically there are three problems to manage : 

1) write from right to left (not just reverse the string as inside one string unmbers and foreign words need to be written in left to right)
2) to some glyph shaping : in arabic, the shape of the letter depends of its position in the word so each char needs to be replaced by the corresponding one

to handle these two steps I used the code from the minibidi project from arabeyes.org

at this point only my code is modified (convert texts from utf8 to widechars, use minibidi, convert back)

(as of now, libfribidi only handles 1), and 2) is said to be tested in cvs)

3) when displaying the texts, some chars are only accents and need to be placed on the preceding letter and not after
(like short vowels, or chadda)

to get this done is only possible by modifying evas

for exemple
i changed the evas_font_draw.c like this : 
    chr_x = (pen_x + (fg->glyph_out->left << 8)) >> 8;
    chr_y = (pen_y + (fg->glyph_out->top << 8)) >> 8;

    if (gl == 1617) chr_x -= fg->glyph_out->bitmap.width; <-- line added

......

    if (gl != 1617) { <-- line added
        pen_x += fg->glyph->advance.x >> 8; 

here 1617 corresponds to the chadda char

and it works !


so, now are my questions :


would it be a good idea to add support for arabic text (and hebrew, and complex languages) ?

which functions would need to be modified ?
(are for example some functions returning string lenghts ?)

how is text internally encoded ? widechars or locale dependent ?

would it be acceptable to include minibidi source code or should we wait for libfribidi ?

....

all comments welcome !

Wagner Frederic