Skip to main content

ShapedRun

Struct ShapedRun 

Source
pub struct ShapedRun {
Show 16 fields pub font_id: u16, pub size: f32, pub text: String, pub source: String, pub source_map: Vec<u32>, pub text_start: u32, pub origin: Option<SourceRange>, pub pseudo_element: Option<NodeId>, pub inline: Option<NodeId>, pub lead: f32, pub trail: f32, pub features: Features, pub color: Color, pub decoration: TextDecoration, pub glyphs: Vec<ShapedGlyph>, pub advance: u32,
}
Expand description

A run of glyphs sharing one font and size — the paintable unit.

Fields§

§font_id: u16

Index into the registry that shaped the run.

§size: f32

Em size in points.

§text: String

The text the run was shaped from. Glyph ids alone do not spell anything, and the correspondence exists only in the shaper’s output.

§source: String

What the author wrote, where a transform made that differ from what was shaped, and empty where the two are the same.

§source_map: Vec<u32>

The offset in source of every byte boundary of text. Empty alongside source.

§text_start: u32

Byte offset of text in the paragraph the glyphs’ clusters index.

§origin: Option<SourceRange>

Where the run was written: the node it was shaped from and the bytes of that node’s own text it stands for. None for text no node was walked for: page furniture, an ornament.

§pseudo_element: Option<NodeId>

The pseudo-element the run was cut from, where it was cut from one.

§inline: Option<NodeId>

The innermost inline element the run came from: a link, an emphasis, a strong, a code span. None on the text of the paragraph itself.

§lead: f32

Points of space before the run’s first glyph, from the leading edges of the inline boxes that open on it.

§trail: f32

Points of space after its last glyph, from the trailing edges of the ones that close on it.

§features: Features

The features the run was shaped with.

§color: Color

What the run is painted in.

§decoration: TextDecoration

What is drawn across it: the rules text-decoration asks for, each painted over the run’s own advance.

§glyphs: Vec<ShapedGlyph>

The glyphs, in visual order.

§advance: u32

Total advance of the run’s glyphs, in font units. What an inline box takes beside them is lead and trail, in points.

Implementations§

Source§

impl ShapedRun

Source

pub fn glyph_ranges(&self) -> Vec<Range<u32>>

The byte range in text each glyph stands for, in glyph order. A glyph covers its cluster up to the next cluster that starts later — which is how a ligature comes to span the characters it swallowed.

Trait Implementations§

Source§

impl Clone for ShapedRun

Source§

fn clone(&self) -> ShapedRun

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 ShapedRun

Source§

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

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

impl PartialEq for ShapedRun

Source§

fn eq(&self, other: &ShapedRun) -> 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 ShapedRun

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
§

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

§

impl<T> Finish for T

§

fn finish(self)

Does nothing but move self, equivalent to drop.
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
§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

§

fn to_owned_table(&self) -> U

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.