pub struct FontFace { /* 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.
One @font-face an override brings with it.
A product overriding a slot usually has to ship the face too, and the two halves have to agree on a family name. Declaring them together is what makes that agreement structural rather than a string typed twice.
Implementations§
Source§impl FontFace
impl FontFace
Sourcepub fn new<S>(
family: impl Into<String>,
sources: impl IntoIterator<Item = S>,
) -> FontFace
pub fn new<S>( family: impl Into<String>, sources: impl IntoIterator<Item = S>, ) -> FontFace
A face named family, fetched from sources.
Each source is either a bare filename, resolved against the
Typography base URL, or an absolute one (/… or https://…) taken
as written. The format() hint is inferred from the extension —
woff2, woff, ttf, otf — and omitted for anything else rather
than guessed, since a wrong hint is worse than none.
Sourcepub fn weight(self, weight: impl Into<String>) -> FontFace
pub fn weight(self, weight: impl Into<String>) -> FontFace
font-weight, as CSS writes it: "700", or "200 800" for a variable
axis. Omitted when unset, which means normal.
A variable face MUST name its range here for the same reason the house
faces do: a @font-face with no range makes the browser resolve every
weight to the file’s default instance.