Skip to content

Expand the fonts guide with variable fonts, preloading & fontData #13650

Open
ArmandPhilippot wants to merge 11 commits intomainfrom
armand/fonts-guide
Open

Expand the fonts guide with variable fonts, preloading & fontData #13650
ArmandPhilippot wants to merge 11 commits intomainfrom
armand/fonts-guide

Conversation

@ArmandPhilippot
Copy link
Copy Markdown
Member

@ArmandPhilippot ArmandPhilippot commented Apr 3, 2026

Description (required)

We had several reports here (#13635, #13583, #13324) and on Discord about the fonts guide:

  • using variable fonts is not clear enough
  • because we have several pages related to fonts, available props are not easy to find (we had a single link to the <Font /> reference) and some people wants to preload their fonts
  • the OG image example wasn't working

Regarding the last point, I know Florian plans to improve the API but in the meantime, I think it's a good idea to improve the documentation, because this specific use case is of interest to many people.

This PR:

  • adds a new section for preloading fonts
  • adds a new section for using variable fonts, with remote and local fonts
  • adds a new section for fallback fonts
  • expands the "Accessing font data programmatically" section to:
    • provide a code snippet that can work for both dev and build
    • provide a full working example (~20 lines added...)
    • highlight this is only an example that won't work for everyone (multiple font files, adapter output...)
  • expands the FontData type description, I think this can be helpful for people using font data programmatically.

cc @florian-lefebvre (no rush, this is in draft on purpose!), feel free to comment on the changes and/or push to my branch directly if your prefer!
I know you didn't want to highlight preload but since this option is available, I think it makes sense to mention it in the guide, with the same caution.

Related issues & labels (optional)

@ArmandPhilippot ArmandPhilippot added improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes) add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. labels Apr 3, 2026
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 3, 2026

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 8c29de7
🔍 Latest deploy log https://app.netlify.com/projects/astro-docs-2/deploys/69d4def1af2ef30008a3ead8
😎 Deploy Preview https://deploy-preview-13650--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@astrobot-houston
Copy link
Copy Markdown
Contributor

astrobot-houston commented Apr 3, 2026

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/fonts.mdx Source changed, localizations will be marked as outdated.
en/reference/modules/astro-assets.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

Copy link
Copy Markdown
Member

@florian-lefebvre florian-lefebvre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome! Just one comment

@ArmandPhilippot ArmandPhilippot marked this pull request as ready for review April 6, 2026 13:43
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
Copy link
Copy Markdown
Member

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work here, two small suggestions from me so far.

@ArmandPhilippot
Copy link
Copy Markdown
Member Author

Because the suggestions couldn't be applied (I don't know what happened with dbb79ed... The entire file was considered modified), I just pushed three new commits with what we discussed:

  • Local provider/Other providers (with local first), including some rewording (5b5e788)
  • Preloading fonts as an h2 (8c29de7)
  • Reword the Satori code snippet introduction to add a new link... I used my last suggestion, but if you don't like it, we can update it with a two sentences format. (c2c53b7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect guide for accessing font programatically through Fonts API

4 participants