Repository navigation
Conversation
There was a problem hiding this comment.
All checks pass. I confirmed the new test fails with text_lost once placed is reverted to box: w.box, so it guards the fix.
I also checked a case the PR doesn't test. mupdf's extractor already drops a word drawn entirely off the page. So the clamp in src/tag.ts:252 never produces an inverted box (x0 > x1, which Overlay.word would draw at size 0.5 and scale 0.1), and inverted boxes can't reach the overlay today.
Non-blocking notes
src/tag.ts:252Math.max(w.box[0], page[0]): the left-edge half of the clamp has no test. Only the right edge (Hailat x=276.4) is exercised. A word starting at x=-10 extracts with box[-1.34, …]and is clamped to 0, but the test suite never checks that path.src/tag.ts:252: the clamp is horizontal only. The same glyph-dropping could hit a word that crosses the top or bottom edge. Not reached by any known input.- If extraction ever keeps off-page glyphs (for example, a changed mupdf stext option),
placedwould producex0 > x1. A guard such asMath.min(x0, x1)would rule that out.
Accessibility impact: Words cut by the page edge now keep every letter in their tagged text, and nothing a screen reader gets is lost or reordered.
… every letter Extractors drop glyphs off the page. A source word whose last glyph starts just inside the page edge kept it, but ours, stretched to the same box in another font, could start just outside, and the text gate failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All checks pass.
My earlier note that the left-edge clamp had no test is fixed in 0dd1f0a. I put w.box[0] back in place of Math.max(w.box[0], page[0]) in src/tag.ts:279, and the new iWall at x=-4 case then failed with text_lost ("Page 1 lost text."). So the test guards both edges now.
Non-blocking notes
- These are unchanged since 02bf560. The clamp is horizontal only, and nothing guards against
x0 > x1if extraction ever keeps glyphs that are off the page. No known input reaches either case.
Accessibility impact: Words cut by either side edge of the page now keep every letter in their tagged text, and nothing a screen reader gets is lost or reordered.
Newsletter-Winter-2016-Final failed
text_lostwith "5 characters of the tagged text are not readable" on pages 2 and 3.The cause: words that run off the page's right or left edge. Extractors drop glyphs off the page. The source word's last glyph started just inside the edge, so it was kept. Ours, stretched to the same box in Helvetica, started just outside, so it was dropped ("Evan" read back as "Eva").
The fix clips the overlay word's box to the page horizontally, so the whole tagged word is drawn on the page. The text a screen reader gets is unchanged.
The test uses a monospaced source word whose narrow last letter starts just inside the page edge. It fails before the fix with
text_lost. The newsletter (kept local) now tags with pixels identical and text preserved.🤖 Generated with Claude Code