Repository navigation
Description
ISO 19005-2 §6.2.11.4.1 scopes the embedding requirement to fonts used for rendering, and its NOTE 2 records that text rendering mode 3 neither strokes, fills nor clips, so a font drawn only that way is not rendered. FontEmbeddingRule has no rendering-mode filter, which makes it stricter than the standard and stricter than veraPDF, and produces a false positive on the commonest real case: a scanned page carrying an invisible OCR text layer. This is row D4 of docs/conformance-divergences.md.
An implementation was written and reviewed on the branch behind #445 and then taken back out of it, because two rounds of review did not make it safe. The work is preserved on feat/mode3-exemption. This issue records what was learned, so the next attempt does not rediscover it.
Why it is harder than it looks
The exemption has to decide that something did not happen. ContentStreamUsage.Analyze reads a page's own /Contents and nothing else: its Do case records an XObject name without recursing, and annotation appearance streams and Type 3 glyph procedures are never scanned. While that limit only shrank the set of fonts checked it was safe under-detection. Using the same partial scan to grant an exemption turns every blind spot into a wrong pass, and for a validator a false negative is the worst output there is.
The rejected implementation tried to enumerate the ways the scan could be incomplete and suppress the exemption in each. Reviewers found five more ways after four had been closed, which says the shape is wrong rather than that the list was short.
Design constraint for the next attempt: an unrecognised construct must default to reporting. Ask whether the page is provably fully scanned, not whether it matches a known-dangerous pattern. Concretely, an XObject should suppress unless its /Subtype resolves definitively to /Image, rather than suppressing only when it resolves definitively to /Form.
The alternative worth weighing first is #450: route the font rules through GetReachableContentStreams, which already exists and is used by five other rules, so the evidence is complete and no suppression is needed at all.
Defects found in review, all with working reproducers
Each of these was demonstrated against a built fixture, not argued.
- A
/Contentsarray whose element fails to resolve or decode is silently dropped byAppendStream, so the incompleteness flag stays false when any other element decoded. Verified with a dangling element, and with an element carrying/Filter /DCTDecodefor whichPdfFilters.Decodereturns null by design. Per ISO 32000-1 §7.8.2 the array is one logical stream, so the missing element can hold the visible show. ParseIntaccumulates unchecked, so a rendering-mode operand of4294967299wraps to exactly 3 and is read as a confirmed invisible draw.ParseIntis shared with MCID parsing, so a bounded parse fixes more than this rule.SkipInlineImageDataresumes at the first whitespace-delimitedEIinside attacker-controlled sample bytes, so an inline image can inject3 Trahead of a genuinely visible show.- Building a
PdfNamefrom a content-stream XObject name throws on the legal zero-length name/, which aborts the rule for the whole document rather than for that page. - An ExtGState
/Fontentry re-selects a font behind a show that the scan attributes to a different resource name, since onlyTfis tracked.usage.AppliedExtGStatesis already collected. - An XObject with no
/Subtype, or one that is an indirect reference to a non-name, is neither Form nor Image and falls through the suppression. - Pages dropped by the page-tree walk — past the depth cap, revisited, or not resolving to a dictionary — can hide a visible show the same way.
Test gaps found in review
Three of the four suppression triggers had no test at all: deleting the incomplete-content branch, the annotation-appearance branch, or the Type 3 branch each left the entire suite green. Only the form-XObject branch was pinned.
A helper, BuildFontPdfWithXObject, numbers its font one object low, so its fixtures ship a self-referential /FontDescriptor. Harmless today because the descriptor resolves to a dictionary with no /FontFile* either, but flipping a caller to embedded: true would silently invert the test.
The documented behaviour change — a font dictionary written directly into /Resources /Font and used on several pages is reported once rather than once per page — is real and measured, and no test pins it.
What the branch got right and should be kept
Aggregation per font across the whole document, keyed on object number for indirect references and on the dictionary instance for direct ones, so the same resource name naming different fonts on different pages does not merge. A confirmed mode-3 show required to exempt, so every visible mode, mode 7 and the unknown-mode sentinel all defeat it. Fifteen tests, of which the mutation matrix showed eight distinct wrong predicates are each caught by at least one.
Provenance
§6.2.11.4.1 and its NOTE 2 were read first-hand through a licensed single-user viewer on 2026-09-08. Person-verified, not reproducible by CI or from a clone. veraPDF's predicate is readable from the bundled profile in its jar; note that its model dispatches the same rule to the descendant CIDFont, so it does not exempt composite fonts, contrary to a claim made and withdrawn during this work.
Activity
Tim81 commentedon Sep 9, 2026
The preserved branch is now pushed:
feat/mode3-exemptionat e684e8e.It sits on the pre-split commits of #445, so it will need rebasing onto
mainbefore the work resumes. Its last two commits are the ones to keep: the rule change plus fifteen tests, and the divergence-document rewrite that goes with them. The three review reports the findings above come from were run against exactly that tree.fix(kernel): finish the citation sweep, and stop the enum overstating…
docs: fix five claims three reviewers measured as wrong
fix(conformance): correct sixteen PDF/A clause citations (#445)