boardx / boardx/workspacex

沙箱 CJK 字体是构建期子集:扩展区/假名/谚文/BMP 外繁体会静默渲染成豆腐块

Open
#3,410 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
1h 7m
Merged PRs (30d)
969

Description

## 沙箱镜像里的中文字体是构建期子集,超出范围会渲染成豆腐块

**实测(#3403 排查途中的旁证,实测 SHA `4fd35a9ff`)**:

沙箱镜像里 CJK 只有 **`NotoSansSC-Common.otf` 一个构建期子集**,覆盖范围:

- ASCII
- 约 40 个标点
- `U+4E00..9FFF`(CJK 统一汉字基本区)

且**只有 Regular 一个字重**。

⇒ 以下内容会渲染成**豆腐块**(□):
- **CJK 扩展 A/B 区**(较生僻字、部分人名地名用字)
- **假名**(日文)
- **谚文**(韩文)
- **BMP 之外的繁体字**

## 为什么单独立项

这是**正确性风险,不是速度风险**——与 #3401(PDF 提速)/ #3403(PPT 挂死)都不同。

用户生成的 Office 产出(PDF / PPTX / DOCX / XLSX)只要含上述字符,就会静默变成方块。**用户不会收到任何提示**,他只会看到产出里有一堆 □,而且很可能以为是自己输入的问题。

这与本仓一族问题同源:**系统做了降级处理,却不告诉用户**(#3280 / #3323 / #3403 ④)。

## 要判定的

1. 子集范围是**刻意的取舍**(镜像体积)还是**疏漏**?——先查构建脚本与其注释,别假设。
2. 若是取舍,**缺失字符出现时应当怎么办**?至少三选一,给推荐:
- 渲染前检测并**明确告知用户**「这些字符无法渲染」;
- 回退到一个覆盖更全的字体(体积代价要给数字);
- 按需拉取字体子集。
3. **字重只有 Regular** 的影响:加粗/斜体在 Office 产出里如何表现?是合成还是忽略?

## 要求

- **会红的断言必须落在「产出里那个字符真的被正确渲染」**,不能只判「字体文件存在」或「渲染退出码为 0」——现状下两者都满足,而用户看到的是方块。参照本仓已确立的做法:判**用户看见的那个结果**。
- **三步反证**:造出缺陷形状(用一个超出子集的字符)→ 断言变红并贴真实输出 → 撤掉 → 恢复绿。**只贴绿不算数**(本仓已九次「全绿但空转」)。
- 若判定为「刻意取舍且不改」,那也是结论——但**必须把「告知用户」那一半做掉**,不允许静默降级。

## 相关

#3403(PPT 渲染链路的孙进程管道泄漏)、#3401(PDF 技能正文缺颜色指引)、#979(pdf-lib 的已知坑)。

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the sandbox image build script and its font-related comments, then reproduce the issue using a character outside U+4E00–9FFF in a PDF, PPTX, DOCX, or XLSX output. Add an assertion against the rendered artifact, not merely font presence or exit status, and verify the three-step red/green evidence. Done requires a decided fallback or explicit user warning, plus evidence for Regular-only weight behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, infrastructure, testing
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.