Skip to main content

typography_css_from

Function typography_css_from 

Source
pub fn typography_css_from(path: impl AsRef<Path>, typography: &Typography)
Expand description

typography_css, for a product that overrides a slot.

Layer 0 of the font model. A product with a brand face declares it here, once, and the generated sheet carries both the @font-face and the token — which is what replaces the hand-maintained @font-face block plus a --font-heading nothing else in the tree knew about:

use makeover_build::{FontFace, FontOverride, FontSlot, Typography};

makeover_build::typography_css_from(
    "static/typography.css",
    &Typography::house("/static/fonts").with_override(
        FontOverride::new(FontSlot::Display, "\"Young Serif\", serif")
            .with_face(FontFace::new("Young Serif", ["ysrf.woff2", "ysrf.ttf"])),
    ),
);

The product still ships the face itself, exactly as it does for the house two: this writes the CSS that fetches it and cannot produce a font.

§Panics

If the file cannot be written.