Re: How to make an attribute list?
- From: Simon Sapin <simon sapin exyr org>
- To: gtk-i18n-list gnome org
- Subject: Re: How to make an attribute list?
- Date: Mon, 15 Apr 2013 11:02:14 +0200
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]