pub struct LineLayout {
pub byte_offsets: Vec<usize>,
pub advances: Vec<f32>,
}Expand description
Per-line byte offsets and cumulative advances (simple fontdue metrics).
Entries represent Unicode scalar boundaries rather than grapheme or shaped
cluster boundaries. Consumers that need ligature-, bidi-, or grapheme-aware
carets should use crate::LaidOutText and crate::caret_rect_at.
§Examples
use ailloli_ui_text::LineLayout;
let layout = LineLayout { byte_offsets: vec![0, 1], advances: vec![0.0, 7.0] };
assert_eq!(layout.width(), 7.0);Fields§
§byte_offsets: Vec<usize>Cumulative advances in pixels after each UTF-8 boundary.
Invariant: byte_offsets.len() == advances.len() and byte_offsets[0] == 0.
advances: Vec<f32>Cumulative logical-pixel advances corresponding one-for-one to byte_offsets.
Implementations§
Source§impl LineLayout
impl LineLayout
Trait Implementations§
Source§impl Clone for LineLayout
impl Clone for LineLayout
Source§fn clone(&self) -> LineLayout
fn clone(&self) -> LineLayout
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LineLayout
impl Debug for LineLayout
Source§impl Default for LineLayout
impl Default for LineLayout
Source§fn default() -> LineLayout
fn default() -> LineLayout
Returns the “default value” for a type. Read more
Source§impl PartialEq for LineLayout
impl PartialEq for LineLayout
impl StructuralPartialEq for LineLayout
Auto Trait Implementations§
impl Freeze for LineLayout
impl RefUnwindSafe for LineLayout
impl Send for LineLayout
impl Sync for LineLayout
impl Unpin for LineLayout
impl UnwindSafe for LineLayout
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