Skip to content

Conversation

@florian-lefebvre
Copy link
Member

@florian-lefebvre florian-lefebvre commented Mar 13, 2025

Changes

  • Updates how we read font metrics by switching from fontaine to capsize
  • Capsize was used under the hood by fontaine. But fontaine abstracted it too much so we couldn't do some caching
  • I copied part of fontaine's source which is not tested
  • I updated the code from fontaine so it uses less dependencies, so this PR makes Astro lighter

Testing

Updated

Docs

N/A

@florian-lefebvre florian-lefebvre self-assigned this Mar 13, 2025
@changeset-bot
Copy link

changeset-bot bot commented Mar 13, 2025

⚠️ No Changeset found

Latest commit: c2442d5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Mar 13, 2025
@florian-lefebvre florian-lefebvre marked this pull request as ready for review March 13, 2025 11:10
import { fontFamilyToCamelCase } from '@capsizecss/metrics';
import { fromBlob } from '@capsizecss/unpack';

const withoutQuotes = (str: string) => str.trim().replace(/^["']|["']$/g, '');
Copy link
Member

Choose a reason for hiding this comment

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

small nit: move the regex into a top-level constant

const { entireMetricsCollection } = await import('@capsizecss/metrics/entireMetricsCollection');
const metrics = entireMetricsCollection[name as keyof typeof entireMetricsCollection];

if (!('descent' in metrics)) {
Copy link
Member

Choose a reason for hiding this comment

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

Do you know why we exit here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope this is copy pasted from fontaine so I don't know

@florian-lefebvre florian-lefebvre merged commit 784976d into feat/fonts Mar 13, 2025
5 checks passed
@florian-lefebvre florian-lefebvre deleted the feat/fonts-capsize branch March 13, 2025 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants