GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How can i display chinese characters?

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
Carol



Joined: 02 Sep 2008
Posts: 2

PostPosted: Tue Sep 02, 2008 10:23 am    Post subject: How can i display chinese characters? Reply with quote

Does anyone know how to display Chinese characters in GTK+?
Previously i tried to use DrawString in directfb library but still failed to display.
Can anyone please kindly advise?
Your help is highly appreciated!Thank you!
Back to top
dreblen
Never Seen the Sunlight


Joined: 14 Jun 2007
Posts: 568
Location: Falun, WI USA

PostPosted: Tue Sep 02, 2008 1:34 pm    Post subject: Reply with quote

if the locale is set to Chinese and you've set up your program for gettext, won't pango do that for you?
http://live.gnome.org/GnomeLove#head-fb30c82ea7fb6a9850b8998ac89d716a9d9b0a84
Back to top
Carol



Joined: 02 Sep 2008
Posts: 2

PostPosted: Wed Sep 03, 2008 9:31 am    Post subject: Reply with quote

Hi Dreblen,
now i can display chinese string!Thanks a lot!
Back to top
gtkguan
Familiar Face


Joined: 07 Jun 2008
Posts: 23
Location: Guangzhou, China

PostPosted: Wed Sep 03, 2008 3:09 pm    Post subject: Reply with quote

you may use g_locale_to_utf8()function, just like this:
first, definite a function:
Code: (C)
1
2
3
4
char *_(char *string)
{
    return(g_locale_to_utf8(string, -1, NULL, NULL, NULL));
}

then, call this function like:
Code: (C)
1
label = gtk_label_new(_("Chinese characters"));

you may refer g_locale_to_utf8 function in GLib Reference Manual.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP