Skip to content

中文段落里的引号和省略号用中文字体,英文段落不变 - #489

Merged
PathGao merged 1 commit into
mainfrom
cjk-quote-font
Nov 18, 2026
Merged

PathGao merged 1 commit into
mainfrom
cjk-quote-font

Conversation

@PathGao

@PathGao PathGao commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Windows 上 “ ” ‘ ’ … 在中文句子里只有汉字的 38% 宽(#487)。原因是字体栈里 Segoe UI 自带这几个字形,轮不到后面的中文字体;macOS 上 SF 同理,只是不明显。

这几个字符中英文共用,按字符换字体(issue 里的 unicode-range 方案)会让英文字幕和英文回答里的引号也变宽。所以改成按语言:MdgCommon.textLang 判断一段文字有拉丁字母、没有中日韩文字时为英文;AI 回答的每个块、提问、输入框、阅读页的字幕/章节/标题按它标 lang="en"。--font-sans 前面加一个只覆盖这 5 个码位的 MdgCjkPunct(苹方 / 微软雅黑),[lang="en"] 用不带它的 --font-sans-en。content.css 的英文规则只限在阅读页自己的节点里,不碰宿主页面。

对比:ChatGPT、Claude.ai、Kimi、知乎都不处理;DeepSeek 全站给引号套苹方(quote-cjk-patch),只在一行有德语 „ 时跳过,英文回答也受影响,Windows 上没有苹方所以不生效。

验证

  • macOS,node scripts/selftest.mjs:51 个通过,新增 textLang 和按块标语言的用例。
  • node scripts/smoke.mjs:通过(各页面、B站和 YouTube 视频页无报错)。
  • macOS Chrome 量引号宽 / 汉字宽:中文段落 0.44 → 0.54(苹方),英文段落 0.44 不变。
  • 没测到:Windows 上的效果(预期微软雅黑引号与汉字同宽),请报告人帮看。

关联 issue

Closes #487

@PathGao
PathGao merged commit d4bca64 into main Nov 18, 2026
2 checks passed
@PathGao
PathGao deleted the cjk-quote-font branch November 18, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows 下中文引号被 Segoe UI 接管,宽度只有汉字的 38%

1 participant