Re: How to make an attribute list?
- From: Ken Resander <kresander yahoo com>
- To: Simon Sapin <simon sapin exyr org>
- Cc: "gtk-i18n-list gnome org" <gtk-i18n-list gnome org>
- Subject: Re: How to make an attribute list?
- Date: Mon, 15 Apr 2013 22:53:29 -0700 (PDT)
Hi Simon,
Many thanks for letting me know that pango_attribute_init is not needed for setting up the attribute list (at my level). I just could not see how to use it and why it would be needed, but I thought it was just me not understanding being a cairo/pango newbie.
The style changes collected by my program can be handled trivially by pango_attribute_xxx_new calls. Great news! And everything I tried worked very well.
So, I am going to use pango for text-in-box.
Ken
From: Simon Sapin <simon sapin exyr org>
To: gtk-i18n-list gnome org
Sent: Monday, 15 April 2013, 10:02
Subject: Re: How to make an attribute list?
Le 15/04/2013 10:57, Simon Sapin a écrit :
> Le 14/04/2013 10:50, Ken Resander a écrit :
>> > //pango_attribute_init (???); // do I have to use this? how?
>> > a = pango_attr_foreground_new(sv->txtcol.r, sv->txtcol.g,
>> >sv->txtcol.b );
>> > a->klass.type = PANGO_ATTR_FOREGROUND ; // compiler
>> >complains about this
>> >
a->start_index = sv->offset;
>> > a->end_index = a->start_index + sv->len;
>> > pango_attr_list_insert(al, a);
> The pango_attr_*_new() functions return an attribute that is already
> initialized, so you don’t need to call pango_attribute_init() or set the
> class type.
>
> Of the 6 quoted lines, you only need the second (the one with
> pango_attr_foreground_new().)
Sorry, that last sentence is wrong.
After calling pango_attr_foreground_new() you can set the start_index and end_index (they default to the covering the whole paragraph.) Then you need to insert the attribute into the list, but you don’t need to call init() or set the class (this is done by new())
-- Simon
Sapin
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list gnome orghttps://mail.gnome.org/mailman/listinfo/gtk-i18n-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]