Quoting Joey Hess ([EMAIL PROTECTED]):

>     * Arabic and Hebrew display problems.
> 
> No progress.

Shlomi Loubaton has written a function for displaying BIDI text. Let
me quote him:


After a little help with FriBiDi from Nadav Har'El I wrote a little function 
that should convert uft8 bidi-text to visual bidi-text:

/**********************************************************************/
#ifdef USE_FRIBIDI
/* Convert bidi utf8 text to visual utf8 text which is displayable in text 
mode
 *  * NOTE: This function returns an allocated block that should be 
released.*/
char* utf8_to_textmod_visual(unsigned char *in)
{
    FriBidiCharType base_dir=FRIBIDI_TYPE_N;
    char *out=NULL;
    FriBidiChar *unicode_in,*unicode_out;

    int in_len = strlen(in);
    int unicode_in_length;

    unicode_in=(FriBidiChar *)malloc(sizeof(FriBidiChar)*in_len);   /* Is 
there a better way to guess the max length?*/
    unicode_out=(FriBidiChar *)malloc(sizeof(FriBidiChar)*in_len);
    out=(char *)malloc(in_len);         /*Output should be same length as 
input*/

    if(!unicode_in || !unicode_out || !out)
    {
        /* Cleanup  */
        if(unicode_in) free(unicode_in);
        if(unicode_out) free(unicode_out);
        if(out) free(out);
        return out;
    }

    unicode_in_length = fribidi_charset_to_unicode(FRIBIDI_CHARSET_UTF8, in, 
in_len, unicode_in);
    fribidi_log2vis(unicode_in, unicode_in_length , &base_dir,unicode_out, 
NULL, NULL, NULL);
    fribidi_unicode_to_utf8(unicode_out, unicode_in_length, out);

    free(unicode_in);
    free(unicode_out);
    return out;
}
#endif
/**********************************************************************/

Now I'll try to create a nice patch for slang (which is used by newt).
So far, i have changed the only the function "SLsmg_write_nchars" (in the file 
slang-1.4.9/src/slsmg.c) which is used by the function 
"SLsmg_write_string" ...(sight)... which is used by newt to write strings.

I've recompiled slang with this change and rebuilt the slang packages:
ftp://ftp.berlios.de/pub/kazit/slang-bidi

The function seen above should be in used on any utf8 bidi output being 
displayed on screen. Now, we have to find all these placed and implement it.

Moreover, as you probably already know, we have to find a way to "Reverse" the 
display so that the newt widgets and text will all be aligned to right. This 
is the tricky part and can be implemented in the newt level or in the slang 
level, I'm still thinking about it, so far , it seems that if we "translate" 
screen coordinates in slang, it will be very easy. but i fear it may fuck up 
other stuff. so i have to think about it a little more. anyway, have fun.


Regrads
Shlomil.




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

  • errata Joey Hess
    • Christian Perrier

Reply via email to