pub struct FaceTable { /* private fields */ }Expand description
Every named family a crate::wysiwyg::VisualMap draws, by the id its
glyphs carry — the side table that lets Style stay Copy while a face
name stays a String.
Small: one entry per distinct family name in the document, which is normally none. A splice may leave an entry no glyph names any more, because the splice reuses the previous map’s table rather than rebuilding it from rows it deliberately did not walk; an unused entry costs a string and draws nothing.
Implementations§
Source§impl FaceTable
impl FaceTable
Sourcepub fn name(&self, id: FaceId) -> Option<&str>
pub fn name(&self, id: FaceId) -> Option<&str>
The family name id stands for, or None for an id from another map —
which a frontend draws in the theme’s body face, as it draws a face it
cannot resolve.
Sourcepub fn spell(&self, face: FaceRef) -> Option<Cow<'_, str>>
pub fn spell(&self, face: FaceRef) -> Option<Cow<'_, str>>
The face a glyph carries, spelled — the generic’s CSS keyword, or the
family name this table holds for the id. The one place a FaceRef
becomes the token a data-font is written with, which is what every
frontend wants of it.
None for an id no table knows, which is an id from another map: a
frontend draws that in the theme’s body face, and a face that draws as
absence names itself as absence too.
leaf-ffi’s and leaf-wasm’s Run::font are this; leaf-swift’s and
leaf-ratatui’s face resolvers can be.
Sourcepub fn iter(&self) -> impl Iterator<Item = (FaceId, &str)>
pub fn iter(&self) -> impl Iterator<Item = (FaceId, &str)>
Every family in the table, by id — how a frontend warms a font cache before it draws.