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
This commit is contained in:
yyhuni
2025-12-12 20:23:21 +08:00
parent c660447eca
commit bb90ced642
3 changed files with 15 additions and 2 deletions

View File

@@ -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"
}
}

View File

@@ -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",

View File

@@ -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