Skip to content

Conversation

@florian-lefebvre
Copy link
Member

@florian-lefebvre florian-lefebvre commented Apr 17, 2025

Try it with npm i https://pkg.pr.new/astro@976100f

Changes

  • New feature!
  • When using the local provider, the weight and/or style can be left undefined. In this case, we'll read the font files from src and try infer those properties from there
  • Reading those properties uses https://github.com/delucis/fontace from Chris
  • Also improves how unicodeRange is handled for empty arrays

Testing

Tests added

Docs

An error has been added, please review it!

@florian-lefebvre florian-lefebvre self-assigned this Apr 17, 2025
@changeset-bot
Copy link

changeset-bot bot commented Apr 17, 2025

🦋 Changeset detected

Latest commit: 80d9b80

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Apr 17, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Apr 17, 2025

CodSpeed Performance Report

Merging #13640 will not alter performance

Comparing feat/fonts-local-infer (80d9b80) with main (bb211af)

Summary

✅ 6 untouched benchmarks

@florian-lefebvre florian-lefebvre added the pr preview Apply this label to a PR to generate a preview release label May 2, 2025
@github-actions github-actions bot removed the pr preview Apply this label to a PR to generate a preview release label May 2, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented May 2, 2025

astro

npm i https://pkg.pr.new/astro@13640

@astrojs/cloudflare

npm i https://pkg.pr.new/@astrojs/cloudflare@13640

@astrojs/netlify

npm i https://pkg.pr.new/@astrojs/netlify@13640

@astrojs/node

npm i https://pkg.pr.new/@astrojs/node@13640

@astrojs/vercel

npm i https://pkg.pr.new/@astrojs/vercel@13640

commit: 976100f

@florian-lefebvre

This comment was marked as outdated.

@tanishqmanuja
Copy link
Contributor

Works as expected for me 👍🏻

image

Generated Styles:

@font-face {
  font-family: Nothing-9a268c556f77aca7;
  src: url("/_astro/fonts/a3c4314f41ba7cc4.otf") format("opentype");
  font-display: swap;
  font-weight: 400;
  font-style: normal;
}
:root {
  --ff-dotmatrix: Nothing-9a268c556f77aca7, var(--ff-monospace);
}

@florian-lefebvre

This comment was marked as resolved.

@florian-lefebvre florian-lefebvre added the pr preview Apply this label to a PR to generate a preview release label May 6, 2025
@github-actions github-actions bot removed the pr preview Apply this label to a PR to generate a preview release label May 6, 2025
@florian-lefebvre
Copy link
Member Author

The preview release has been updated: npm i https://pkg.pr.new/astro@976100f

@florian-lefebvre florian-lefebvre marked this pull request as ready for review May 6, 2025 08:45
@florian-lefebvre florian-lefebvre requested a review from ascorbic May 6, 2025 09:14
@ematipico
Copy link
Member

ematipico commented May 7, 2025

Reminder to update the RFC before shipping the feature, if it hasn't been done yet

@florian-lefebvre
Copy link
Member Author

I have updated the RFC: withastro/roadmap@a55738d (#1039)

@florian-lefebvre
Copy link
Member Author

@sarah11918 I've renamed the error and updated its data, let me know what you think!

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

Looks great to me! Thanks for the update!

@florian-lefebvre florian-lefebvre merged commit 5e582e7 into main May 7, 2025
17 checks passed
@florian-lefebvre florian-lefebvre deleted the feat/fonts-local-infer branch May 7, 2025 15:45
@astrobot-houston astrobot-houston mentioned this pull request May 7, 2025
openscript pushed a commit to openscript/astro that referenced this pull request Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs pr pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants