mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-11 02:41:31 -06:00
`[(FIRSTARR)] [(LASTARR)] TJ` is malformed (TJ takes one array operand), but the operator still shows the one immediately before it, as the renderer, MuPDF and pdftotext agree. Three readers here counted operands from the front instead and showed the discarded first array: - crates/edit/src/text.rs (text_lines/text_paragraphs, and the Office export through reading_lines) - crates/redact/src/interp.rs (search-based redaction's content interpreter) - crates/a11y/src/headings.rs (autotagged heading detection) So the editor could offer a word the page never draws, a redaction search could miss it, and a heading could read as text nobody sees. Take the last array for TJ in all three, matching the `_ => op.operands.last()` arm already used for Tj/'/" alongside it. Added a regression test per crate (`a_tj_with_a_surplus_array_reads_ the_last_one`, `a_tj_surplus_arrays_undrawn_glyphs_are_not_seen_ under_a_mark`, `a_heading_with_a_tj_surplus_array_reads_the_one_the_ page_draws`), confirmed each fails without its fix and passes with it. cargo test -p pdfcraft-edit (196 passed) -p pdfcraft-redact (81 passed) -p pdfcraft-a11y (44 passed), fmt, clippy -D warnings, xtask layers and xtask assets all clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
pdfcraft-a11y
Layer L4: accessibility (execution plan M12.3). Today: the Accessibility Checker's full check.
let report = check(&doc, &Options::default()); // 31 of 32 rules (colour contrast off)
let html = report_html(&report, "file.pdf", "2026-10-02", "en", &in_english); // or an interface's words
- 32 rules in 7 categories, as in Acrobat's full check: Document (permission flag, image-only, tagged, reading order, language, title, bookmarks, colour contrast), Page Content (tagged content, tagged annotations, tab order, character encoding, tagged multimedia, and four manual checks), Forms (tagged fields, descriptions), Alternate Text (figures, nested, associated with content, hides annotation, other elements), Tables (rows, cells, headers, regularity with row/column spans, summary), Lists (items, Lbl/LBody) and Headings (nesting).
- Each result is Passed, Failed (with findings and pages), Needs manual check, or Skipped.
- Content checks walk the page content streams (and form XObjects) tracking marked
content: painting outside MCID-marked or
/Artifactcontent is untagged. - Structure checks read the structure tree through the role map; table regularity counts
ColSpan/RowSpanattributes. - The report is a self-contained HTML page. Fixes that edit the document (language, title, tab
order) live in the engine (
Document::accessibility_fix).
Not yet: autotagging, the Tags/Order/Content panels, the Reading Order tool (M12.1–M12.2).