pub struct WispText {
pub content: String,
pub style: WispTextStyle,
pub position: Vec2,
pub max_width_ndc: Option<f32>,
pub font_family: Option<String>,
}Expand description
User-facing text primitive. Owns content + style + position; the engine + renderer turn it into pixels.
position is the top-left of the layout box in NDC. max_width_ndc
(when Some) wraps the content; None lays out a single line.
Fields§
§content: StringString to render.
style: WispTextStyleStyle.
position: Vec2Top-left of the layout box in NDC.
max_width_ndc: Option<f32>Optional wrap width (NDC). None = single line.
font_family: Option<String>Optional family-name override. None falls back to the
backend’s default sans-serif family. Backends that match by
CSS-style family names (FlexibleText / cosmic-text) honor
this; AtlasText ignores it (single bitmap face).
Implementations§
Source§impl WispText
impl WispText
Sourcepub fn with_style(self, style: WispTextStyle) -> Self
pub fn with_style(self, style: WispTextStyle) -> Self
Builder — set the style.
Sourcepub fn with_position(self, position: Vec2) -> Self
pub fn with_position(self, position: Vec2) -> Self
Builder — set the position.
Sourcepub fn with_wrap(self, max_width_ndc: f32) -> Self
pub fn with_wrap(self, max_width_ndc: f32) -> Self
Builder — enable word-wrapping at a given NDC max width.
Sourcepub fn with_font_family(self, family: impl Into<String>) -> Self
pub fn with_font_family(self, family: impl Into<String>) -> Self
Builder — override the font family by CSS-style family name.
Honored by FlexibleText (cosmic-text); ignored by
AtlasText (single bitmap face). None (the default) falls
back to the backend’s default sans-serif.
Trait Implementations§
impl StructuralPartialEq for WispText
Auto Trait Implementations§
impl Freeze for WispText
impl RefUnwindSafe for WispText
impl Send for WispText
impl Sync for WispText
impl Unpin for WispText
impl UnsafeUnpin for WispText
impl UnwindSafe for WispText
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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