Re: Use tags in gtktextview



Le dimanche 03 juillet 2005 à 12:01 +0800, 顺珉 吴 a écrit :
> Hi all:
> I try to use Gtktags to change fonts in a gtktextview.
> Here is my code:
> 
> textview1 = gtk_text_view_new ();
> gtk_widget_set_name (textview1, "textview1");
> gtk_text_buffer_set_text (gtk_text_view_get_buffer
> (GTK_TEXT_VIEW (textview1)), _("some text"), -1);
>   
> text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW
> (textview1));
> tag = gtk_text_buffer_create_tag(text_buffer,
> "myprop", /* "size", 16,*/ "weight",
> PANGO_WEIGHT_BOLD, NULL);
>   
> gtk_text_buffer_get_start_iter(text_buffer, 
> &start_iter);
> gtk_text_buffer_get_start_iter(text_buffer, 
> &end_iter);
> gtk_text_buffer_apply_tag(text_buffer, tag,
> &start_iter, &end_iter);
> gtk_widget_show (textview1);
> 
> I find both the "size" and the "weight" property does
> not effect on the text.
> Is there any mistakes? 

gtk_text_buffer_get_end_iter(text_buffer, &end_iter);
otherwise, the tag is applied for 0 characters and have no visible
effect.




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