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: usizeImplementations§
Source§impl<T> StateTable<'_, T>
impl<T> StateTable<'_, T>
pub const HEADER_LEN: usize
Source§impl<T> StateTable<'_, T>where
T: FixedSize + AnyBitPattern,
impl<T> StateTable<'_, T>where
T: FixedSize + AnyBitPattern,
Sourcepub fn class(&self, glyph_id: GlyphId16) -> Result<u8, ReadError>
pub fn class(&self, glyph_id: GlyphId16) -> Result<u8, ReadError>
Returns the class table entry for the given glyph identifier.
Sourcepub fn class_mappings(&self) -> (u16, &[u8])
pub fn class_mappings(&self) -> (u16, &[u8])
Returns the first covered glyph and its consecutive class values.
Source§impl<'a, T> StateTable<'a, T>
impl<'a, T> StateTable<'a, T>
Sourcepub fn from_parts(
data: FontData<'a>,
parts: &LegacyStateTableParts,
) -> Result<Self, ReadError>
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>
impl<'a> StateTable<'a, NoPayload>
Sourcepub fn read(data: FontData<'a>) -> Result<Self, ReadError>
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>
impl<'a, T: Clone> Clone for StateTable<'a, T>
Source§fn clone(&self) -> StateTable<'a, T>
fn clone(&self) -> StateTable<'a, T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more