[]Struct pango::GlyphItemIter

pub struct GlyphItemIter(_);

A GlyphItemIter is an iterator over the clusters in a GlyphItem. The <firstterm>forward direction</firstterm> 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 <literal>``glyph_item->item->analysis.level</literal> 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 of GlyphItemIter::init_start and GlyphItemIter::init_end, for forward and backward iteration respectively, and walked over using any desired mixture of GlyphItemIter::next_cluster and GlyphItemIter::prev_cluster. A common idiom for doing a forward iteration over the clusters is: <programlisting> 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)) { ... } </programlisting>

Note that text is the start of the text for layout, which is then indexed by <literal>``glyph_item->item->offset</literal> 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 GlyphItemIter should be modified manually.

Implementations

impl GlyphItemIter[src]

pub fn init_end(&mut self, glyph_item: &mut GlyphItem, text: &str) -> bool[src]

Initializes a GlyphItemIter structure to point to the last cluster in a glyph item. See GlyphItemIter for details of cluster orders.

glyph_item

the glyph item to iterate over

text

text corresponding to the glyph item

Returns

false if there are no clusters in the glyph item

pub fn init_start(&mut self, glyph_item: &mut GlyphItem, text: &str) -> bool[src]

Initializes a GlyphItemIter structure to point to the first cluster in a glyph item. See GlyphItemIter for details of cluster orders.

glyph_item

the glyph item to iterate over

text

text corresponding to the glyph item

Returns

false if there are no clusters in the glyph item

pub fn next_cluster(&mut self) -> bool[src]

Advances the iterator to the next cluster in the glyph item. See GlyphItemIter for details of cluster orders.

Returns

true if the iterator was advanced, false if we were already on the last cluster.

pub fn prev_cluster(&mut self) -> bool[src]

Moves the iterator to the preceding cluster in the glyph item. See GlyphItemIter for details of cluster orders.

Returns

true if the iterator was moved, false if we were already on the first cluster.

Trait Implementations

impl Clone for GlyphItemIter

impl Debug for GlyphItemIter[src]

impl Eq for GlyphItemIter[src]

impl Hash for GlyphItemIter[src]

impl Ord for GlyphItemIter[src]

impl PartialEq<GlyphItemIter> for GlyphItemIter[src]

impl PartialOrd<GlyphItemIter> for GlyphItemIter[src]

impl StaticType for GlyphItemIter

impl StructuralEq for GlyphItemIter[src]

impl StructuralPartialEq for GlyphItemIter[src]

Auto Trait Implementations

impl RefUnwindSafe for GlyphItemIter

impl !Send for GlyphItemIter

impl !Sync for GlyphItemIter

impl Unpin for GlyphItemIter

impl UnwindSafe for GlyphItemIter

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.