pub struct Typography { /* private fields */ }Expand description
Layer 0 of the font model, re-exported for the same one-dependency reason.
A build script composing an override needs all four names and has no other
reason to depend on makeover directly.
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>) -> Typography
pub fn house(base_url: impl Into<String>) -> Typography
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) -> Typography
pub fn with_override(self, ov: FontOverride) -> Typography
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 faces(&self, slot: FontSlot) -> &[FontFace]
pub fn faces(&self, slot: FontSlot) -> &[FontFace]
The faces a product ships for slot, in declaration order, or an
empty slice for a slot it did not override.
The other half of resolve, for a renderer that has
to load a file rather than name a stack: resolve says which family
wins, this says where the bytes come from, what to call them, and at
what weight. The
house faces are not here — they belong to the slot rather than to any
one product, and FontSlot::house_face is where they answer.
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