pub struct TextConfig {
pub color: Color,
pub font_asset: Option<&'static FontAsset>,
pub font_size: u16,
pub letter_spacing: u16,
pub line_height: u16,
pub wrap_mode: WrapMode,
pub alignment: AlignX,
/* private fields */
}Expand description
Configuration settings for rendering text elements.
Fields§
§color: ColorThe color of the text.
font_asset: Option<&'static FontAsset>The font asset to use. None means use the default font.
font_size: u16The font size of the text.
letter_spacing: u16The spacing between letters.
line_height: u16The height of each line of text.
wrap_mode: WrapModeDefines the text wrapping behavior.
alignment: AlignXThe alignment of the text.
Implementations§
Source§impl TextConfig
impl TextConfig
Sourcepub fn font(&mut self, asset: &'static FontAsset) -> &mut Self
pub fn font(&mut self, asset: &'static FontAsset) -> &mut Self
Sets the font to use for this text element.
Sourcepub fn letter_spacing(&mut self, spacing: u16) -> &mut Self
pub fn letter_spacing(&mut self, spacing: u16) -> &mut Self
Sets the letter spacing.
Sourcepub fn line_height(&mut self, height: u16) -> &mut Self
pub fn line_height(&mut self, height: u16) -> &mut Self
Sets the line height.
Sourcepub fn effect(
&mut self,
asset: &ShaderAsset,
f: impl FnOnce(&mut ShaderBuilder<'_>),
) -> &mut Self
pub fn effect( &mut self, asset: &ShaderAsset, f: impl FnOnce(&mut ShaderBuilder<'_>), ) -> &mut Self
Adds a per-element shader effect to this text.
Sourcepub fn accessible(&mut self) -> &mut Self
pub fn accessible(&mut self) -> &mut Self
Makes this text element visible to screen readers.
ⓘ
ui.text("Hello world", |t| t.font_size(16).accessible());Trait Implementations§
Source§impl Clone for TextConfig
impl Clone for TextConfig
Source§fn clone(&self) -> TextConfig
fn clone(&self) -> TextConfig
Returns a duplicate 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 TextConfig
impl Debug for TextConfig
Auto Trait Implementations§
impl Freeze for TextConfig
impl RefUnwindSafe for TextConfig
impl Send for TextConfig
impl Sync for TextConfig
impl Unpin for TextConfig
impl UnsafeUnpin for TextConfig
impl UnwindSafe for TextConfig
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