Mismatch with font provider `fontsource` and variable fonts
Astro Info
Astro v7.3.5
Vite v8.3.1
Node v22.22.3
System Linux (x64)
Package Manager npm
Output static
Adapter none
Integrations noneIf this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I'm trying to use the font Inter that has a variable variant of the font. When I configure Astro to load this font via the provider `fontsource, it doesn't load the variable variant of the font.
fonts: [
{
provider: fontProviders.fontsource(),
name: "Inter",
cssVariable: "--font-inter",
weights: ["100 900"],
styles: ["normal"],
subsets: ["latin"],
featureSettings: '"ss07", "ss08", "cv03", "cv04", "cv10"',
},
] ❌
Also see the corresponding Inter page on fontsource: https://fontsource.org/fonts/inter/use
The issue is, that the entry for the font on fontsource is called "Inter" but the name of the variable inter font which should be used in the font-family property is called Inter Variable.
fonts: [
{
provider: fontProviders.fontsource(),
name: "Inter Variable",
cssVariable: "--font-inter",
weights: ["100 900"],
styles: ["normal"],
subsets: ["latin"],
featureSettings: '"ss07", "ss08", "cv03", "cv04", "cv10"',
},
],How it should look like:
✅
If I set the name to Inter Variable in the Astro configuration the following warnings are printed:
12:06:42 [WARN] [assets] No data found for font family Inter Variable. Review your configuration
12:06:42 [WARN] [assets] Inter Variable font family cannot be retrieved by the provider. Did you mean Inter Tight?What's the expected result?
I expect the variable font to be loaded so the necessary font features are available.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-qn9enxee
Participation
- I am willing to submit a pull request for this issue.
Source: withastro/astro