Hi,

http://www.clearchinese.com/resources/fonts.htm
Have a look at the free chinese fonts available in above link. I downloaded 
some of the files and tried to display the symbols present in the TTF file 
using DirectFB1.2.0 example program (df_fonts). It doesn't show any symbols. It 
simply shows blank spaces for all the 0xFFFF Unicode values. What could be the 
reason for this? Whether is has some other enconding? 

My program passes unicode text to drawtext api. 

I tested with some other font (umin08m.ttf) of size 24MB. It shows all symbols 
correctly. I can't use this font in our board setup as its size is large. I can 
load around 2MB font.

In DFB example program, it shows the encoding as UTF-8 and Latin 1 for all the 
tested fonts.

If anyone could help me to resolve this issue? If any sample code is provided, 
it would be greatly helpful.

Regards,
Vijay


From: lull.san <[EMAIL PROTECTED]>
To: pvanand <[EMAIL PROTECTED]>
Cc: directfb-users@directfb.org
Sent: Friday, 7 November, 2008 7:59:22 PM
Subject: Re: [directfb-users] How to support chinese font and text display 
using directfb


1. find a chinese font.
2. download libiconv, make && make install.
3. write convert function, like this:  
 
int code_convert(char *from_chrset, char *to_chrset, char *inbuf, int in_len, 
char *outbuf, int out_len)
{
    iconv_t cd;
    char **pin = &inbuf;
    char **pout = &outbuf;
    int errno, result;
    const int set = 0;

    cd = iconv_open(to_chrset, from_chrset);
    if (cd==0) {
        printf("can't open charset %s !\n", to_chrset);
        return -1;
    }
    iconvctl(cd, ICONV_SET_TRANSLITERATE, (void*)&set);
    iconvctl(cd, ICONV_GET_TRANSLITERATE, &result);
    printf("ICONV_GET_TRANSLITERATE=%d\n", result);
    memset(outbuf, 0, out_len);
    if (iconv(cd, pin, &in_len, pout, &out_len )== -1) {
        printf("can't iconv charset from %s to %s!\n", from_chrset, to_chrset);
        printf("error=%s\n", strerror(errno));
       return -1;
    }
    iconv_close(cd);
    return 0;
}
 
call fun : code_convert("GB2312", "UTF-8", text, strlen(text), conv_text, 100); 
(please link libiconv lib for your program)

 
4. display previous outbuf use directfb surface DrawString function : 
surface->SetFont(surface, gfx_font);
surface->DrawString(surface, conv_text, (int)strlen(conv_text), x, y, 
DSTF_LEFT);



2008/11/3 pvanand <[EMAIL PROTECTED]>


Hi,

I'm trying to display chinese text using directfb. I've set the font
attribute as unicode and using HDZB_35.ttf font. CreateFont is succeeded..
But no output is observed while plotting the chinese unicode string using
DrawGlyph api.

If anyone could help me to resolve this issue. If any sample code is
provided, it would be greatly helpful.

Thanks and Regards,
Vijay
--
View this message in context: 
http://www.nabble.com/How-to-support-chinese-font-and-text-display-using-directfb-tp20304682p20304682.html
Sent from the DirectFB Users mailing list archive at Nabble.com.

_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users


      Add more friends to your messenger and enjoy! Go to 
http://messenger.yahoo.com/invite/
_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to