From c2ff6d4000d16f33bb310b0699ad13c0caa5746d Mon Sep 17 00:00:00 2001
From: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Date: Fri, 22 Nov 2024 08:33:43 -0500
Subject: [PATCH 1/4] Use configured letter-spacing values for custom font-size
utilities
---
packages/tailwindcss/src/utilities.ts | 6 ++++--
playgrounds/vite/src/app.tsx | 2 +-
playgrounds/vite/src/index.css | 7 +++++++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/packages/tailwindcss/src/utilities.ts b/packages/tailwindcss/src/utilities.ts
index c5d9bdf3c6d4..d8e99dd7568f 100644
--- a/packages/tailwindcss/src/utilities.ts
+++ b/packages/tailwindcss/src/utilities.ts
@@ -4033,7 +4033,7 @@ export function createUtilities(theme: Theme) {
let value = theme.resolveWith(
candidate.value.value,
['--text'],
- ['--line-height', '--tracking', '--font-weight'],
+ ['--line-height', '--letter-spacing', '--font-weight'],
)
if (value) {
let [fontSize, options = {}] = Array.isArray(value) ? value : [value]
@@ -4067,7 +4067,9 @@ export function createUtilities(theme: Theme) {
),
decl(
'letter-spacing',
- options['--tracking'] ? `var(--tw-tracking, ${options['--tracking']})` : undefined,
+ options['--letter-spacing']
+ ? `var(--tw-tracking, ${options['--letter-spacing']})`
+ : undefined,
),
decl(
'font-weight',
diff --git a/playgrounds/vite/src/app.tsx b/playgrounds/vite/src/app.tsx
index 4abc17cb52e1..25682f4cca46 100644
--- a/playgrounds/vite/src/app.tsx
+++ b/playgrounds/vite/src/app.tsx
@@ -1,7 +1,7 @@
export function App() {
return (
-
Hello World
+
Hello World
)
diff --git a/playgrounds/vite/src/index.css b/playgrounds/vite/src/index.css
index d4b5078586e2..d631c2092048 100644
--- a/playgrounds/vite/src/index.css
+++ b/playgrounds/vite/src/index.css
@@ -1 +1,8 @@
@import 'tailwindcss';
+
+@theme {
+ --text-heading3xl: 2.25rem;
+ --text-heading3xl--line-height: 3rem;
+ --text-heading3xl--font-weight: 700;
+ --text-heading3xl--letter-spacing: -0.08375rem;
+}
From f01157a4259034f312e3ed0beb7980c3a8c4ef81 Mon Sep 17 00:00:00 2001
From: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Date: Fri, 22 Nov 2024 08:36:26 -0500
Subject: [PATCH 2/4] Update changelog
---
CHANGELOG.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9363fa3b4f0e..6ce4a9bff4dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
-- Nothing yet!
+### Fixed
+
+- Use configured `--letter-spacing` values for custom font size utilities ([#15099](https://github.com/tailwindlabs/tailwindcss/pull/15099))
## [4.0.0-beta.1] - 2024-11-21
From 791137e53e1023b5af88e46fc5739209bcc57339 Mon Sep 17 00:00:00 2001
From: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Date: Fri, 22 Nov 2024 08:44:43 -0500
Subject: [PATCH 3/4] Update UI tests
---
packages/tailwindcss/tests/ui.spec.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/tailwindcss/tests/ui.spec.ts b/packages/tailwindcss/tests/ui.spec.ts
index 445246beac4e..103307d78657 100644
--- a/packages/tailwindcss/tests/ui.spec.ts
+++ b/packages/tailwindcss/tests/ui.spec.ts
@@ -568,8 +568,8 @@ test('explicit tracking utilities are respected when overriding font-size', asyn
`,
css`
@theme {
- --text-sm--tracking: 5px;
- --text-xl--tracking: 10px;
+ --text-sm--letter-spacing: 5px;
+ --text-xl--letter-spacing: 10px;
--tracking-tight: 1px;
}
`,
From 9149dbcc8a1181b6b75695089a844e8a6b41c2fb Mon Sep 17 00:00:00 2001
From: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Date: Fri, 22 Nov 2024 08:48:46 -0500
Subject: [PATCH 4/4] Revert playground changes
---
playgrounds/vite/src/app.tsx | 2 +-
playgrounds/vite/src/index.css | 7 -------
2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/playgrounds/vite/src/app.tsx b/playgrounds/vite/src/app.tsx
index 25682f4cca46..4abc17cb52e1 100644
--- a/playgrounds/vite/src/app.tsx
+++ b/playgrounds/vite/src/app.tsx
@@ -1,7 +1,7 @@
export function App() {
return (
-
Hello World
+
Hello World
)
diff --git a/playgrounds/vite/src/index.css b/playgrounds/vite/src/index.css
index d631c2092048..d4b5078586e2 100644
--- a/playgrounds/vite/src/index.css
+++ b/playgrounds/vite/src/index.css
@@ -1,8 +1 @@
@import 'tailwindcss';
-
-@theme {
- --text-heading3xl: 2.25rem;
- --text-heading3xl--line-height: 3rem;
- --text-heading3xl--font-weight: 700;
- --text-heading3xl--letter-spacing: -0.08375rem;
-}