Gtk Label设置字体颜色
GTK label 字体改变方法:
代码
1 /*label*/
2 //lbl_test = gtk_label_new (_("\345\255\227\344\275\223\346\265\213\350\257\225"));
3 lbl_test = gtk_label_new (_("Label Test 测试"));
4 PangoFontDescription *font_desc = pango_font_description_from_string("Sans");
5 pango_font_description_set_size (font_desc, 25 * PANGO_SCALE);
6 gtk_widget_modify_font (lbl_test, font_desc);
7 gdk_color_parse ("red", &color);
8 gtk_widget_modify_fg(lbl_test, GTK_STATE_NORMAL, &color);
9 gtk_widget_show (lbl_test);
10 gtk_box_pack_start (GTK_BOX (vbox1), lbl_test, TRUE, TRUE, 0);
11 /*label end---*/
12
13
14 /*button*/
15 //button1 = gtk_button_new_with_mnemonic (_("button1"));
16 button1 = gtk_button_new_with_label (_("button1"));
17 //button1 = gtk_button_new_from_stock (GTK_STOCK_OK);
18 //button1 = gtk_button_new_from_stock ("lbl_button");
19 //gtk_button_set_use_sto
20
21
2 //lbl_test = gtk_label_new (_("\345\255\227\344\275\223\346\265\213\350\257\225"));
3 lbl_test = gtk_label_new (_("Label Test 测试"));
4 PangoFontDescription *font_desc = pango_font_description_from_string("Sans");
5 pango_font_description_set_size (font_desc, 25 * PANGO_SCALE);
6 gtk_widget_modify_font (lbl_test, font_desc);
7 gdk_color_parse ("red", &color);
8 gtk_widget_modify_fg(lbl_test, GTK_STATE_NORMAL, &color);
9 gtk_widget_show (lbl_test);
10 gtk_box_pack_start (GTK_BOX (vbox1), lbl_test, TRUE, TRUE, 0);
11 /*label end---*/
12
13
14 /*button*/
15 //button1 = gtk_button_new_with_mnemonic (_("button1"));
16 button1 = gtk_button_new_with_label (_("button1"));
17 //button1 = gtk_button_new_from_stock (GTK_STOCK_OK);
18 //button1 = gtk_button_new_from_stock ("lbl_button");
19 //gtk_button_set_use_sto
20
21
字体编码转换:
g_convert("打印", -1, "UTF-8", "GBK", NULL, NULL, NULL);