pub enum FontFace {
Generic(FontFamily),
Named(String),
}Expand description
The face a run is set in: one of CSS’s four generics, or the family the author named.
A generic opens on every machine and a family name does not, which is the
trade stated once in FontFamily’s own note. A named family is resolved
through the platform’s font registry by the frontends that have one, and
falls back to the body face where it is not installed.
Owned, because a family name is a String and this is what a gesture takes
and a query answers — neither is per-glyph. What a glyph carries is
FaceRef, the Copy half, whose name is looked up in the map’s
FaceTable.
Variants§
Generic(FontFamily)
Named(String)
Implementations§
Source§impl FontFace
impl FontFace
Sourcepub fn from_attrs(attrs: &[(String, Option<String>)]) -> Option<Self>
pub fn from_attrs(attrs: &[(String, Option<String>)]) -> Option<Self>
The face a run’s or block’s attributes name, if any — twig records it
under data-font.
Sourcepub fn from_attr(value: &str) -> Option<Self>
pub fn from_attr(value: &str) -> Option<Self>
Read a data-font value: one of the four generics, or any other
non-empty string, which is a family name. Trimmed, and nothing else —
a family name is what the author typed, and leaf has no table of real
ones to check it against.
Sourcepub fn name(&self) -> Cow<'_, str>
pub fn name(&self) -> Cow<'_, str>
The token twig spells it with, and what from_attr
reads back — the generic’s CSS keyword, or the family name as given.
Sourcepub const fn generic(&self) -> Option<FontFamily>
pub const fn generic(&self) -> Option<FontFamily>
The generic, for a menu asking which of its four rows to tick — None
for a named family, which the menu shows as a row of its own.