#[repr(transparent)]
pub struct LayoutIter { /* private fields */ }
Expand description

A LayoutIter can be used to iterate over the visual extents of a Layout.

To obtain a LayoutIter, use Layout::iter().

The LayoutIter structure is opaque, and has no user-visible fields.

Implementations

Determines whether @self is on the last line of the layout.

Returns

true if @self is on the last line

Gets the Y position of the current line’s baseline, in layout coordinates.

Layout coordinates have the origin at the top left of the entire layout.

Returns

baseline of current line

Gets the extents of the current character, in layout coordinates.

Layout coordinates have the origin at the top left of the entire layout.

Only logical extents can sensibly be obtained for characters; ink extents make sense only down to the level of clusters.

Returns
logical_rect

rectangle to fill with logical extents

Gets the extents of the current cluster, in layout coordinates.

Layout coordinates have the origin at the top left of the entire layout.

Returns
ink_rect

rectangle to fill with ink extents

logical_rect

rectangle to fill with logical extents

Gets the current byte index.

Note that iterating forward by char moves in visual order, not logical order, so indexes may not be sequential. Also, the index may be equal to the length of the text in the layout, if on the None run (see run()).

Returns

current byte index

Gets the layout associated with a LayoutIter.

Returns

the layout associated with @self

Obtains the extents of the Layout being iterated over.

Returns
ink_rect

rectangle to fill with ink extents

logical_rect

rectangle to fill with logical extents

Gets the current line.

Use the faster line_readonly() if you do not plan to modify the contents of the line (glyphs, glyph widths, etc.).

Returns

the current line

Obtains the extents of the current line.

Extents are in layout coordinates (origin is the top-left corner of the entire Layout). Thus the extents returned by this function will be the same width/height but not at the same x/y as the extents returned from LayoutLine::extents().

Returns
ink_rect

rectangle to fill with ink extents

logical_rect

rectangle to fill with logical extents

Gets the current line for read-only access.

This is a faster alternative to line(), but the user is not expected to modify the contents of the line (glyphs, glyph widths, etc.).

Returns

the current line, that should not be modified

Divides the vertical space in the Layout being iterated over between the lines in the layout, and returns the space belonging to the current line.

A line’s range includes the line’s logical extents. plus half of the spacing above and below the line, if Layout::set_spacing() has been called to set layout spacing. The Y positions are in layout coordinates (origin at top left of the entire layout).

Note: Since 1.44, Pango uses line heights for placing lines, and there may be gaps between the ranges returned by this function.

Returns
y0_

start of line

y1_

end of line

Gets the current run.

When iterating by run, at the end of each line, there’s a position with a None run, so this function can return None. The None run at the end of each line ensures that all lines have at least one run, even lines consisting of only a newline.

Use the faster run_readonly() if you do not plan to modify the contents of the run (glyphs, glyph widths, etc.).

Returns

the current run

Available on crate feature v1_50 only.

Gets the Y position of the current run’s baseline, in layout coordinates.

Layout coordinates have the origin at the top left of the entire layout.

The run baseline can be different from the line baseline, for example due to superscript or subscript positioning.

Gets the extents of the current run in layout coordinates.

Layout coordinates have the origin at the top left of the entire layout.

Returns
ink_rect

rectangle to fill with ink extents

logical_rect

rectangle to fill with logical extents

Gets the current run for read-only access.

When iterating by run, at the end of each line, there’s a position with a None run, so this function can return None. The None run at the end of each line ensures that all lines have at least one run, even lines consisting of only a newline.

This is a faster alternative to run(), but the user is not expected to modify the contents of the run (glyphs, glyph widths, etc.).

Returns

the current run, that should not be modified

Moves @self forward to the next character in visual order.

If @self was already at the end of the layout, returns false.

Returns

whether motion was possible

Moves @self forward to the next cluster in visual order.

If @self was already at the end of the layout, returns false.

Returns

whether motion was possible

Moves @self forward to the start of the next line.

If @self is already on the last line, returns false.

Returns

whether motion was possible

Moves @self forward to the next run in visual order.

If @self was already at the end of the layout, returns false.

Returns

whether motion was possible

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Ensures that the type has been registered with the type system.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.