First-party fonts support #1033
Replies: 14 comments 31 replies
-
Love the idea of this! I always use I would actually love something like the Image API, where it will download and optimise remote fonts into a local, self-hosted font! |
Beta Was this translation helpful? Give feedback.
-
Getting my usual comment, please make it runtime agnostic, it should e.g. work on Cloudflare without any compatibility flag. |
Beta Was this translation helpful? Give feedback.
-
Some previous discussion is here #106 |
Beta Was this translation helpful? Give feedback.
-
Could this support automatic subsetting? https://amberwilson.co.uk/learn/font-subsetting/ |
Beta Was this translation helpful? Give feedback.
-
Why implement the Nuxt version instead of the Next version? |
Beta Was this translation helpful? Give feedback.
-
Will I get the option to keep the font's like Nuxt fonts does? |
Beta Was this translation helpful? Give feedback.
-
Big fan of this. Return of the |
Beta Was this translation helpful? Give feedback.
-
Zach has a brilliant article for fonts and rendering them. Since the |
Beta Was this translation helpful? Give feedback.
-
We'll probably use https://github.com/unjs/unifont now that it's finally public! The timing is perfect and it was not even made on purpose |
Beta Was this translation helpful? Give feedback.
-
I like this too. I also share some concerns that it's a little verbose. Do we need a I also wonder if the |
Beta Was this translation helpful? Give feedback.
-
Super excited to see this go live! I wonder how are we planning to support ssr first environments? If we are able to bundle the font in a SSR first project, that'd be ideal I think. |
Beta Was this translation helpful? Give feedback.
-
I like this idea! What would be the purpose of having a |
Beta Was this translation helpful? Give feedback.
-
That's great idea. I hope that it will fully-support SSR as well. |
Beta Was this translation helpful? Give feedback.
-
Proposal moved to Stage 2! #1037 |
Beta Was this translation helpful? Give feedback.
-
Body
Summary
Have first-party support for fonts in Astro.
Background & Motivation
Fonts is one of those basic things when making a website, but also an annoying one to deal with. Should I just use a link to a remote font? Or download it locally? How should I handle preloads then?
The goal is to improve the DX around using fonts in Astro.
Fontsource is great! But it's not intuitive to preload, and more importantly, doesn't have all fonts. The goal is to have a more generic API for fonts (eg. you want to use a paid provider like adobe).
Goals
Example
This RFC is highly inspired from https://github.com/nuxt/fonts and https://github.com/rishi-raj-jain/astro-font.
A new
fonts
object would be available on the astro config:We could register providers:
And specify font families:
We could then use a
Font
component and place it in the head:Then specify the font family (we may provide a css variable):
Beta Was this translation helpful? Give feedback.
All reactions