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: f32

The leftmost boundary of the text region.

§y: f32

The 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: HorizontalAlign

The default is Left. This option does nothing if the max_width isn’t set.

§vertical_align: VerticalAlign

The default is Top. This option does nothing if the max_height isn’t set.

§line_height: f32

The height of each line as a multiplier of the default.

§wrap_style: WrapStyle

The 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: bool

The 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

source§

fn clone(&self) -> LayoutSettings

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for LayoutSettings

source§

fn default() -> LayoutSettings

Returns the “default value” for a type. Read more
source§

impl PartialEq<LayoutSettings> for LayoutSettings

source§

fn eq(&self, other: &LayoutSettings) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for LayoutSettings

source§

impl StructuralPartialEq for LayoutSettings

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.