Skip to main content

Ligatures

Struct Ligatures 

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

Parsed GSUB liga standard ligatures for a font. Built once via Font::gsub_ligatures; Ligatures::substitute applies them.

Implementations§

Source§

impl Ligatures

Source

pub fn is_empty(&self) -> bool

True when the font defines no standard ligatures.

Source

pub fn rule_start_glyphs(&self) -> impl Iterator<Item = &u16>

Glyph ids that begin some ligature rule (the keys of the rule map). Callers shaping ASCII text use this to prove substitute is an identity for a given string: if no glyph in the string starts a rule, the substitution is a no-op.

Source

pub fn max_rule_len(&self) -> usize

Total glyph length (first glyph + components) of the longest ligature rule. Incremental shapers use it as the settle window: an input suffix shorter than this cannot complete a rule that starts before it, so decisions before the window are final.

Source

pub fn substitute(&self, gids: &[u16]) -> Vec<u16>

Apply ligature substitution to a glyph-id sequence (greedy longest match), returning the shaped sequence (which may contain ligature glyph ids that no single character maps to).

Source

pub fn substitute_with_spans(&self, gids: &[u16]) -> Vec<(u16, usize)>

Like Ligatures::substitute but pairs each output glyph with the number of input glyphs it consumed (1 for a pass-through, N for an N-component ligature) — so callers can map a ligature back to its source characters (e.g. to build a ToUnicode entry).

Source

pub fn substitute_with_spans_into( &self, gids: &[u16], out: &mut Vec<(u16, usize)>, )

Into-scratch Ligatures::substitute_with_spans: identical decisions and output, but appends into a caller-owned buffer (cleared first) so repeat shapers reuse one allocation across runs instead of returning a fresh Vec per call.

Trait Implementations§

Source§

impl Clone for Ligatures

Source§

fn clone(&self) -> Self

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 Ligatures

Source§

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

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

impl Default for Ligatures

Source§

fn default() -> Self

Returns the “default value” for a type. 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.