pango

Struct LayoutIter

Source
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.

GLib type: Boxed type with copy-on-clone semantics.

Implementations§

Source§

impl LayoutIter

Source

pub fn as_ptr(&self) -> *mut PangoLayoutIter

Return the inner pointer to the underlying C value.

Source

pub unsafe fn from_glib_ptr_borrow(ptr: &*mut PangoLayoutIter) -> &Self

Borrows the underlying C value.

Source

pub unsafe fn from_glib_ptr_borrow_mut( ptr: &mut *mut PangoLayoutIter, ) -> &mut Self

Borrows the underlying C value mutably.

Source§

impl LayoutIter

Source

pub fn at_last_line(&mut self) -> bool

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

§Returns

true if @self is on the last line

Source

pub fn baseline(&mut self) -> i32

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

Source

pub fn char_extents(&mut self) -> Rectangle

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

Source

pub fn cluster_extents(&mut self) -> (Rectangle, Rectangle)

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

Source

pub fn index(&mut self) -> i32

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

Source

pub fn layout(&mut self) -> Option<Layout>

Gets the layout associated with a LayoutIter.

§Returns

the layout associated with @self

Source

pub fn layout_extents(&mut self) -> (Rectangle, Rectangle)

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

Source

pub fn line(&mut self) -> Option<LayoutLine>

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

Source

pub fn line_extents(&mut self) -> (Rectangle, Rectangle)

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

Source

pub fn line_readonly(&mut self) -> Option<LayoutLine>

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

Source

pub fn line_yrange(&mut self) -> (i32, i32)

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

Source

pub fn run(&mut self) -> Option<LayoutRun>

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

Source

pub fn run_baseline(&mut self) -> i32

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.

Source

pub fn run_extents(&mut self) -> (Rectangle, Rectangle)

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

Source

pub fn run_readonly(&mut self) -> Option<LayoutRun>

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

Source

pub fn next_char(&mut self) -> bool

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

Source

pub fn next_cluster(&mut self) -> bool

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

Source

pub fn next_line(&mut self) -> bool

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

Source

pub fn next_run(&mut self) -> bool

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§

Source§

impl Clone for LayoutIter

Source§

fn clone(&self) -> Self

Copies the boxed type with the type-specific copy function.

1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LayoutIter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<LayoutIter> for Value

Source§

fn from(o: LayoutIter) -> Self

Converts to this type from the input type.
Source§

impl HasParamSpec for LayoutIter

Source§

type ParamSpec = ParamSpecBoxed

Source§

type SetValue = LayoutIter

Preferred value to be used as setter for the associated ParamSpec.
Source§

type BuilderFn = fn(_: &str) -> ParamSpecBoxedBuilder<'_, LayoutIter>

Source§

fn param_spec_builder() -> Self::BuilderFn

Source§

impl Hash for LayoutIter

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

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

impl Ord for LayoutIter

Source§

fn cmp(&self, other: &LayoutIter) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for LayoutIter

Source§

fn eq(&self, other: &LayoutIter) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for LayoutIter

Source§

fn partial_cmp(&self, other: &LayoutIter) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StaticType for LayoutIter

Source§

fn static_type() -> Type

Returns the type identifier of Self.
Source§

impl Eq for LayoutIter

Source§

impl StructuralPartialEq for LayoutIter

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoClosureReturnValue for T
where T: Into<Value>,

Source§

impl<T> Property for T
where T: HasParamSpec,

Source§

type Value = T

Source§

impl<T> PropertyGet for T
where T: HasParamSpec,

Source§

type Value = T

Source§

fn get<R, F>(&self, f: F) -> R
where F: Fn(&<T as PropertyGet>::Value) -> R,

Source§

impl<T> StaticTypeExt for T
where T: StaticType,

Source§

fn ensure_type()

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

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> TransparentType for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T> TryFromClosureReturnValue for T
where T: for<'a> FromValue<'a> + StaticType + 'static,

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<'a, T, C, E> FromValueOptional<'a> for T
where T: FromValue<'a, Checker = C>, C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError<E>>, E: Error + Send + 'static,