pub struct RichText<S> {
pub spans: S,
pub align: TextAlign,
}Expand description
An element for displaying text with mixed fonts, sizes, colors, etc.
Note: Newline characters belong to both the line they end and the next line. So if you have a newline character at the end of a span with a larger font than the next one, the line after the one terminated by the newline will have at least the height of the larger font as well (it could also be more depending on where the fonts baselines are). This behavior also means that if there are no more spans after one terminated by a newline, the empty line at the end will have the height of the font of the span containing the newline.
Fields§
§spans: S§align: TextAlignTrait Implementations§
Source§impl<'a, F: Font + 'a, S: Iterator<Item = Span<'a, F>> + Clone> Element for RichText<S>
impl<'a, F: Font + 'a, S: Iterator<Item = Span<'a, F>> + Clone> Element for RichText<S>
fn first_location_usage( &self, ctx: FirstLocationUsageCtx<'_>, ) -> FirstLocationUsage
fn measure(&self, ctx: MeasureCtx<'_>) -> ElementSize
fn draw(&self, ctx: DrawCtx<'_, '_>) -> ElementSize
fn with_padding_top(self, padding: f32) -> Padding<Self>where
Self: Sized,
fn with_vertical_padding(self, padding: f32) -> Padding<Self>where
Self: Sized,
fn debug(self, color: u8) -> Debug<Self>where
Self: Sized,
Auto Trait Implementations§
impl<S> Freeze for RichText<S>where
S: Freeze,
impl<S> RefUnwindSafe for RichText<S>where
S: RefUnwindSafe,
impl<S> Send for RichText<S>where
S: Send,
impl<S> Sync for RichText<S>where
S: Sync,
impl<S> Unpin for RichText<S>where
S: Unpin,
impl<S> UnwindSafe for RichText<S>where
S: UnwindSafe,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.