Skip to content

Conversation

@adamwathan
Copy link
Member

This PR makes it possible to set a default letter spacing a given font family, just like how you can set the default font-feature-settings and font-variation-settings.

The use case is for things like heading fonts, where maybe you want the letter spacing to always be tighter and you don't want to add tracking-tight every time you use it.

The letter spacing can still be overridden with explicit tracking utilities.

@theme {
  --font-display: Mona Sans;
  --font-display--letter-spacing: -0.025em;
}

@adamwathan adamwathan requested a review from a team as a code owner October 31, 2025 18:55
"
`)
})

Copy link
Contributor

Choose a reason for hiding this comment

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

I kinda feel like this test is redundant (if sans works then mono should work too) — but it matches some of the existing stuff so probably fine.

test('overriding `fontFamily.sans[1].letterSpacing` sets letter-spacing', async ({ expect }) => {
let input = css`
@theme default {
--default-font-family: var(--font-family-sans);
Copy link
Contributor

Choose a reason for hiding this comment

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

Not for this PR but our default theme uses --theme() instead of var(…). We should probably mirror the actual usage in these tests.

Copy link
Contributor

@thecrypticace thecrypticace left a comment

Choose a reason for hiding this comment

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

LGTM

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants