fix(desktop): unify font tokens + set Noto Sans SC as default font + small text size#4041
fix(desktop): unify font tokens + set Noto Sans SC as default font + small text size#4041Li-Charles-One wants to merge 2 commits into
Conversation
SivanCola
left a comment
There was a problem hiding this comment.
感谢整理这次字体/字号统一。整体方向我认可,但现在先 request changes,主要有两个需要修完再合并的问题:
-
这个分支现在和最新
main-v2有styles.css冲突,GitHub 也显示DIRTY。请先 rebase 到最新main-v2并解决冲突,注意保留最新 base 里已经加入的.tool__summary、.reasoning__body、.copybtntransition 等样式改动。 -
system字体选项现在会失效。PR 把DEFAULT_FONT_FAMILY改成了noto,但FONT_FAMILIES里仍然保留system,applyFontFamily("system")会写入data-font-family="system"。当前 CSS 没有这个 selector,根默认又已经变成 Noto stack,所以旧用户保存的reasonix-font-family=system或设置页里选择“系统默认”时,实际还是会渲染成 Noto。请补一个:root[data-font-family="system"]使用旧的系统字体栈,或者调整默认值/attribute 映射,保证“系统默认”选项真的生效。
我本地验证过:pnpm check:css 和 text-size 单测通过;pnpm test 里的两个 command palette CSS 失败在 PR base 上也存在,不算这次新增问题。
麻烦修完这两个点后 ping 我,我会再复查,没问题就 merge。
…small text size
Font family unification:
- Fix broken CSS variable references: --font-mono → --mono, --font-sans → --sans
These undefined variables bypass user font-family preferences.
- Clean redundant fallbacks on var(--mono) (already defined with full stack).
- Change default font to Noto Sans SC (思源黑体) for consistent cross-platform
rendering. Update base :root --sans and DEFAULT_FONT_FAMILY accordingly.
- Fix statusbar font-family: was var(--mono), now var(--sans).
Font weight tokens:
- Add semantic font-weight tokens: --fw-normal(400), --fw-medium(500),
--fw-semibold(600), --fw-bold(700). Collapse 18 distinct hardcoded weights
(400-800) to 4 tokens.
Font size tokens:
- Add --text-2xl(22px) and --text-3xl(28px) for display sizes.
- Replace all hardcoded font-size values (9.5px-30px, em units) with
existing --text-* scale tokens.
- Change default text size to 'small' (--font-scale: 0.94).
- Add [data-text-size='default'] CSS rule for scale 1.0.
Statusbar cleanup:
- Remove pipe character separators; use uniform gap for all items.
- Remove max-width centering; statusbar fills available width.
- Add responsive breakpoints: 20px → 12px → 8px gap.
- Horizontal scroll on overflow (scrollbar hidden).
Before: 2 broken font-family vars, 18 font-weight values, 26 font-size values,
system-font default (varies by OS), default text size, pipe separators.
After: 0 broken vars, 4 font-weight tokens, 9 font-size tokens,
Noto Sans SC default, small text size, clean gap-based statusbar.
Verification: check:css ✅ test ✅ (181 passed, 2 pre-existing failures)
e454e2b to
9aeb0fc
Compare
|
Rebased onto latest
For the "system" 字体选项失效 issue, I added a new CSS rule: :root[data-font-family="system"] {
--sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC",
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
"Helvetica Neue", Arial, sans-serif;
}This is exactly the system font stack that was the Verification on this branch HEAD (9aeb0fc):
PR is now MERGEABLE. Please take another look — |
改动内容
统一桌面端字体系统,修复字体变量错误,调整默认字体和字号。
1. 修复字体变量错误
--font-mono->--mono,--font-sans->--sansvar(--mono)上多余的 fallback(变量本身已定义完整字体栈)2. 默认字体改为思源黑体(Noto Sans SC)
--sans是PingFang SC, Microsoft YaHei开头,不同系统渲染差异大3. 默认字号改为「小」
--font-scale从1(14px 基准)改为0.94(约 13px 基准)4. 新增字体粗细语义化 Token
--fw-normal(400)、--fw-medium(500)、--fw-semibold(600)、--fw-bold(700)5. 新增字号 Token + 替换硬编码
--text-2xl(22px)、--text-3xl(28px) 用于大标题--text-*scale6. 状态栏清理
|分隔符,改用统一的gap间距max-width: 940px居中,状态栏铺满可用宽度为什么字体统一很重要
--font-mono和--font-sans这两个变量名不存在,CSS 直接 fallback 到硬编码字体。用户在设置里选「微软雅黑」或「苹方」,这些元素完全不受影响,等于白设。font-size: 12.5px不会跟着--font-scale变,导致「有的地方大了有的地方没变」,视觉上很割裂。验证
影响范围
只改了
styles.css、fontFamily.ts、textSize.ts和对应的测试文件,不涉及任何组件逻辑变更。