From 695d89fdf0ad92e46c94f5cf62029d02fb18dad0 Mon Sep 17 00:00:00 2001 From: duorameng <2997944583@qq.com> Date: Tue, 21 Apr 2026 11:17:20 +0800 Subject: [PATCH] chore : update font style --- web/src/App.vue | 6 ++++++ web/src/assets/index.css | 13 ++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/web/src/App.vue b/web/src/App.vue index 4a46312..cb9c02d 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -7,6 +7,12 @@ onMounted(() => { // 全局应用设备差异化垂直抗锯齿 const isMac = /Mac|iPod|iPhone|iPad/.test(navigator.userAgent) document.documentElement.classList.add(isMac ? 'antialiased' : 'subpixel-antialiased') + + // Windows 平台检测,用于在 CSS 中调整字体优先级 + const isWindows = /Win/.test(navigator.userAgent) + if (isWindows) { + document.documentElement.classList.add('is-windows') + } }) diff --git a/web/src/assets/index.css b/web/src/assets/index.css index bbd63ce..3fb84ae 100644 --- a/web/src/assets/index.css +++ b/web/src/assets/index.css @@ -100,6 +100,13 @@ --sidebar-accent-foreground: #333333; --sidebar-border: #e5e7eb; --sidebar-ring: #9ca3af; + + /* 字体栈定义 */ + --font-main: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans CN", sans-serif; +} + +.is-windows { + --font-main: 'Inter', 'Noto Sans SC', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans CN", sans-serif; } /* OKLCH support targeting modern browsers */ @@ -216,8 +223,8 @@ body { @apply bg-background text-foreground antialiased; - /* 增强字体栈:优先 Inter,同时补充 Noto Sans SC 以及安卓/Linux 中文字体 */ - font-family: 'Inter', 'Noto Sans SC', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans CN", sans-serif; + /* 增强字体栈:根据平台差异化 Noto Sans SC 与 system-ui 的优先级 */ + font-family: var(--font-main); font-size: 14px; line-height: 1.5; letter-spacing: -0.01em; @@ -227,7 +234,7 @@ } input, textarea, button, select { - font-family: 'Inter', 'Noto Sans SC', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans CN", sans-serif !important; + font-family: var(--font-main) !important; } .font-code,