Skip to main content

StateTable

Struct StateTable 

Source
pub struct StateTable<'a, T = NoPayload> {
    pub header: StateHeader<'a>,
    pub n_classes: usize,
    /* private fields */
}
Expand description

Table for driving a finite state machine for layout.

The input to the state machine consists of the current state and a glyph class. The output is an entry containing the next state and a payload that is dependent on the type of layout action being performed.

See https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6Tables.html#StateHeader for more detail.

Fields§

§header: StateHeader<'a>§n_classes: usize

Implementations§

Source§

impl<T> StateTable<'_, T>

Source§

impl<T> StateTable<'_, T>

Source

pub fn class(&self, glyph_id: GlyphId16) -> Result<u8, ReadError>

Returns the class table entry for the given glyph identifier.

Source

pub fn class_mappings(&self) -> (u16, &[u8])

Returns the first covered glyph and its consecutive class values.

Source

pub fn entry(&self, state: u16, class: u8) -> Result<StateEntry<T>, ReadError>

Returns the entry for the given state and class.

Source

pub fn read_value<S: Scalar>(&self, offset: usize) -> Result<S, ReadError>

Reads scalar values that are referenced from state table entries.

Source§

impl<'a, T> StateTable<'a, T>

Source

pub fn from_parts( data: FontData<'a>, parts: &LegacyStateTableParts, ) -> Result<Self, ReadError>

Builds the state table from data and offsets previously captured with LegacyStateTableParts::read on the same data.

Source§

impl<'a> StateTable<'a, NoPayload>

Source

pub fn read(data: FontData<'a>) -> Result<Self, ReadError>

Reads a state table whose entries carry no payload.

This exists so that StateTable::read(data) still resolves without naming the payload type: a type parameter’s default does not apply in a path expression, only in type position. Without it, adding the payload parameter would have broken every existing caller.

Remove this at the next breaking release, so that callers name the payload as they do for ExtendedStateTable.

Trait Implementations§

Source§

impl<'a, T: Clone> Clone for StateTable<'a, T>

Source§

fn clone(&self) -> StateTable<'a, T>

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<'a, T> FontRead<'a> for StateTable<'a, T>

Source§

fn read_with_args(data: FontData<'a>, _: ()) -> Result<Self, ReadError>

Read an item, performing validation. Read more
Source§

fn read(data: FontData<'a>) -> Result<Self, ReadError>
where Self: FontRead<'a, Args = ()>,

Read an instance of Self from the provided data, performing validation. Read more
Source§

impl<T> ReadArgs for StateTable<'_, T>

Auto Trait Implementations§

§

impl<'a, T> Freeze for StateTable<'a, T>
where PhantomData<fn() -> T>: Freeze,

§

impl<'a, T> RefUnwindSafe for StateTable<'a, T>
where PhantomData<fn() -> T>: RefUnwindSafe,

§

impl<'a, T> Send for StateTable<'a, T>
where PhantomData<fn() -> T>: Send,

§

impl<'a, T> Sync for StateTable<'a, T>
where PhantomData<fn() -> T>: Sync,

§

impl<'a, T> Unpin for StateTable<'a, T>
where PhantomData<fn() -> T>: Unpin,

§

impl<'a, T> UnsafeUnpin for StateTable<'a, T>
where PhantomData<fn() -> T>: UnsafeUnpin,

§

impl<'a, T> UnwindSafe for StateTable<'a, T>
where PhantomData<fn() -> T>: UnwindSafe,

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 = !

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.