Files
pdfcraft/crates/a11y
b9f0f84ff8 fix(a11y): bookmarks from structure keep the words of glyph-by-glyph headings (#1899)
* fix(a11y): bookmarks from structure keep the words of glyph-by-glyph headings

Chromium (Skia) draws text one glyph at a time, each moved into place with
its own Td. The marked text of a heading added a space at every Td, TD, T*
and Tm, so New Bookmarks from Structure titled them "C h a p t e r T w o",
and the real spaces between words were lost. On a 20-page tagged guide
printed by Chromium, 25 of 61 titles came out spaced.

mcid_texts now follows the text matrix (and the CTM, q/Q, Tc, Tw, Tz, TL)
and decides word breaks from where the glyphs are: a glyph that starts on
another line, more than 0.2 em after the previous glyph of the same marked
content, or back over more than an em, starts a new word. Kerning and
glyph-by-glyph placement no longer split words.

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

* fix(a11y): headings set with a negative font size keep their words

The em that decides word breaks was the font size times |Tz|, negative with
a negative font size: every glyph then started a new word, and a heading in
one Tj read "C h a p t e r O n e". The em is now |size x Tz|, and "ahead"
follows the way glyphs advance in text space, backwards when the size or Tz
is negative, so a TJ word space still splits words there as on main.

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

* fix(a11y): keep wrapped headings separate under horizontal scaling

Co-Authored-By: OpenAI Codex <noreply@openai.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
2026-10-15 02:28:01 -04:00
..

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 /Artifact content is untagged.
  • Structure checks read the structure tree through the role map; table regularity counts ColSpan/RowSpan attributes.
  • 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).