Skip to content

test: pin text and font output to its ISO clauses - #755

Merged
Tim81 merged 9 commits into
mainfrom
test/conformance-audit-g2
Nov 28, 2026
Merged

Tim81 merged 9 commits into
mainfrom
test/conformance-audit-g2

Conversation

@Tim81

@Tim81 Tim81 commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Pins the text and font output of v2.4 to the ISO clauses it claims, one test per clause. Test and docs only: nothing under src/ changes.

  • ConformanceAuditG2Tests (Kernel.Tests): fonts and ToUnicode in ConformanceAuditG2Tests.Fonts.cs, tabs, Preformatted, joined runs and the Layout reports in ConformanceAuditG2Tests.Text.cs, readers in ConformanceAuditG2Support.cs. Fixtures use only the fonts in the tree: DejaVu Sans, Source Sans 3 Extra Light and the twelve bundled Liberation programs.
  • docs/conformance-v2.4.md: the G2 section, 56 clause rows (35 compliant, 15 gap, 6 not applicable, 0 human-only) and a second table of 6 product pins that no clause requires.
  • VellumPdf.Kernel.Tests.csproj gains a reference to VellumPdf.Fonts.Standard14, which the Liberation tests use.

Each test first asserts the construct is in the saved file, then checks the written keys, codes and bytes against the clause, then runs the oracles where a rule exists (veraPDF 2b, 2u, 2a and UA-1 as the fixture claims, qpdf --check, poppler). The tests locate font tables with the library's SfntFont.Parse, parse one CFF with the library's CffFont, and take tab positions from TextStyle.MeasureString. The table contents, the cmap, the hmtx widths and the head box are decoded in the test.

veraPDF does not see glyph 0 in an OpenType CFF font: its 6.2.11.8-1 passed a Source Sans 3 file that shows glyph 0 once. A pinned test records it.

Gaps

Ten skipped tests mark requirements the code does not meet. Each skip reason names its issue. Three of the gap issues are new (#752, #753, #754). Eleven rows cite only issues that already exist: the fsType row (#267), the soft line end, Preformatted line end, paragraph line break and 6.7.3.2 rows (#588), the 6.2.11.4.1, Symbol and ZapfDingbats ToUnicode and 7.21.4.1 note 5 rows (#711, #474), the glyph 0 row (#474), the private use row (#602) and the 6.7.3.1 row (#303).

Issue Gap
#752 U+FEFF is drawn and ToUnicode maps its glyph to U+FEFF, which 2u, 2a and UA-1 forbid (Kernel, and Layout paragraph, heading, list item and table cell)
#753 Every embedded font is flagged Nonsymbolic, even when the subset shows characters outside the Adobe standard Latin set
#754 The subset tag hashes the glyph ids alone: Liberation Sans, Sans Bold, Serif and Mono Bold drawing one text in a PDF/A-2b file share a tag
#267 fsType is parsed and not enforced
#474, #711 Glyph 0 and Standard 14 fonts under a claim are reported, not refused
#588 No space in the show string at a soft line end, a Preformatted line end or a paragraph's explicit line break
#602 No ActualText for a private use character under PDF/A-2a
#303 The artifact sequences are bare /Artifact (6.7.3.1, a should)

Mutations

Fourteen mutations of src were each run against the whole class. Twelve fail at least one test; the last, which writes the form Table 121 recommends, must pass and does. The mutated source was restored with git checkout -- src after every run.

Mutant Failing tests
FontBBox xMax rounded to nearest Iso32000_1_9_8_FontBBoxIsTheHeadBoxScaledToAThousandAndRoundedOutward
FontBBox yMin rounded to nearest Iso32000_1_9_8_FontBBoxOfALiberationProgramIsItsHeadBoxRoundedOutward (12 cases)
ItalicAngle sign flipped Iso32000_1_9_8_ItalicAngleIsNegativeForAFaceThatSlopesToTheRight
Every width plus two the widths test and the six tests that run veraPDF on font fixtures (7 tests)
ToUnicode first line ends with CR LF Issue647_EveryLineOfAToUnicodeCMapEndsWithOneLineFeed
bfchar block of 200 entries the 100-entry block test and the round-trip test
Flags 32 or 4 Iso32000_1_9_8_2_FlagsHoldNoUndefinedBitAndExactlyOneOfSymbolicAndNonsymbolic
Wrong high surrogate in ToUnicode the surrogate pair, cmap and poppler round-trip tests (5 tests)
Composite components not kept in the subset Iso32000_1_9_7_4_2_ASubsetDefinesGlyphZeroAndEveryGlyphItShows
CFF subset blanks every shown glyph the same test, plus three oracle and pin tests
CFF subroutine closure empty, so every subroutine is blanked Iso32000_1_9_7_4_2_ASubsetDefinesGlyphZeroAndEveryGlyphItShows, plus three oracle and pin tests
Type0 BaseFont of a CFF font takes Table 121's recommended form none (the should is no longer asserted)
Preformatted tab always a full width Issue662_APreformattedBlockExpandsTabsToSpacesAndKeepsEveryOtherSpace
Right tab stop aligned left Issue653_ATabIsNeverShownAndALeaderIsAnArtifactPathNotText

Gates

Release, REQUIRE_ORACLES=1, veraPDF 1.30.4, qpdf 12.4.2:

  • Build: 0 warnings, 0 errors.
  • VellumPdf.Kernel.Tests: 3579 total, 3544 passed, 35 skipped, 0 failed on net10.0 and on net11.0.
  • ConformanceAuditG2Tests: 261 total, 251 passed, 10 skipped (the gap tests), on both.
  • dotnet format --verify-no-changes, eng/clean-room-check.ps1 and eng/generate-roadmap.py --check pass.

Not done

@Tim81
Tim81 merged commit e4609f7 into main Nov 28, 2026
4 checks passed
@Tim81
Tim81 deleted the test/conformance-audit-g2 branch November 28, 2026 18:30
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