Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[0881] 支持 CJK 扩展区字符的正确识别与渲染
1 相关文档
2 任务相关的代码文件
lolly/lolly/data/unicode.cpp— 重构并补全is_cjk_unified_ideograph_code以支持 Extension A–J 等全套 CJK 扩展区,修复十六进制字符串字典序判定逻辑为from_hex数值比较lolly/tests/lolly/data/unicode_test.cpp— 新增覆盖全部 CJK 扩展、标点、边界以及非 CJK 负面测试的单元测试3 如何测试
3.1 确定性测试(单元测试)
3.2 非确定性测试(交互验证)
在文档中粘贴或手动输入
<#20E4C>字符(𠹌),能正确路由到 CJK 字体,且能正常渲染。4 What
U+20E4C即粤语𠹌字)时,显示为红色的<#20E4C>占位符。5 Why
unicode_get_range的 CJK 汉字检测范围极窄,仅硬编码匹配了基本区部分码点(0x4e00–0x9fcc),未涵盖 CJK Extension A–J 及兼容汉字区等现代扩展块。导致unicode_get_range(0x20E4C)返回空串,从而无法路由到默认中文字体。is_cjk_unified_ideographs等判定函数错误使用了十六进制字符串字面量进行字典序大小比较("4E00" <= r && r <= "9FBF"),导致 5 位十六进制码点(如"20E4C" < "4E00",因'2' < '4')和部分 A 区码点(首位为'3' < '4')判定全部失效。6 How
is_cjk_unified_ideograph_code(int code),完整、准确支持 CJK 统一汉字基本区、各大扩展区(Extension A–J,含最新 Unicode 17.0)及兼容汉字区。from_hex(r)先将内部十六进制 cork 字符串码点解析为整数,再进行区间比较,彻底修复了 5 位码点与特殊分区的判定逻辑。unicode_test.cpp中新增了针对标点、基本区、兼容区、Extension A–J 临界点的高密度单元测试及非 CJK 负面边界测试,并验证全部通过。