Skip to main content

ResolvedStyle

Struct ResolvedStyle 

Source
pub struct ResolvedStyle {
Show 26 fields pub family: Option<String>, pub weight: u16, pub italic: bool, pub width: f32, pub size_pt: f64, pub color: Option<ThemeColor>, pub tracking: f32, pub underline: bool, pub strikethrough: bool, pub baseline_pt: f64, pub text_stroke: Option<ThemeColor>, pub text_stroke_width_pt: f64, pub features: Vec<FontFeatureSetting>, pub lineheight: LineHeightSpec, pub align: Option<HAlign>, pub text_direction: Option<Direction>, pub indent_pt: f64, pub hanging_pt: f64, pub margin_pt: [f64; 4], pub padding_pt: [f64; 4], pub background: Option<ThemeColor>, pub border_color: Option<ThemeColor>, pub border_width_pt: [f64; 4], pub border_radius_pt: f64, pub border_type: Option<Arc<[LinetypeStep]>>, pub bullet: Option<Vec<String>>,
}
Expand description

A style with every length already in points and every flag decided. One of these rides on each inline run and each block the reducer emits, so the shaping pass reads concrete numbers.

Fields§

§family: Option<String>

Font family override. None keeps the base style’s chain.

§weight: u16

CSS-style font weight.

§italic: bool

Italic flag.

§width: f32

CSS font-width ratio.

§size_pt: f64

Font size in points.

§color: Option<ThemeColor>

Text colour, still palette-relative until draw time.

§tracking: f32

Letter spacing in 1/1000 em.

§underline: bool

Underline flag.

§strikethrough: bool

Strikethrough flag.

§baseline_pt: f64

Accumulated baseline shift in points (positive = up).

§text_stroke: Option<ThemeColor>

Glyph outline colour. None = fill only.

§text_stroke_width_pt: f64

Glyph outline width in points.

§features: Vec<FontFeatureSetting>

OpenType features in effect.

§lineheight: LineHeightSpec

Line height.

§align: Option<HAlign>

Horizontal alignment, None = defer to the caller.

§text_direction: Option<Direction>

Block-axis direction, None = read back from parley.

§indent_pt: f64

First-line indent in points.

§hanging_pt: f64

Continuation-line indent in points.

§margin_pt: [f64; 4]

Outer spacing in points, [top, right, bottom, left].

§padding_pt: [f64; 4]

Inner spacing in points, [top, right, bottom, left].

§background: Option<ThemeColor>

Block background colour.

§border_color: Option<ThemeColor>

Block border colour.

§border_width_pt: [f64; 4]

Block border widths in points, [top, right, bottom, left].

§border_radius_pt: f64

Block border corner radius in points.

§border_type: Option<Arc<[LinetypeStep]>>

Block border dash pattern.

§bullet: Option<Vec<String>>

Per-nesting-depth bullet markers.

Implementations§

Source§

impl ResolvedStyle

Source

pub fn from_base(base: &TextStyle) -> Self

The root of the cascade: everything the base TextStyle dictates, with no box spacing and no decorations.

Source

pub fn apply( &self, delta: &StyleDelta, grandparent: &ResolvedStyle, base_size_pt: f64, ) -> ResolvedStyle

Apply delta on top of self, producing the child’s resolved style.

grandparent supplies the inherited value for any field named in delta.skip_inherit; base_size_pt anchors Rem. size resolves first so every other Em length measures against the child’s own size rather than the parent’s.

Source

pub fn for_inline(&self) -> ResolvedStyle

Copy with every box-level field reset.

Used when a block’s resolved style seeds the inline cascade for its own content: the block already draws its background, border and spacing itself, so a descendant span must not inherit them and paint a second chip. Marquee gets the same rendered result from its classic_style() carrying explicit resets on every inline tag.

Trait Implementations§

Source§

impl Clone for ResolvedStyle

Source§

fn clone(&self) -> ResolvedStyle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ResolvedStyle

Source§

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

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

impl PartialEq for ResolvedStyle

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ResolvedStyle

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

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, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more