Skip to main content

TextSpan

Struct TextSpan 

Source
pub struct TextSpan { /* private fields */ }
Expand description

A text style span.

Spans do not overlap inside a text chunk.

Implementations§

Source§

impl TextSpan

Source

pub fn start(&self) -> usize

A span start in bytes.

Offset is relative to the parent text chunk and not the parent text element.

Source

pub fn end(&self) -> usize

A span end in bytes.

Offset is relative to the parent text chunk and not the parent text element.

Source

pub fn fill(&self) -> Option<&Fill>

A fill style.

Source

pub fn stroke(&self) -> Option<&Stroke>

A stroke style.

Source

pub fn paint_order(&self) -> PaintOrder

A paint order style.

Source

pub fn font(&self) -> &Font

A font.

Source

pub fn font_size(&self) -> NonZeroPositiveF32

A font size.

Source

pub fn small_caps(&self) -> bool

Indicates that small caps should be used.

Set by font-variant="small-caps"

Source

pub fn apply_kerning(&self) -> bool

Indicates that a kerning should be applied.

Supports both kerning and font-kerning properties.

Source

pub fn font_optical_sizing(&self) -> FontOpticalSizing

Font optical sizing mode.

When Auto (default), the opsz axis will be automatically set to match the font size for variable fonts that support it. This matches the CSS font-optical-sizing: auto behavior.

Source

pub fn decoration(&self) -> &TextDecoration

A span decorations.

Source

pub fn dominant_baseline(&self) -> DominantBaseline

A span dominant baseline.

Source

pub fn alignment_baseline(&self) -> AlignmentBaseline

A span alignment baseline.

Source

pub fn baseline_shift(&self) -> &[BaselineShift]

A list of all baseline shift that should be applied to this span.

Ordered from text element down to the actual span element.

Source

pub fn is_visible(&self) -> bool

A visibility property.

Source

pub fn letter_spacing(&self) -> f32

A letter spacing property.

Source

pub fn word_spacing(&self) -> f32

A word spacing property.

Source

pub fn text_length(&self) -> Option<f32>

A text length property.

Source

pub fn length_adjust(&self) -> LengthAdjust

A length adjust property.

Trait Implementations§

Source§

impl Clone for TextSpan

Source§

fn clone(&self) -> TextSpan

Returns a duplicate 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 TextSpan

Source§

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

Formats the value using the given formatter. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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.