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
impl LayoutIter
Sourcepub fn as_ptr(&self) -> *mut PangoLayoutIter
pub fn as_ptr(&self) -> *mut PangoLayoutIter
Return the inner pointer to the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow(ptr: &*mut PangoLayoutIter) -> &Self
pub unsafe fn from_glib_ptr_borrow(ptr: &*mut PangoLayoutIter) -> &Self
Borrows the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow_mut(
ptr: &mut *mut PangoLayoutIter,
) -> &mut Self
pub unsafe fn from_glib_ptr_borrow_mut( ptr: &mut *mut PangoLayoutIter, ) -> &mut Self
Borrows the underlying C value mutably.
Source§impl LayoutIter
impl LayoutIter
Sourcepub fn at_last_line(&mut self) -> bool
pub fn at_last_line(&mut self) -> bool
Sourcepub fn baseline(&mut self) -> i32
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
Sourcepub fn char_extents(&mut self) -> Rectangle
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
Sourcepub fn cluster_extents(&mut self) -> (Rectangle, Rectangle)
pub fn cluster_extents(&mut self) -> (Rectangle, Rectangle)
Sourcepub fn layout_extents(&mut self) -> (Rectangle, Rectangle)
pub fn layout_extents(&mut self) -> (Rectangle, Rectangle)
Sourcepub fn line(&mut self) -> Option<LayoutLine>
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
Sourcepub fn line_extents(&mut self) -> (Rectangle, Rectangle)
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
Sourcepub fn line_readonly(&mut self) -> Option<LayoutLine>
pub fn line_readonly(&mut self) -> Option<LayoutLine>
Sourcepub fn line_yrange(&mut self) -> (i32, i32)
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
Sourcepub fn run(&mut self) -> Option<LayoutRun>
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
Sourcepub fn run_baseline(&mut self) -> i32
Available on crate feature v1_50
only.
pub fn run_baseline(&mut self) -> i32
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.
Sourcepub fn run_extents(&mut self) -> (Rectangle, Rectangle)
pub fn run_extents(&mut self) -> (Rectangle, Rectangle)
Sourcepub fn run_readonly(&mut self) -> Option<LayoutRun>
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
Sourcepub fn next_cluster(&mut self) -> bool
pub fn next_cluster(&mut self) -> bool
Trait Implementations§
Source§impl Clone for LayoutIter
impl Clone for LayoutIter
Source§impl Debug for LayoutIter
impl Debug for LayoutIter
Source§impl From<LayoutIter> for Value
impl From<LayoutIter> for Value
Source§fn from(o: LayoutIter) -> Self
fn from(o: LayoutIter) -> Self
Source§impl HasParamSpec for LayoutIter
impl HasParamSpec for LayoutIter
type ParamSpec = ParamSpecBoxed
Source§type SetValue = LayoutIter
type SetValue = LayoutIter
type BuilderFn = fn(_: &str) -> ParamSpecBoxedBuilder<'_, LayoutIter>
fn param_spec_builder() -> Self::BuilderFn
Source§impl Hash for LayoutIter
impl Hash for LayoutIter
Source§impl Ord for LayoutIter
impl Ord for LayoutIter
Source§fn cmp(&self, other: &LayoutIter) -> Ordering
fn cmp(&self, other: &LayoutIter) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for LayoutIter
impl PartialEq for LayoutIter
Source§impl PartialOrd for LayoutIter
impl PartialOrd for LayoutIter
Source§impl StaticType for LayoutIter
impl StaticType for LayoutIter
Source§fn static_type() -> Type
fn static_type() -> Type
Self
.