cleverpig | 19 Aug 11:14

How to set GTK for supporting Chinese language?

I got a problem on pike with GTK:it doesn't display Chinese normally.

Example:
I create a window with a Button and a text.
Its function:Changing window's title with text.When it's button was
clicked,window's title would be sync with text's content.
But it doesn't display Chinese.

I think it could be ok that call GTK.set_gtk() with ENV paramters.
And I can find anything about that,please figure out a way for me?!

--

-- 
cleverpig
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
MSN: great_liudan <at> hotmail.com
QQ: 149291732
Skype: cleverpigatmatrix
My Facebook ID:cleverpig
My Blog: www.morpheus.org.cn
My Tags: del.icio.us/cleverpig
My Twitter: twitter.com/cleverpig
My Organization: www.beijing-open-party.org
My Organ <at> Facebook: http://www.facebook.com/group.php?gid=8159558294

Martin Bähr | 19 Aug 12:01

Re: How to set GTK for supporting Chinese language?

On Tue, Aug 19, 2008 at 05:14:55PM +0800, cleverpig wrote:
> I got a problem on pike with GTK:it doesn't display Chinese normally.

can you give us some code example?

greetings, martin.
--

-- 
cooperative communication with sTeam      -     caudium, pike, roxen and unix
offering: programming, training and administration   -  anywhere in the world
--
pike programmer   working in china                      community.gotpike.org
unix system-      iaeste.(tuwien.ac|or).at                     open-steam.org
administrator     caudium.org                                    is.schon.org
Martin Bähr       http://www.iaeste.or.at/~mbaehr/

cleverpig | 20 Aug 05:32

Re: How to set GTK for supporting Chinese language?

Hi,Martin! Thanks for reply my question!

Here is full code:
class gtk_greeting{
	object window;
	object text;
	object button;

	void create(string title,int width,int height){
		GTK.setup_gtk();
		window=GTK.Window(GTK.GDK_WINDOW_TOPLEVEL)
			->realize()
			->set_title(title)
			->set_default_size(width,height);
		text=GTK.Text(GTK.Adjustment(),GTK.Adjustment());
		text->set_text(title)->set_editable(1);
		text->set_usize(280,60);
		button=GTK.Button("change title");
		button->signal_connect("pressed",changeTitle);
		button->set_usize(280,20);
		object vbox=GTK.Vbox(1,10)->add(text)->add(button);
		
		window->add(vbox);
		
		window->show_all();
		window->signal_connect("destroy",exitWindow);
	}
	void changeTitle(){
		window->set_title(text->get_text());
	}
(Continue reading)

cleverpig | 21 Aug 03:34

Re: How to set GTK for supporting Chinese language?

So far,I modified example code with add GTK.parse_rc():it takes a
string and reads it as a gtkrc file.It's possible that my windows is
suck than linux. :(

With input the parameter into GTK.parse_rc() method before calling
GTK.setup_gtk:
style "gtk-default-zh-cn" {
fontset="-adobe-helvetica-medium-r-normal--14-*-*-*-*-*-iso8859-*,-cclib-song-medium-r-normal--14-*-*-*-*-*-gbk-0"
}
class "GtkWidget" style "gtk-default-zh-cn"

But it doesn't work.
On Wed, Aug 20, 2008 at 11:32 AM, cleverpig <greatcleverpig <at> gmail.com> wrote:
> Hi,Martin! Thanks for reply my question!
>
> Here is full code:
> class gtk_greeting{
>        object window;
>        object text;
>        object button;
>
>        void create(string title,int width,int height){
>                GTK.setup_gtk();
>                window=GTK.Window(GTK.GDK_WINDOW_TOPLEVEL)
>                        ->realize()
>                        ->set_title(title)
>                        ->set_default_size(width,height);
>                text=GTK.Text(GTK.Adjustment(),GTK.Adjustment());
>                text->set_text(title)->set_editable(1);
>                text->set_usize(280,60);
(Continue reading)

cleverpig | 21 Aug 03:36

Re: How to set GTK for supporting Chinese language?

Another way,I try to change font with GTK.Style,but there is no method
to set Style's font. :(

On Thu, Aug 21, 2008 at 9:34 AM, cleverpig <greatcleverpig <at> gmail.com> wrote:
> So far,I modified example code with add GTK.parse_rc():it takes a
> string and reads it as a gtkrc file.It's possible that my windows is
> suck than linux. :(
>
> With input the parameter into GTK.parse_rc() method before calling
> GTK.setup_gtk:
> style "gtk-default-zh-cn" {
> fontset="-adobe-helvetica-medium-r-normal--14-*-*-*-*-*-iso8859-*,-cclib-song-medium-r-normal--14-*-*-*-*-*-gbk-0"
> }
> class "GtkWidget" style "gtk-default-zh-cn"
>
> But it doesn't work.
> On Wed, Aug 20, 2008 at 11:32 AM, cleverpig <greatcleverpig <at> gmail.com> wrote:
>> Hi,Martin! Thanks for reply my question!
>>
>> Here is full code:
>> class gtk_greeting{
>>        object window;
>>        object text;
>>        object button;
>>
>>        void create(string title,int width,int height){
>>                GTK.setup_gtk();
>>                window=GTK.Window(GTK.GDK_WINDOW_TOPLEVEL)
>>                        ->realize()
>>                        ->set_title(title)
(Continue reading)

cleverpig | 21 Aug 09:16

Re: How to set GTK for supporting Chinese language?

This problem is sloved in a half process.

After manually setup rc string:

string zh_cn_rc="style \"gtk-default-zh-cn\" {"+
               	" fontset =
\"-*-fixed-medium-r-normal--16-*-*-*-*-*-iso8859-1,-*-simsun-medium-r-normal--16-*-*-*-*-*-gb2312.1980-0\"
}"+
               	" class \"GtkWidget\" style \"gtk-default-zh-cn\"";

And call GTK.parse_rc(zh_cn_rc) before GTK.setup_gtk(),it works for
input Chinese into text.

Here is core code segment:
               ...
               string zh_cn_rc="style \"gtk-default-zh-cn\" {"+
               	" fontset =
\"-*-fixed-medium-r-normal--16-*-*-*-*-*-iso8859-1,-*-simsun-medium-r-normal--16-*-*-*-*-*-gb2312.1980-0\"
}"+
               	" class \"GtkWidget\" style \"gtk-default-zh-cn\"";

               GTK.parse_rc(zh_cn_rc);
               GTK.setup_gtk();
               ...

But a half problem is:
if I change button's label with Chinese or French,it will display unnormally!
such as:
               button=GTK.Button("按钮");
or
(Continue reading)

Re: How to set GTK for supporting Chinese language?

It's good manners to cut out 68 lines of e-mail signature when posting
to this list. 2-3 lines would suffice. Thank you.

Bertrand LUPART | 22 Aug 11:21
Favicon

Re: How to set GTK for supporting Chinese language?

Hello,

Could you paste somewhere your actual source code? Like pastebin.ca or
use git and push to gitorious.org.
I tested your code, but i'm not sure i'm in sync with yours.

From my testing, the text zone seems to stop displaying anything once
there's a non ASCII character, while the title is correctly set:
<http://www.cijoint.fr/cj200808/cij1LBYiKH.png>
Couldn't get any chinese working.

This is on MacOS X 10.4, my GTK/X11 may be old and/or buggy, and i'm
GTK-illiterate.

--

-- 
Bertrand LUPART

http://bertrand.gotpike.org/

cleverpig | 22 Aug 16:29

Re: How to set GTK for supporting Chinese language?

I paste full code:http://pastebin.ca/1181628
In the code,I added GTK.parse_rc(zh_cn_rc) to fix text display.
But I changed button's name in Chinese or French charset,it doesn't
work correctly.Can you try to fix that?

On Fri, Aug 22, 2008 at 5:21 PM, Bertrand LUPART
<bertrand.lupart <at> linkeo.com> wrote:
> Hello,
>
> Could you paste somewhere your actual source code? Like pastebin.ca or
> use git and push to gitorious.org.
> I tested your code, but i'm not sure i'm in sync with yours.
>
> From my testing, the text zone seems to stop displaying anything once
> there's a non ASCII character, while the title is correctly set:
> <http://www.cijoint.fr/cj200808/cij1LBYiKH.png>
> Couldn't get any chinese working.
>
> This is on MacOS X 10.4, my GTK/X11 may be old and/or buggy, and i'm
> GTK-illiterate.
>
> --
> Bertrand LUPART
>
> http://bertrand.gotpike.org/
>
>

--

-- 
cleverpig
(Continue reading)


Gmane