pub struct Builder {
pub line_spacing: Option<Scalar>,
pub line_wrap: Option<Option<Wrap>>,
pub font_size: Option<FontSize>,
pub justify: Option<Justify>,
pub font: Option<Option<Font>>,
pub y_align: Option<Align>,
}
Expand description
A context for building a text layout.
Fields§
§line_spacing: Option<Scalar>
§line_wrap: Option<Option<Wrap>>
§font_size: Option<FontSize>
§justify: Option<Justify>
§font: Option<Option<Font>>
§y_align: Option<Align>
Implementations§
source§impl Builder
impl Builder
sourcepub fn line_wrap(self, line_wrap: Option<Wrap>) -> Self
pub fn line_wrap(self, line_wrap: Option<Wrap>) -> Self
Specify whether or not text should be wrapped around some width and how to do so.
The default value is DEFAULT_LINE_WRAP
.
sourcepub fn no_line_wrap(self) -> Self
pub fn no_line_wrap(self) -> Self
Specify that the Text should not wrap lines around the width.
Shorthand for builder.line_wrap(None)
.
sourcepub fn wrap_by_word(self) -> Self
pub fn wrap_by_word(self) -> Self
Line wrap the Text at the beginning of the first word that exceeds the width.
Shorthand for builder.line_wrap(Some(Wrap::Whitespace))
.
sourcepub fn wrap_by_character(self) -> Self
pub fn wrap_by_character(self) -> Self
Line wrap the Text at the beginning of the first character that exceeds the width.
Shorthand for builder.line_wrap(Some(Wrap::Character))
.
sourcepub fn font(self, font: Font) -> Self
pub fn font(self, font: Font) -> Self
A method for specifying the Font
used for displaying the Text
.
sourcepub fn justify(self, justify: Justify) -> Self
pub fn justify(self, justify: Justify) -> Self
Describe the end along the x axis to which the text should be aligned.
sourcepub fn left_justify(self) -> Self
pub fn left_justify(self) -> Self
Align the text to the left of its bounding Rect’s x axis range.
sourcepub fn center_justify(self) -> Self
pub fn center_justify(self) -> Self
Align the text to the middle of its bounding Rect’s x axis range.
sourcepub fn right_justify(self) -> Self
pub fn right_justify(self) -> Self
Align the text to the right of its bounding Rect’s x axis range.
sourcepub fn line_spacing(self, spacing: Scalar) -> Self
pub fn line_spacing(self, spacing: Scalar) -> Self
Specify how much vertical space should separate each line of text.
sourcepub fn y_align(self, align: Align) -> Self
pub fn y_align(self, align: Align) -> Self
Specify how the whole text should be aligned along the y axis of its bounding rectangle
sourcepub fn align_top(self) -> Self
pub fn align_top(self) -> Self
Align the top edge of the text with the top edge of its bounding rectangle.
sourcepub fn align_middle_y(self) -> Self
pub fn align_middle_y(self) -> Self
Align the middle of the text with the middle of the bounding rect along the y axis..
This is the default behaviour.
sourcepub fn align_bottom(self) -> Self
pub fn align_bottom(self) -> Self
Align the bottom edge of the text with the bottom edge of its bounding rectangle.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
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, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
source§fn convert_into(self) -> U
fn convert_into(self) -> U
source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains the unclamped color. Read more