pub struct TextFormat<S>where
S: Scalar,{
pub font_size: u32,
pub just: Justification,
pub line_spacing: S,
pub first_line_indent: usize,
pub lines_indent: usize,
pub color: Color,
pub resize: Resize,
}
Expand description
A format for some text
Fields§
§font_size: u32
The font size
just: Justification
The horizantal justification
line_spacing: S
The spacing between lines. This should usually be somewhere
between 1.0
and 2.0
, but any scalar is valid
first_line_indent: usize
The number of spaces to indent the first line of a paragraph
lines_indent: usize
The number of spaces to indent all lines of a paragraph after the first
color: Color
The color of the text
resize: Resize
The resize strategy
Implementations§
Source§impl<S> TextFormat<S>where
S: Scalar,
impl<S> TextFormat<S>where
S: Scalar,
Sourcepub fn new(font_size: u32) -> TextFormat<S>
pub fn new(font_size: u32) -> TextFormat<S>
Create a default TextFormat
with the given font size
Sourcepub fn line_spacing(self, line_spacing: S) -> Self
pub fn line_spacing(self, line_spacing: S) -> Self
Set the line spacing
Sourcepub fn map_line_spacing<U>(&self) -> TextFormat<U>
pub fn map_line_spacing<U>(&self) -> TextFormat<U>
Changes the type of the line spacing and thus the TextFormat
itself
Sourcepub fn first_line_indent(self, first_line_indent: usize) -> Self
pub fn first_line_indent(self, first_line_indent: usize) -> Self
Set the indentation of the first line
Sourcepub fn lines_indent(self, lines_indent: usize) -> Self
pub fn lines_indent(self, lines_indent: usize) -> Self
Set the indentation of all lines after the first
Sourcepub fn resize_font(self, max_size: u32) -> Self
pub fn resize_font(self, max_size: u32) -> Self
Change the font size depending on the the resize strategy
The given max size is not used if the strategy is Resize::None
Trait Implementations§
Source§impl<S> Clone for TextFormat<S>
impl<S> Clone for TextFormat<S>
Source§fn clone(&self) -> TextFormat<S>
fn clone(&self) -> TextFormat<S>
Returns a copy 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<S> Debug for TextFormat<S>
impl<S> Debug for TextFormat<S>
Source§impl<S> PartialEq for TextFormat<S>
impl<S> PartialEq for TextFormat<S>
Source§impl<S> PartialOrd for TextFormat<S>where
S: Scalar + PartialOrd,
impl<S> PartialOrd for TextFormat<S>where
S: Scalar + PartialOrd,
impl<S> Copy for TextFormat<S>
impl<S> StructuralPartialEq for TextFormat<S>where
S: Scalar,
Auto Trait Implementations§
impl<S> Freeze for TextFormat<S>where
S: Freeze,
impl<S> RefUnwindSafe for TextFormat<S>where
S: RefUnwindSafe,
impl<S> Send for TextFormat<S>where
S: Send,
impl<S> Sync for TextFormat<S>where
S: Sync,
impl<S> Unpin for TextFormat<S>where
S: Unpin,
impl<S> UnwindSafe for TextFormat<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