From 62090c7742b4681deb6e817c091378e9b5cf3afa Mon Sep 17 00:00:00 2001 From: gbanyan Date: Fri, 13 Feb 2026 16:08:26 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=AD=97=E4=BD=93?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=80=A7=E8=83=BD=E5=92=8C=E5=AD=97=E9=97=B4?= =?UTF-8?q?=E8=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 adjustFontFallback: false 优化 CLS(累积布局偏移) - 调整霞鹜文楷字间距:从负值改为正值,让手写风格字体更自然 - h1: -0.03em → 0.01em - h2: -0.02em → 0.015em - type-display: 添加 0.01em - type-title: 0.02em → 0.025em - 改善字体加载时的视觉稳定性 Co-authored-by: Cursor --- app/layout.tsx | 1 + styles/globals.css | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index 35688f8..623803e 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -18,6 +18,7 @@ const lxgwWenKai = LXGW_WenKai_TC({ variable: '--font-serif-cn', display: 'swap', preload: true, + adjustFontFallback: false, // 中文字体不需要 fallback 调整,使用系统字体作为 fallback }); export const metadata: Metadata = { diff --git a/styles/globals.css b/styles/globals.css index a151927..63e22d1 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -219,7 +219,7 @@ body { line-height: 1.25; color: var(--color-ink-strong); font-weight: 700; - letter-spacing: -0.03em; + letter-spacing: 0.01em; /* 手写风格字体需要稍微增加字间距 */ font-family: var(--font-serif-cn), var(--font-serif-eng), "Songti SC", serif; } @@ -228,7 +228,7 @@ body { line-height: 1.3; color: var(--color-ink-strong); font-weight: 600; - letter-spacing: -0.02em; + letter-spacing: 0.015em; /* 手写风格字体需要稍微增加字间距 */ font-family: var(--font-serif-cn), var(--font-serif-eng), "Songti SC", serif; } @@ -410,6 +410,7 @@ body { line-height: 1.2; font-weight: var(--font-weight-semibold); font-family: var(--font-serif-cn), var(--font-serif-eng), "Songti SC", serif; + letter-spacing: 0.01em; /* 手写风格字体需要稍微增加字间距 */ } .type-title { @@ -417,7 +418,7 @@ body { line-height: 1.3; font-weight: var(--font-weight-semibold); font-family: var(--font-serif-cn), var(--font-serif-eng), "Songti SC", serif; - letter-spacing: 0.02em; + letter-spacing: 0.025em; /* 手写风格字体需要稍微增加字间距 */ } .type-subtitle { @@ -425,7 +426,7 @@ body { line-height: 1.35; font-weight: var(--font-weight-medium); font-family: var(--font-serif-cn), var(--font-serif-eng), "Songti SC", serif; - letter-spacing: 0.02em; + letter-spacing: 0.02em; /* 保持原有字间距 */ } .type-body { @@ -442,13 +443,13 @@ body { h1 { font-weight: 700; - letter-spacing: -0.03em; + letter-spacing: 0.01em; /* 手写风格字体需要稍微增加字间距 */ font-family: var(--font-serif-cn), var(--font-serif-eng), "Songti SC", serif; } h2 { font-weight: 600; - letter-spacing: -0.02em; + letter-spacing: 0.015em; /* 手写风格字体需要稍微增加字间距 */ font-family: var(--font-serif-cn), var(--font-serif-eng), "Songti SC", serif; }