Skip to main content

FaceSet

Struct FaceSet 

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

The engine’s face roster, in FaceId order. The set mirrors the bundled sovereign default (§11.1): CM regular/italic/bold/bold-italic, CM Typewriter, a sans face, and the math-symbol coverage face.

Implementations§

Source§

impl FaceSet

Source

pub fn from_fonts(fonts: Vec<Font>) -> Self

Build a face set from parsed fonts, in FaceId order: regular, italic, bold, bold-italic, typewriter, sans, symbols.

Source

pub fn bundled() -> Result<Self, FontError>

The bundled sovereign default: the four CM faces, CM Typewriter, IBM Plex Sans, and the Noto math-symbol subset.

§Errors

Propagates fmd_font::FontError if a bundled face fails to parse (which would be a build corruption, not a runtime condition).

Source

pub fn font(&self, id: FaceId) -> Option<&Font>

The font behind a face id, if present.

Source

pub fn len(&self) -> usize

Number of faces in the roster.

Source

pub fn is_empty(&self) -> bool

True when the roster is empty.

Source

pub fn resolve(&self, ch: char, prefer: &[FaceId]) -> Option<(FaceId, u16)>

Resolve a character against a preference chain, falling back across the whole roster, then through the documented glyph alternates. Returns the face and glyph id, or None when nothing maps it.

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