conjunction between chars

Milad Rastian <[email protected]> Sat, 21 Nov 2009 01:40:28 +0330
Newsgroups gmane.comp.internationalization.fribidi
Message-ID <[email protected]>
Hi fribidi !
I have a little code which use fribid lib(attached that), it works. but when
I test it in gnome-terminal chars are not conjunction together,
should I use another function  to conjunct chars ?




Thanks,
-- 
/--------------------
Milad Rastian
http://milad.rastian.com

_______________________________________________
fribidi mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/fribidi
milad02.c (text/x-csrc, 1.8 KB)

#include "fribidi.h"

#include <string.h>


#include <stdio.h>
#include <stdlib.h>
//`#include <stdarg.h>

#define MAX_STR_LEN 65000

//gcc tests.c  -lfribidi -o milad

#define ALLOCATE(tp,ln) ((tp *) malloc (sizeof (tp) * (ln)))


void main(){
    FriBidiChar *u_logical_str, *u_visual_str;  /* unicode strings .... */
            int len, alloc_len;
                FriBidiCharType base_dir;
                    FriBidiStrIndex *position_L_to_V_list;
                        FriBidiStrIndex *position_V_to_L_list;
                            FriBidiLevel    *embedding_level_list;


       base_dir = FRIBIDI_TYPE_RTL;

       char  *out_string;
       char  *in_string="من می رم";
       len = strlen(in_string);

       alloc_len = len+1;

        u_logical_str =  ALLOCATE(FriBidiChar,alloc_len);
        
        u_logical_str = ALLOCATE (FriBidiChar,alloc_len);
        u_visual_str = ALLOCATE (FriBidiChar,alloc_len);

        position_L_to_V_list =  ALLOCATE (FriBidiStrIndex,alloc_len);
        position_V_to_L_list = ALLOCATE (FriBidiStrIndex,alloc_len);
        embedding_level_list = ALLOCATE(FriBidiLevel,alloc_len);

        if(in_string[len-1] == '\n') {
            in_string[len-1] = '\0';
        }

        int char_set_num;
        char *char_set;

            char_set = "UTF-8";
            
            char_set_num = fribidi_parse_charset (char_set);

            len = fribidi_charset_to_unicode(char_set_num, in_string, len, u_logical_str);

            out_string = ALLOCATE(char,alloc_len);

            fribidi_log2vis(u_logical_str, len, &base_dir, u_visual_str, position_L_to_V_list, position_V_to_L_list, embedding_level_list);            



            fribidi_unicode_to_charset(char_set_num, u_visual_str, len, out_string);
            printf("%s\n",out_string);

}