web-font/backend/font_util/common_chars.ts
崮生(子虚) 1ffb1632b2 glyph-match 重构: 锚点索引+聚类剪枝+串行事件收集, 修复响应双 header 截断
- 慢路径 subset(查询字+锚点字) 顺带建 .gidx, 冷启动 39.75s→0.43s
- 去 async generator/worker 池/流式 pipeTo: LLRT 下非确定性饿死/segfault
- eventsCache(fontPath+查询签名 LRU64): 重复查询免裁剪, 稳态 42ms
- server 层 _bodyBytes 通道: header+body 单帧写回 + Content-Length
- 修复 bodyBytes 分支头部双写导致响应尾部截断(done 事件丢失)
- tcp 层 fire-and-forget write, close 只 end 不 destroy(保写缓冲)
- 慢路径并发度 GLYPH_MATCH_SLOW_CONCURRENCY 可配(默认1)
- 聚类排序+剪枝(PRUNE_MARGIN=0.35)减少冷路径裁剪量
2026-11-02 20:26:58 +08:00

8 lines
783 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 聚类锚点字(32 字,覆盖独体/上下/左右/包围/繁复结构)。
* 字形索引只存锚点字的位图:体积 ~10KB/字体,用于字体间相似度聚类;
* 搜索评分本身走裁剪管线(subsetCache 兜底),不依赖索引覆盖查询字。
*/
export const ANCHOR_CHAR_CODES: readonly number[] = [19968,21313,20154,22763,20013,27704,19996,22269,30446,26085,26376,27700,28779,23665,30707,29579,37329,26408,31166,24515,25163,25345,25991,36710,38376,21069,39118,38632,40857,40060,40479,39532];
/** 锚点字字符串形式(与 ANCHOR_CHAR_CODES 同源),慢路径裁剪时拼进文本,一次 subset 同时产出评分与索引素材 */
export const ANCHOR_CHARS: string = ANCHOR_CHAR_CODES.map((cp) => String.fromCodePoint(cp)).join("");