pub struct InlineLayoutContext {
pub available_width: Length,
pub current_x: Length,
pub line_height: Length,
pub inline_areas: Vec<InlineArea>,
pub text_align: TextAlign,
pub letter_spacing: Length,
pub word_spacing: Length,
}Expand description
Inline layout context for a single line
Fields§
§available_width: LengthAvailable width for the line
current_x: LengthCurrent X position (advances as content is added)
line_height: LengthLine height (from line-height property or font metrics)
inline_areas: Vec<InlineArea>Areas in this line
text_align: TextAlignText alignment
letter_spacing: LengthLetter spacing to apply between characters
word_spacing: LengthWord spacing to apply between words
Implementations§
Source§impl InlineLayoutContext
impl InlineLayoutContext
Sourcepub fn new(available_width: Length, line_height: Length) -> Self
pub fn new(available_width: Length, line_height: Length) -> Self
Create a new inline layout context
Sourcepub fn with_text_align(self, align: TextAlign) -> Self
pub fn with_text_align(self, align: TextAlign) -> Self
Set text alignment
Sourcepub fn with_letter_spacing(self, spacing: Length) -> Self
pub fn with_letter_spacing(self, spacing: Length) -> Self
Set letter spacing
Sourcepub fn with_word_spacing(self, spacing: Length) -> Self
pub fn with_word_spacing(self, spacing: Length) -> Self
Set word spacing
Sourcepub fn add(&mut self, area: InlineArea) -> bool
pub fn add(&mut self, area: InlineArea) -> bool
Add an inline area to the line
Sourcepub fn remaining_width(&self) -> Length
pub fn remaining_width(&self) -> Length
Get the remaining width on this line
Sourcepub fn used_width(&self) -> Length
pub fn used_width(&self) -> Length
Get the total width used
Sourcepub fn calculate_alignment_offset(&self) -> Length
pub fn calculate_alignment_offset(&self) -> Length
Calculate the starting X offset for aligned content
Sourcepub fn apply_alignment(&mut self)
pub fn apply_alignment(&mut self)
Apply text alignment to all areas in the line
Auto Trait Implementations§
impl Freeze for InlineLayoutContext
impl RefUnwindSafe for InlineLayoutContext
impl Send for InlineLayoutContext
impl Sync for InlineLayoutContext
impl Unpin for InlineLayoutContext
impl UnsafeUnpin for InlineLayoutContext
impl UnwindSafe for InlineLayoutContext
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more