Repository navigation
fix: stop fake spaces from shredding letter-spaced PDF text - #222
Merged
Merged
Conversation
…view gradient buttons Landing: - bump hero eyebrow v2.3 -> v2.4 to match package version - tighten hero vertical rhythm; split subtitle into nowrap phrases to drop the single-character orphan line - gate .reveal-on-scroll behind a .reveal-armed class so content stays visible when JS/observer/print contexts never trigger intersection - hover feedback for feature cards, format rows, workflow steps; CTA section gets a brand gradient bar Workbench (styles.css only): - dashed centered empty states, tab active indicator, focus-visible rings - gradient progress bar with tabular-nums percentage - stronger pane elevation, press feedback on ghost/mini/menu buttons Preview (preview.css): - explicit brand-gradient primary button rules for dark topbar context (fixes unified-button-test baseline failure: token now used 3x) Chore: add npm run dev script alongside existing start script Tests: design-token, ui-accessibility, ui-button-consistency (12/12), unified-button, smoke (60 groups), browser-smoke, ui-conversion-e2e, server-hardening all pass.
- item 拼接层空格阈值从 0.12em 提到 0.22em(近似真实空格宽度 0.25em),加字距 排版字形间隙不再被当成词间空格("E x p a n d e d" 式碎词) - pdf.js addFakeSpaces 伪空格的收拢:连续 ≥3 个单字 CJK 链去空格("加 字 距 版" →"加字距版"),多字词间对齐空格保留;拉丁碎词词边界在 pdf.js 合并 item 时已 丢失,保留原样并注明上游限制 - 回归断言:加字距字形链不拆词、CJK 伪空格收拢、多字词空格保留 Refs #216
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
变更说明
PDF 提取的多余空格有两个来源,本 PR 一并修复:
shouldSeparatePdfItems原阈值Math.max(1.5, height * 0.12)(0.12em),把加字距(letter-spacing)排版的字形间隙误判为词间空格,产生 "E x p a n d e d" 式碎词。item.str里,CJK 加字距文本被碎成「加 字 距 版」。变更内容
public/formats/pdf.jsshouldSeparatePdfItems词间空格阈值从 0.12em 提到height * 0.22(近似真实空格宽度 0.25em),加字距字形间隙不再被当成词间空格。collapseCjkFakeSpaces:连续 ≥3 个单字 CJK 以单空格相连的链收拢去空格("加 字 距 版" → "加字距版");两个多字 CJK 词之间的空格保留(表单对齐间距)。extractTextWithPdfJs的 item 映射(str:)与 textRuns 映射(text:)均经过collapseCjkFakeSpaces。scripts/layout-offset-regression-test.jscollapseCjkFakeSpaces("加 字 距 版") === "加字距版"、("逐词 绘制") 保留、("Normal spacing line") 不变。CHANGELOG.md、docs/development/DEVELOPMENT_TASKS.md:补充修复条目与验收记录。测试验证
npm test(50 个脚本)在含 pdfjs-dist 环境下全量通过(退出码 0)。node_modules/pdfjs-dist后npm test同样全量通过(退出码 0),缺 pdfjs 相关用例优雅降级 / 跳过而非失败,验证后目录已恢复。validate-spacing-pdf.mjs)5 项全部通过 + 1 项已知限制标注。validate-mixed-pdf.mjs)20/20 无回归。相关 Issue
Refs #216
注意事项
package-lock.json改动,属于并行工作,未包含在本 PR 中。