zng_ext_font

Type Alias TabLength

Source
pub type TabLength = Length;
Expand description

Length of a TAB space.

Relative lengths are computed from the normal space character “advance” plus the WordSpacing. So a 200% length is 2 spaces.

The Default value is 400.pct(), 4 spaces.

Aliased Type§

enum TabLength {
Show 15 variants Default, Dip(Dip), Px(Px), Pt(f32), Factor(Factor), Leftover(Factor), Em(Factor), RootEm(Factor), ViewportWidth(Factor), ViewportHeight(Factor), ViewportMin(Factor), ViewportMax(Factor), DipF32(f32), PxF32(f32), Expr(Box<LengthExpr>),
}

Variants§

§

Default

The default (initial) value.

§

Dip(Dip)

The exact length in device independent units.

§

Px(Px)

The exact length in device pixel units.

§

Pt(f32)

The exact length in font points.

§

Factor(Factor)

Relative to the fill length.

§

Leftover(Factor)

Relative to the leftover fill length.

§

Em(Factor)

Relative to the font-size of the widget.

§

RootEm(Factor)

Relative to the font-size of the root widget.

§

ViewportWidth(Factor)

Relative to the width of the nearest viewport ancestor.

§

ViewportHeight(Factor)

Relative to the height of the nearest viewport ancestor.

§

ViewportMin(Factor)

Relative to the smallest of the nearest viewport ancestor’s dimensions.

§

ViewportMax(Factor)

Relative to the smallest of the nearest viewport ancestor’s dimensions.

§

DipF32(f32)

The exact length in device independent units, defined using a f32 value.

This value will be rounded to the nearest pixel after layout, but it will be used as is in the evaluation of length expressions.

§

PxF32(f32)

The exact length in device pixel units, defined using a f32 value.

This value will be rounded to the nearest pixel after layout, but it will be used as is in the evaluation of length expressions.

§

Expr(Box<LengthExpr>)

Expression.

Implementations

Source§

impl Length

Source

pub const fn zero() -> Length

Length of exact zero.

Source

pub const fn fill() -> Length

Length that fills the available space.

Source

pub const fn half() -> Length

Length that fills 50% of the available space.

Source

pub fn max(&self, other: impl Into<Length>) -> Length

Returns a length that resolves to the maximum layout length between self and other.

Source

pub fn min(&self, other: impl Into<Length>) -> Length

Returns a length that resolves to the minimum layout length between self and other.

Source

pub fn clamp(&self, min: impl Into<Length>, max: impl Into<Length>) -> Length

Returns a length that constraints the computed layout length between min and max.

Source

pub fn abs(&self) -> Length

Returns a length that computes the absolute layout length of self.

Source

pub fn is_zero(&self) -> Option<bool>

If this length is zero in any finite layout context.

Returns None if the value depends on the default value.

Source

pub fn pt_to_px(pt: f32, scale_factor: Factor) -> Px

Convert a pt unit value to Px given a scale_factor.

Source

pub fn pt_to_px_f32(pt: f32, scale_factor: Factor) -> f32

Same operation as pt_to_px but without rounding to nearest pixel.

Source

pub fn px_to_pt(px: Px, scale_factor: Factor) -> f32

Convert a Px unit value to a Pt value given a scale_factor.

Source

pub fn is_default(&self) -> bool

Source

pub fn replace_default(&mut self, overwrite: &Length)

Replaces self with overwrite if self is Default.

Source

pub fn round_exact(&mut self)

Convert PxF32 to Px and DipF32 to Dip.

Source

pub fn memory_used(&self) -> ByteLength

Gets the total memory allocated by this length.

This includes the sum of all nested Length::Expr heap memory.

Source

pub fn heap_memory_used(&self) -> ByteLength

Sum total memory used in nested Length::Expr heap memory.

Trait Implementations

Source§

impl<L> Add<L> for Length
where L: Into<Length>,

Source§

type Output = Length

The resulting type after applying the + operator.
Source§

fn add(self, rhs: L) -> <Length as Add<L>>::Output

Performs the + operation. Read more
Source§

impl<L> AddAssign<L> for Length
where L: Into<Length>,

Source§

fn add_assign(&mut self, rhs: L)

Performs the += operation. Read more
Source§

impl Clone for Length

Source§

fn clone(&self) -> Length

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 Debug for Length

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Length

Source§

fn default() -> Length

Length::Default

Source§

impl<'de> Deserialize<'de> for Length

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Length, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Length

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<F> Div<F> for Length
where F: Into<Factor>,

Source§

type Output = Length

The resulting type after applying the / operator.
Source§

fn div(self, rhs: F) -> <Length as Div<F>>::Output

Performs the / operation. Read more
Source§

impl<F> DivAssign<F> for Length
where F: Into<Factor>,

Source§

fn div_assign(&mut self, rhs: F)

Performs the /= operation. Read more
Source§

impl From<Dip> for Length

Source§

fn from(l: Dip) -> Length

Conversion to Length::Dip

Source§

impl From<Factor> for Length

Source§

fn from(norm: Factor) -> Length

Conversion to Length::Factor

Source§

impl From<FactorPercent> for Length

Source§

fn from(percent: FactorPercent) -> Length

Conversion to Length::Factor

Source§

impl From<Px> for Length

Source§

fn from(l: Px) -> Length

Conversion to Length::Px

Source§

impl From<f32> for Length

Source§

fn from(f: f32) -> Length

Conversion to Length::DipF32

Source§

impl From<i32> for Length

Source§

fn from(i: i32) -> Length

Conversion to Length::Dip

Source§

impl IntoVar<CornerRadius> for Length

Source§

fn into_var(self) -> <Length as IntoVar<CornerRadius>>::Var

All corners same length.

Source§

type Var = LocalVar<CornerRadius>

Variable type that will wrap the T value. Read more
Source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
Source§

impl IntoVar<GradientRadius> for Length

Source§

fn into_var(self) -> <Length as IntoVar<GradientRadius>>::Var

Source§

type Var = LocalVar<GradientRadius>

Variable type that will wrap the T value. Read more
Source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
Source§

impl IntoVar<GradientStop> for Length

Source§

type Var = LocalVar<GradientStop>

Variable type that will wrap the T value. Read more
Source§

fn into_var(self) -> <Length as IntoVar<GradientStop>>::Var

Converts the source value into a var.
Source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
Source§

impl IntoVar<GridSpacing> for Length

Source§

fn into_var(self) -> <Length as IntoVar<GridSpacing>>::Var

Same spacing for both columns and rows.

Source§

type Var = LocalVar<GridSpacing>

Variable type that will wrap the T value. Read more
Source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
Source§

impl IntoVar<Point> for Length

Source§

fn into_var(self) -> <Length as IntoVar<Point>>::Var

Splat.

Source§

type Var = LocalVar<Point>

Variable type that will wrap the T value. Read more
Source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
Source§

impl IntoVar<SideOffsets> for Length

Source§

fn into_var(self) -> <Length as IntoVar<SideOffsets>>::Var

All sides equal.

Source§

type Var = LocalVar<SideOffsets>

Variable type that will wrap the T value. Read more
Source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
Source§

impl IntoVar<Size> for Length

Source§

fn into_var(self) -> <Length as IntoVar<Size>>::Var

Splat.

Source§

type Var = LocalVar<Size>

Variable type that will wrap the T value. Read more
Source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
Source§

impl IntoVar<Vector> for Length

Source§

fn into_var(self) -> <Length as IntoVar<Vector>>::Var

Use the length for x and y.

Source§

type Var = LocalVar<Vector>

Variable type that will wrap the T value. Read more
Source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
Source§

impl Layout1d for Length

Source§

fn layout_dft(&self, axis: LayoutAxis, default: Px) -> Px

Compute the pixel value in the current LAYOUT context with default.
Source§

fn layout_f32_dft(&self, axis: LayoutAxis, default: f32) -> f32

Compute the pixel value in the current LAYOUT context with default.
Source§

fn affect_mask(&self) -> LayoutMask

Compute a LayoutMask that flags all contextual values that affect the result of layout.
Source§

fn layout(&self, axis: LayoutAxis) -> Px

Compute the pixel value in the current LAYOUT context.
Source§

fn layout_x(&self) -> Px

Compute the pixel value in the current LAYOUT context x axis.
Source§

fn layout_y(&self) -> Px

Compute the pixel value in the current LAYOUT context y axis.
Source§

fn layout_z(&self) -> Px

Compute the pixel value in the current LAYOUT context z axis.
Source§

fn layout_dft_x(&self, default: Px) -> Px

Compute the pixel value in the current LAYOUT context x axis with default.
Source§

fn layout_dft_y(&self, default: Px) -> Px

Compute the pixel value in the current LAYOUT context y axis with default.
Source§

fn layout_dft_z(&self, default: Px) -> Px

Compute the pixel value in the current LAYOUT context z axis with default.
Source§

fn layout_f32(&self, axis: LayoutAxis) -> f32

Compute the pixel value in the current LAYOUT context.
Source§

fn layout_f32_x(&self) -> f32

Compute the pixel value in the current LAYOUT context x axis.
Source§

fn layout_f32_y(&self) -> f32

Compute the pixel value in the current LAYOUT context y axis.
Source§

fn layout_f32_z(&self) -> f32

Compute the pixel value in the current LAYOUT context z axis.
Source§

fn layout_f32_dft_x(&self, default: f32) -> f32

Compute the pixel value in the current LAYOUT context x axis with default.
Source§

fn layout_f32_dft_y(&self, default: f32) -> f32

Compute the pixel value in the current LAYOUT context y axis with default.
Source§

fn layout_f32_dft_z(&self, default: f32) -> f32

Compute the pixel value in the current LAYOUT context z axis with default.
Source§

impl<F> Mul<F> for Length
where F: Into<Factor>,

Source§

type Output = Length

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: F) -> <Length as Mul<F>>::Output

Performs the * operation. Read more
Source§

impl<F> MulAssign<F> for Length
where F: Into<Factor>,

Source§

fn mul_assign(&mut self, rhs: F)

Performs the *= operation. Read more
Source§

impl Neg for Length

Source§

type Output = Length

The resulting type after applying the - operator.
Source§

fn neg(self) -> <Length as Neg>::Output

Performs the unary - operation. Read more
Source§

impl PartialEq for Length

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Length

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<L> Sub<L> for Length
where L: Into<Length>,

Source§

type Output = Length

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: L) -> <Length as Sub<L>>::Output

Performs the - operation. Read more
Source§

impl<L> SubAssign<L> for Length
where L: Into<Length>,

Source§

fn sub_assign(&mut self, rhs: L)

Performs the -= operation. Read more
Source§

impl Transitionable for Length

Source§

fn lerp(self, to: &Length, step: Factor) -> Length

Sample the linear interpolation from self -> to by step.
Source§

impl IntoValue<CornerRadius> for Length

Source§

impl IntoValue<GradientRadius> for Length

Source§

impl IntoValue<GradientStop> for Length

Source§

impl IntoValue<GridSpacing> for Length

Source§

impl IntoValue<Point> for Length

Source§

impl IntoValue<SideOffsets> for Length

Source§

impl IntoValue<Size> for Length

Source§

impl IntoValue<Vector> for Length