pub struct Typography { /* private fields */ }Expand description
The whole typography layer for one product: the house defaults, plus whatever it overrides.
This is what a build script composes and what
makeover_build::typography_css_from writes. typography_css_vars and
font_face_css are the no-override case of it and stay for callers that
have nothing to declare.
Implementations§
Source§impl Typography
impl Typography
Sourcepub fn house(base_url: impl Into<String>) -> Self
pub fn house(base_url: impl Into<String>) -> Self
The house layer alone, fetching faces from base_url — the directory
the consumer serves fonts from, with or without a trailing slash.
Sourcepub fn with_override(self, ov: FontOverride) -> Self
pub fn with_override(self, ov: FontOverride) -> Self
Add one product override.
§Panics
If the slot is already overridden. One declaration per product per slot: a second is not a merge to resolve, it is two answers to a question that has one, and the vocabulary is what wants fixing.
Sourcepub fn resolve(&self, slot: FontSlot) -> Option<&str>
pub fn resolve(&self, slot: FontSlot) -> Option<&str>
What slot resolves to under this layer, or None for a brand slot
nobody overrode.
The resolution, for a renderer that has a face to choose rather than a stylesheet to emit.
Sourcepub fn font_face_css(&self) -> String
pub fn font_face_css(&self) -> String
The @font-face rules: the two house faces, then each override’s.
Sourcepub fn css_declarations(&self) -> String
pub fn css_declarations(&self) -> String
The resolved tokens as CSS declarations, no selector.
Trait Implementations§
Source§impl Clone for Typography
impl Clone for Typography
Source§fn clone(&self) -> Typography
fn clone(&self) -> Typography
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more