pub struct SimpleLayouter {
pub flow_direction: FlowDirection,
}Expand description
Simple layouter that supports both horizontal (LTR) and vertical flow.
For horizontal flow, advances a cursor left-to-right, emitting a
PositionedGlyph for each input glyph and wrapping when the cursor
exceeds max_width.
For vertical flow, advances the cursor top-to-bottom using each glyph’s
y_advance (falling back to x_advance when y_advance is zero), and
wraps into a new column when max_width (treated as max column height) is
exceeded.
Fields§
§flow_direction: FlowDirectionText flow direction for this layouter instance.
Implementations§
Source§impl SimpleLayouter
impl SimpleLayouter
Sourcepub fn with_flow_direction(self, dir: FlowDirection) -> Self
pub fn with_flow_direction(self, dir: FlowDirection) -> Self
Returns a copy of this layouter with the given flow direction.
Sourcepub fn layout(
&self,
runs: &[ShapedRun],
constraints: &LayoutConstraints,
) -> Result<Vec<PositionedGlyph>, OxiTextError>
pub fn layout( &self, runs: &[ShapedRun], constraints: &LayoutConstraints, ) -> Result<Vec<PositionedGlyph>, OxiTextError>
Positions glyphs from the shaped runs according to constraints.
Dispatches to Self::layout_horizontal or Self::layout_vertical
based on Self::flow_direction.
§Errors
Currently infallible; returns Err only for forward compatibility.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SimpleLayouter
impl RefUnwindSafe for SimpleLayouter
impl Send for SimpleLayouter
impl Sync for SimpleLayouter
impl Unpin for SimpleLayouter
impl UnsafeUnpin for SimpleLayouter
impl UnwindSafe for SimpleLayouter
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
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>
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>
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