Re: Can't find the list of all tags



Vivien,

On Sat, Dec 10, 2011 at 2:02 AM, Vivien Malerba <vmalerba gmail com> wrote:
>
>
> On 10 December 2011 01:33, Igor Korot <ikorot01 gmail com> wrote:
>>
>> Hi, ALL,
>> I am looking at the documentation for the gtk_text_buffer_create_tag().at
>>
>> http://developer.gnome.org/gtk/2.24/GtkTextBuffer.html#gtk-text-buffer-create-tag.
>>
>> Unfortunately it does not mention where I can get a list of all
>> predefined tag available.
>
>
> IFAIK there is any list of predefined tags. You have to define your own tags
> before you can use them.
>
>>
>>
>> I am also looking at some code where I see this:
>>
>>
>> g_snprintf(buf, sizeof(buf), "UNDERLINE");
>> tag = gtk_text_tag_table_lookup( gtk_text_buffer_get_tag_table(
>> text_buffer ), buf );
>> if (!tag)
>>    tag = gtk_text_buffer_create_tag( text_buffer, buf,
>> "underline-set", TRUE, "underline", PANGO_UNDERLINE_SINGLE,  NULL );
>> gtk_text_buffer_apply_tag (text_buffer, tag, start, end);
>>
>> This code will make the text underlined.
>>
>> I need the code to make it a strikethrough. I tried the following:
>>
>>            g_snprintf(buf, sizeof(buf), "STRIKETHROUGH");
>>            tag = gtk_text_tag_table_lookup(
>> gtk_text_buffer_get_tag_table( text_buffer ),
>>                                             buf );
>>            if (!tag)
>>                tag = gtk_text_buffer_create_tag( text_buffer, buf,
>>                                                  "strikethrough-set",
>> TRUE,
>>                                                  "strikethrough",
>> PANGO_ATTR_STRIKETHROUGH,
>>                                                  NULL );
>>            gtk_text_buffer_apply_tag (text_buffer, tag, start, end);
>>
>> but it does not work.
>
>
> From this code snipet it's difficult to tell as there is no information as
> how the "start" and "end" iterators are defined; you need to put one iter
> before the text to apply the tage to, and one iter after. Also, the
> "strikethrough" property is meant to be a boolean, see
> http://developer.gnome.org/gtk3/stable/GtkTextTag.html#GtkTextTag--strikethrough.

I changed my code to read:

            g_snprintf(buf, sizeof(buf), "STRIKETHROUGH");
            tag = gtk_text_tag_table_lookup(
gtk_text_buffer_get_tag_table( text_buffer ),  buf );
            if (!tag)
                tag = gtk_text_buffer_create_tag( text_buffer, buf,
"strikethrough-set", TRUE,
     "strikethrough", true,  NULL );
            gtk_text_buffer_apply_tag (text_buffer, tag, start, end);

but still nothing. I will try to debug...

Thank you. for the hint

>
> Regards,
>
> Vivien


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