Changing font of text



Hi all,

I have one small problem.
I'd like to change the font of the text in GtkText widget.

I've test two cases :

1.
  gtk_widget_realize (text);
  gtk_text_insert (GTK_TEXT (text1), NULL, NULL, NULL,text_buffer,size);

2.
font=gdk_font_load("-misc-fixed-medium-r-normal-*-13-*-*-*-c-*-iso8859-2");
 gtk_widget_realize (text);
 gtk_text_insert (GTK_TEXT (text),font,NULL,NULL,text_buffer,size);


To change font of text I use followed code :
  style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (text)));
  gdk_font_unref (style->font);
  style->font = new_font;
  gdk_font_ref (style->font);
  gtk_widget_set_style (text, style);
  gtk_style_unref (style);

In case 1. this code change the font of the text, but in cace 2.
doesn't.
Why ? 

Thank for all your advices.
Michal.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]