From bb90ced6425fc2bfdae5b8fb525707ca7f1430ba Mon Sep 17 00:00:00 2001 From: yyhuni Date: Fri, 12 Dec 2025 20:23:21 +0800 Subject: [PATCH] Add Noto Sans SC local font package to replace system font fallback - Add @fontsource/noto-sans-sc dependency (weights 400, 500, 700) - Import Noto Sans SC font files in root layout - Update fontFamily to prioritize Noto Sans SC before system fonts - Replace system-ui fallback comment with local font loading description --- frontend/app/layout.tsx | 8 ++++++-- frontend/package.json | 1 + frontend/pnpm-lock.yaml | 8 ++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/frontend/app/layout.tsx b/frontend/app/layout.tsx index 98607374..23887ba5 100644 --- a/frontend/app/layout.tsx +++ b/frontend/app/layout.tsx @@ -4,6 +4,10 @@ import type { Metadata } from "next" // 导入全局样式文件 import "./globals.css" +// 导入思源黑体(Noto Sans SC)本地字体 +import "@fontsource/noto-sans-sc/400.css" +import "@fontsource/noto-sans-sc/500.css" +import "@fontsource/noto-sans-sc/700.css" // 导入颜色主题 import "@/styles/themes/bubblegum.css" import "@/styles/themes/quantum-rose.css" @@ -30,11 +34,11 @@ export const metadata: Metadata = { generator: "XingRin", // 生成器标识 } -// 使用原有的 fallback 字体栈,不依赖 Google Fonts +// 使用思源黑体 + 系统字体回退,完全本地加载 const fontConfig = { className: "font-sans", style: { - fontFamily: "system-ui, -apple-system, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif" + fontFamily: "'Noto Sans SC', system-ui, -apple-system, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif" } } diff --git a/frontend/package.json b/frontend/package.json index f096c342..2a1d75ce 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -14,6 +14,7 @@ "@dnd-kit/modifiers": "^9.0.0", "@dnd-kit/sortable": "^10.0.0", "@dnd-kit/utilities": "^3.2.2", + "@fontsource/noto-sans-sc": "^5.2.8", "@hookform/resolvers": "^5.2.2", "@monaco-editor/react": "^4.7.0", "@radix-ui/react-alert-dialog": "^1.1.15", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index 0deb6405..4841d3f6 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: '@dnd-kit/utilities': specifier: ^3.2.2 version: 3.2.2(react@19.1.2) + '@fontsource/noto-sans-sc': + specifier: ^5.2.8 + version: 5.2.8 '@hookform/resolvers': specifier: ^5.2.2 version: 5.2.2(react-hook-form@7.65.0(react@19.1.2)) @@ -344,6 +347,9 @@ packages: '@floating-ui/utils@0.2.10': resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==} + '@fontsource/noto-sans-sc@5.2.8': + resolution: {integrity: sha512-8T8HxIS3uAMCfaQawKRH/6yYZ1oRnJZB/CrGwfxGgJa+zAOBgx2lqZMiTY/WbQpLGlPRqX4zHXJYI09CI2q6tA==} + '@hookform/resolvers@5.2.2': resolution: {integrity: sha512-A/IxlMLShx3KjV/HeTcTfaMxdwy690+L/ZADoeaTltLx+CVuzkeVIPuybK3jrRfw7YZnmdKsVVHAlEPIAEUNlA==} peerDependencies: @@ -3349,6 +3355,8 @@ snapshots: '@floating-ui/utils@0.2.10': {} + '@fontsource/noto-sans-sc@5.2.8': {} + '@hookform/resolvers@5.2.2(react-hook-form@7.65.0(react@19.1.2))': dependencies: '@standard-schema/utils': 0.3.0