2.16 <PangoGlyphItemIter>

Structure: <PangoGlyphItemIter>

A <PangoGlyphItemIter> is an iterator over the clusters in a <PangoGlyphItem>.

The forward direction of the iterator is the logical direction of text. That is, with increasing start-index and start-char values. If glyph-item is right-to-left (that is, if glyph_item->item->analysis.level is odd), then start-glyph decreases as the iterator moves forward. Moreover, in right-to-left cases, start-glyph is greater than end-glyph.

An iterator should be initialized using either glyph-item-iter:init-start? or glyph-item-iter:init-end?, for forward and backward iteration respectively, and walked over using any desired mixture of glyph-item-iter:next-cluster? and glyph-item-iter:prev-cluster?.

A common idiom for doing a forward iteration over the clusters is:

PangoGlyphItemIter cluster_iter;
gboolean have_cluster;

for (have_cluster = pango_glyph_item_iter_init_start (&cluster_iter,
                                                      glyph_item, text);
     have_cluster;
     have_cluster = pango_glyph_item_iter_next_cluster (&cluster_iter))
{
  ...
}

Note that text is the start of the text for layout, which is then indexed by glyph_item->item->offset to get to the text of glyph-item. The start-index and end-index values can directly index into text. The start-glyph, end-glyph, start-char, and end-char values however are zero-based for the glyph-item. For each cluster, the item pointed at by the start variables is included in the cluster while the one pointed at by end variables is not.

None of the members of a <PangoGlyphItemIter> should be modified manually.

Fields

glyph-item
text
start-glyph
start-index
start-char
end-glyph
end-index
end-char

Procedures

Method: glyph-item-iter:copy self ⇒ %return
Method: copy self ⇒ %return

Make a shallow copy of an existing <PangoGlyphItemIter> structure.

self

Passed: a <PangoGlyphItemIter>.

a <PangoGlyphItem>Iter

%return

Returned: a <PangoGlyphItemIter>, or #f.

the newly allocated <PangoGlyphItemIter>

Method: glyph-item-iter:free self
Method: free self

Frees a <PangoGlyphItem>Iter.

self

Passed: a <PangoGlyphItemIter>.

a <PangoGlyphItemIter>

Method: glyph-item-iter:init-end? self glyph-item text ⇒ %return
Method: init-end? self glyph-item text ⇒ %return

Initializes a <PangoGlyphItemIter> structure to point to the last cluster in a glyph item.

See <PangoGlyphItemIter> for details of cluster orders.

self

Passed: a <PangoGlyphItemIter>.

a <PangoGlyphItemIter>

glyph-item

Passed: a <PangoGlyphItem>.

the glyph item to iterate over

text

Passed: a string.

text corresponding to the glyph item

%return

Returned: a boolean.

#f if there are no clusters in the glyph item

Method: glyph-item-iter:init-start? self glyph-item text ⇒ %return
Method: init-start? self glyph-item text ⇒ %return

Initializes a <PangoGlyphItemIter> structure to point to the first cluster in a glyph item.

See <PangoGlyphItemIter> for details of cluster orders.

self

Passed: a <PangoGlyphItemIter>.

a <PangoGlyphItemIter>

glyph-item

Passed: a <PangoGlyphItem>.

the glyph item to iterate over

text

Passed: a string.

text corresponding to the glyph item

%return

Returned: a boolean.

#f if there are no clusters in the glyph item

Method: glyph-item-iter:next-cluster? self ⇒ %return
Method: next-cluster? self ⇒ %return

Advances the iterator to the next cluster in the glyph item.

See <PangoGlyphItemIter> for details of cluster orders.

self

Passed: a <PangoGlyphItemIter>.

a <PangoGlyphItemIter>

%return

Returned: a boolean.

#t if the iterator was advanced, #f if we were already on the last cluster.

Method: glyph-item-iter:prev-cluster? self ⇒ %return
Method: prev-cluster? self ⇒ %return

Moves the iterator to the preceding cluster in the glyph item. See <PangoGlyphItemIter> for details of cluster orders.

self

Passed: a <PangoGlyphItemIter>.

a <PangoGlyphItemIter>

%return

Returned: a boolean.

#t if the iterator was moved, #f if we were already on the first cluster.