pub struct LayoutSettings {
pub x: f32,
pub y: f32,
pub max_width: Option<f32>,
pub max_height: Option<f32>,
pub horizontal_align: HorizontalAlign,
pub vertical_align: VerticalAlign,
pub line_height: f32,
pub wrap_style: WrapStyle,
pub wrap_hard_breaks: bool,
}Expand description
Settings to configure how text layout is constrained. Text layout is considered best effort and layout may violate the constraints defined here if they prevent text from being laid out.
Fields§
§x: f32The leftmost boundary of the text region.
y: f32The topmost boundary of the text region.
max_width: Option<f32>An optional rightmost boundary on the text region. A line of text that exceeds the max_width is wrapped to the line below. If the width of a glyph is larger than the max_width, the glyph will overflow past the max_width. The application is responsible for handling the overflow.
max_height: Option<f32>An optional bottom boundary on the text region. This is used for positioning the vertical_align option. Text that exceeds the defined max_height will overflow past it. The application is responsible for handling the overflow.
horizontal_align: HorizontalAlignThe default is Left. This option does nothing if the max_width isn’t set.
vertical_align: VerticalAlignThe default is Top. This option does nothing if the max_height isn’t set.
line_height: f32The height of each line as a multiplier of the default.
wrap_style: WrapStyleThe default is Word. Wrap style is a hint for how strings of text should be wrapped to the next line. Line wrapping can happen when the max width/height is reached.
wrap_hard_breaks: boolThe default is true. This option enables hard breaks, like new line characters, to prematurely wrap lines. If false, hard breaks will not prematurely create a new line.
Trait Implementations§
Source§impl Clone for LayoutSettings
impl Clone for LayoutSettings
Source§fn clone(&self) -> LayoutSettings
fn clone(&self) -> LayoutSettings
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for LayoutSettings
impl Default for LayoutSettings
Source§fn default() -> LayoutSettings
fn default() -> LayoutSettings
Source§impl PartialEq for LayoutSettings
impl PartialEq for LayoutSettings
impl Copy for LayoutSettings
impl StructuralPartialEq for LayoutSettings
Auto Trait Implementations§
impl Freeze for LayoutSettings
impl RefUnwindSafe for LayoutSettings
impl Send for LayoutSettings
impl Sync for LayoutSettings
impl Unpin for LayoutSettings
impl UnwindSafe for LayoutSettings
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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> ⓘ
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> ⓘ
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<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().