Struct pango::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.
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<'a>(
ptr: *const *const PangoLayoutIter
) -> &'a Self
pub unsafe fn from_glib_ptr_borrow<'a>( ptr: *const *const PangoLayoutIter ) -> &'a Self
Borrows the underlying C value.
sourcepub unsafe fn from_glib_ptr_borrow_mut<'a>(
ptr: *mut *mut PangoLayoutIter
) -> &'a mut Self
pub unsafe fn from_glib_ptr_borrow_mut<'a>( ptr: *mut *mut PangoLayoutIter ) -> &'a 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)
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
sourcepub fn layout_extents(&mut self) -> (Rectangle, Rectangle)
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
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)
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
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
§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§fn eq(&self, other: &LayoutIter) -> bool
fn eq(&self, other: &LayoutIter) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for LayoutIter
impl PartialOrd for LayoutIter
source§fn partial_cmp(&self, other: &LayoutIter) -> Option<Ordering>
fn partial_cmp(&self, other: &LayoutIter) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StaticType for LayoutIter
impl StaticType for LayoutIter
source§fn static_type() -> Type
fn static_type() -> Type
Self
.