2.6 <PangoAttrIterator>

Structure: <PangoAttrIterator>

A <PangoAttrIterator> is used to iterate through a <PangoAttrList>.

A new iterator is created with attr-list:get-iterator. Once the iterator is created, it can be advanced through the style changes in the text using attr-iterator:next?. At each style change, the range of the current style segment and the attributes currently in effect can be queried.

Procedures

Method: attr-iterator:copy self ⇒ %return
Method: copy self ⇒ %return

Copy a <PangoAttrIterator>.

self

Passed: a <PangoAttrIterator>.

a <PangoAttrIterator>

%return

Returned: a <PangoAttrIterator>.

the newly allocated <PangoAttrIterator>, which should be freed with attr-iterator:destroy

Method: attr-iterator:destroy self
Method: destroy self

Destroy a <PangoAttrIterator> and free all associated memory.

self

Passed: a <PangoAttrIterator>.

a <PangoAttrIterator>

Method: attr-iterator:get self type ⇒ %return
Method: get self type ⇒ %return

Find the current attribute of a particular type at the iterator location.

When multiple attributes of the same type overlap, the attribute whose range starts closest to the current location is used.

self

Passed: a <PangoAttrIterator>.

a <PangoAttrIterator>

type

Passed: a <PangoAttrType>, or one of its symbols.

the type of attribute to find

%return

Returned: a <PangoAttribute>, or #f.

the current attribute of the given type, or #f if no attribute of that type applies to the current location.

Method: attr-iterator:get-attrs self ⇒ %return
Method: get-attrs self ⇒ %return

Gets a list of all attributes at the current position of the iterator.

self

Passed: a <PangoAttrIterator>.

a <PangoAttrIterator>

%return

Returned: a list, each a <PangoAttribute>.

a list of all attributes for the current range. To free this value, call attribute:destroy on each value and g_slist_free() on the list.

Method: attr-iterator:get-font self desc ⇒ language extra-attrs
Method: get-font self desc ⇒ language extra-attrs

Get the font and other attributes at the current iterator position.

self

Passed: a <PangoAttrIterator>.

a <PangoAttrIterator>

desc

Passed: a <PangoFontDescription>.

a <PangoFontDescription> to fill in with the current values. The family name in this structure will be set using font-description:set-family-static using values from an attribute in the <PangoAttrList> associated with the iterator, so if you plan to keep it around, you must call: pango_font_description_set_family (desc, pango_font_description_get_family (desc)).

language

Returned: a <PangoLanguage>.

location to store language tag for item, or #f if none is found.

extra-attrs

Returned: a list, each a <PangoAttribute>.

location in which to store a list of non-font attributes at the the current position; only the highest priority value of each attribute will be added to this list. In order to free this value, you must call attribute:destroy on each member.

Method: attr-iterator:next? self ⇒ %return
Method: next? self ⇒ %return

Advance the iterator until the next change of style.

self

Passed: a <PangoAttrIterator>.

a <PangoAttrIterator>

%return

Returned: a boolean.

#f if the iterator is at the end of the list, otherwise #t

Method: attr-iterator:range self ⇒ start end
Method: range self ⇒ start end

Get the range of the current segment.

Note that the stored return values are signed, not unsigned like the values in <PangoAttribute>. To deal with this API oversight, stored return values that wouldn’t fit into a signed integer are clamped to G_MAXINT.

self

Passed: a <PangoAttrIterator>.

a PangoAttrIterator

start

Returned: a 32-bit integer.

location to store the start of the range

end

Returned: a 32-bit integer.

location to store the end of the range