unjs / fontaine

Automatic font fallback based on font metrics
MIT License
1.47k stars 23 forks source link

Fontaine does not process fonts attached via Fontsource #258

Open Serator opened 11 months ago

Serator commented 11 months ago

🐛 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.

EmeraldSnorlax commented 5 months ago

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