pub enum FontFamily {
Serif,
SansSerif,
Monospace,
Cursive,
}Expand description
The face a run is set in — CSS’s generic families, less fantasy and
system-ui, neither of which an author asks for.
A generic, never a font name, for SizeStep’s reason: a document that
names Georgia renders in the fallback everywhere Georgia is not installed,
which is every Linux terminal and most of the web. The theme names the
concrete face for each — Serif is Georgia on a Mac and Noto Serif on a
Linux box, and Monospace is the theme’s mono face, which inline code
already uses.
A named family is carried (twig will spell data-font="Garamond") and is
not in this vocabulary: from_attr answers None for
it, the native renderers may resolve it through the platform’s font registry,
and the toolbar offers the four.
Variants§
Implementations§
Source§impl FontFamily
impl FontFamily
Sourcepub const ALL: [Self; 4]
pub const ALL: [Self; 4]
Every face, in the order a menu offers them. The theme’s own body face
is absent because it is absence — the menu entry for it calls
crate::Doc::set_font_family with None.
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. None for a concrete family name, which is
carried by the document and left to whatever the frontend can resolve.
Trait Implementations§
Source§impl Clone for FontFamily
impl Clone for FontFamily
Source§fn clone(&self) -> FontFamily
fn clone(&self) -> FontFamily
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more