unjs / fontaine

Automatic font fallback based on font metrics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fontaine does not process fonts attached via Fontsource

Serator opened this issue Β· comments

πŸ› The bug

When attaching fonts via Fontsource (4k stars on Github), a fallback font is added to font-family, but @font-face is not created for it.

πŸ› οΈ To reproduce

https://stackblitz.com/edit/github-xyllwv?file=index.css

🌈 Expected behaviour

The Roboto font in the demo should have a fallback font, but it doesn't.

ℹ️ Additional context

https://github.com/Serator/fontaine-with-fontsource - additional example with SvelteKit.

commented

want to add that this issue also seemingly applies to all fonts that get imported through npm packages: fontaine doesnt see the fonts at all -- that is, it doesn't even try to generate an "override" font

in my case, i'm importing fonts like this
https://github.com/EmeraldSnorlax/website/blob/ef0378d1a5ed69c45577e70ccbc986f9c23dbd2c/vite.config.ts
https://github.com/EmeraldSnorlax/website/blob/ef0378d1a5ed69c45577e70ccbc986f9c23dbd2c/src/routes/%2Blayout.svelte