Skip to content

Compare drawn text in the text check, not the old structure's ActualText - #15

Merged
bbertucc merged 1 commit into
mainfrom
soft-hyphen
Oct 6, 2026
Merged

bbertucc merged 1 commit into
mainfrom
soft-hyphen

Conversation

@bbertucc

@bbertucc bbertucc commented Oct 6, 2026

Copy link
Copy Markdown
Member

A false text_lost on prod, reported by the Iris maintainer: a tagged Canva PDF failed with "Page 5 lost text", though its pixels were identical.

Cause. The source's structure tree gives the hyphen glyph at a wrapped URL a /HyphenSpan with ActualText U+00AD. mupdf's extraction swaps that in. Tagging replaces the old tree, so the same glyph then extracts as -. The word compare saw …2022-PA­ before and …2022-PA- after.

Fix. The text check extracts with ignore-actualtext, so both sides compare only the text that is drawn. A glyph or word really lost still fails, and the test checks that.

Test: a tagged PDF whose line ends in a hyphen glyph under ActualText U+00AD passes. The same document with the next word removed still reports it missing.

🤖 Generated with Claude Code

A tagged source can give a glyph ActualText through its structure tree, such as
a soft hyphen at a line break. Tagging replaces that tree, so the same glyph then
extracted differently and the gate reported it lost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking findings.

Non-blocking notes

  • I checked whether ignore-actualtext (src/verify/text.ts:43) hides real loss: a word drawn as one glyph but spelled out only by the old structure's /ActualText (for example, a glyph with no Unicode mapping). It does not hide it. On base, such a page fails with text_lost. On this head, the source word is reported as unmatched_text and the HTML word goes into the overlay, so the output's structure still reads the HTML's text. That case has no test. A test asserting the HTML word reaches the structure would keep this from regressing if the alignment ever starts reading ActualText.

Accessibility impact: none negative. The structure still reads the HTML's text, and a soft hyphen in a source's old ActualText no longer stops a correctly tagged PDF from being written.

@bbertucc
bbertucc merged commit 4f9b25a into main Oct 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant