Struct pane::TextFormat
source · 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
sourceimpl<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>where
U: Scalar + From<S>,
pub fn map_line_spacing<U>(&self) -> TextFormat<U>where
U: Scalar + From<S>,
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
sourceimpl<S: Clone> Clone for TextFormat<S>where
S: Scalar,
impl<S: Clone> Clone for TextFormat<S>where
S: Scalar,
sourcefn clone(&self) -> TextFormat<S>
fn clone(&self) -> TextFormat<S>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<S: Debug> Debug for TextFormat<S>where
S: Scalar,
impl<S: Debug> Debug for TextFormat<S>where
S: Scalar,
sourceimpl<S: PartialEq> PartialEq<TextFormat<S>> for TextFormat<S>where
S: Scalar,
impl<S: PartialEq> PartialEq<TextFormat<S>> for TextFormat<S>where
S: Scalar,
sourcefn eq(&self, other: &TextFormat<S>) -> bool
fn eq(&self, other: &TextFormat<S>) -> bool
sourceimpl<S: PartialOrd> PartialOrd<TextFormat<S>> for TextFormat<S>where
S: Scalar,
impl<S: PartialOrd> PartialOrd<TextFormat<S>> for TextFormat<S>where
S: Scalar,
sourcefn partial_cmp(&self, other: &TextFormat<S>) -> Option<Ordering>
fn partial_cmp(&self, other: &TextFormat<S>) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<S: Copy> Copy for TextFormat<S>where
S: Scalar,
impl<S> StructuralPartialEq for TextFormat<S>where
S: Scalar,
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
Sets
value
as a parameter of self
.