pub struct LayoutLine {
pub runs: Vec<PositionedRun>,
pub y: f32,
pub ascent: f32,
pub descent: f32,
pub leading: f32,
pub line_height: f32,
pub width: f32,
pub char_range: Range<usize>,
}Fields§
§runs: Vec<PositionedRun>§y: f32Baseline y relative to block top (set by block layout).
ascent: f32§descent: f32§leading: f32§line_height: f32Total line height: ascent + descent + leading.
width: f32Actual content width (sum of run advances).
char_range: Range<usize>Character range in the block’s text.
Implementations§
Source§impl LayoutLine
impl LayoutLine
Sourcepub fn x_for_offset(&self, offset: usize) -> f32
pub fn x_for_offset(&self, offset: usize) -> f32
Find the x coordinate for a char offset within this line.
Builds the line’s caret stops (logical_offset, x) in visual
order — direction-aware, so an RTL run’s caret for its lowest
offset sits at its rightmost edge — then returns the x of the stop
matching offset (nearest by offset if there’s no exact match).
Trait Implementations§
Source§impl Clone for LayoutLine
impl Clone for LayoutLine
Source§fn clone(&self) -> LayoutLine
fn clone(&self) -> LayoutLine
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LayoutLine
impl RefUnwindSafe for LayoutLine
impl Send for LayoutLine
impl Sync for LayoutLine
impl Unpin for LayoutLine
impl UnsafeUnpin for LayoutLine
impl UnwindSafe for LayoutLine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more