Judge the SHEET too, and correct a line-count figure the proxy flattered - #24
Merged
Conversation
Two measurements this repository could not make, and one number it published that a sharper instrument contradicts. THE SHEET. Every judge here compares a box — its x, and the sheet it landed on with its y — and none of them compares the sheet itself. v0.18.0 moved 378 leaves onto correctly oriented sheets and not one figure in corpus_test.go changed by a unit, because a leaf at the same (sheet, x, y) on a 612x792 sheet and on a 792x612 one counted as agreement. TestSheetsAgainstPdfium asks both halves. The SIZE is the weak one: 528 of the 559 forms give every page area of a form the same medium, so a sheet opened on the wrong page area is still the right size. Over the corpus the size agrees on 3 035 of 3 035 sheets, the largest disagreement in either dimension being 0.0000 pt — and v0.18.0's reported residue of "7 sheets whose size disagrees" was 7 FORMS tying at the fourth decimal, 1008.0 against 1008.0001, not a disagreement about paper at all. Which PAGE AREA a sheet was opened on has no such blind spot, and it finds ten sheets on three forms: us-uscis__g-1055 6, i-956g 3, i-956 1 — the three forms #21 and #23 left open, counted for the first time. placer.sheetAreas records it here and the probe reads it from GetPage(i)'s form node there, so it is known even on the 91 sheets of g-1055 whose page area draws no furniture. Neither side reads it off the geometry being judged. THE LINE COUNT. doc.go's "same line count as pdfium 25.9% / 82.5%" was not a line count: it was (our height less pdfium's) over OUR line height, bucketed. The proxy flatters, because a leaf that disagrees on the number of lines AND on how tall a line is can come to the same height. pdfium's probe now reports its own line count per leaf, and the answer is 23.2% and 76.3%. 1 002 leaves the proxy scored as agreeing take a different number of lines — fw9's Page4.Col2.F among them, four lines of 9 pt here against pdfium's three of 12. Where the counts do agree the whole residue is the FIRST line: 5 372 of 5 373. Our height for every line after the first is pdfium's to a hundredth of a point on 1 177 of 1 178. pdfium makes the first line the font size; pdf.js makes it the face's line height less its gap, and this follows pdf.js — so that one is a disagreement with pdfium and not a defect against the reference. Nothing in the measurement is changed for it. The layout does not move: all 560 forms are byte-identical before and after. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two measurements this repository could not make, and one published number a sharper instrument contradicts. Findings written to
/Users/Shared/xfa-measure/FINDINGS.mdas they came, with the scripts, the instrumented copies and the pdfium patch beside them.Lead with what was invisible
Ten sheets are opened on the wrong page area, and nothing here could count them.
us-uscis__g-10556,i-956g3,i-9561 — the three forms #21 and #23 left open. The sheet's SIZE cannot see it: 528 of the 559 forms give every page area of a form the same medium, so choosing the wrong one leaves the size right.doc.go's "same line count as pdfium 82.5%" was not a line count. It was(our h − pdfium h) / OUR line height, bucketed, and the proxy flatters. Counting lines with pdfium's own count in hand gives 76.3%, and 1 002 leaves the proxy scored as agreeing take a different number of lines.fw9'sPage4.Col2.F, quoted in #23 as a success, is one: four lines of 9 pt here against pdfium's three of 12 — 36 pt either way.And v0.18.0's "7 sheets whose size disagrees with pdfium" is 0. Its script compares float tuples for equality and counts FORMS; all seven are ties at the fourth decimal — 1008.0 against 1008.0001. The real content of that table row is its next line, 6 orientation errors before the fix and 0 after.
The controls, before any number
Placeis byte-identical to a real v0.18.0 build on all 560 forms, so the "no fonts" column is v0.18.0's;Gap 1 —
TestSheetsAgainstPdfiumplacer.sheetAreasrecords it here; the probe reads it fromGetPage(i)'s form node there, so it is known even on the 91 sheets ofg-1055whose page area draws no furniture. Neither side reads it off the geometry being judged.Gap 2 — pdfium's own line count
text-lines-trace.patch.py, in the probe directory beside the other two, emits per leaf pdfium measured: its line count and one height per line.lineHeightsis read where it lies; nothing is called that was not called already.Where they came from, against the old bands:
The band #23 named was genuinely mixed, near enough half and half. The worse news is the bucket above it.
Where the counts agree, the whole residue is the FIRST line — 5 372 of 5 373 — and our line height for every line after it is pdfium's to a hundredth of a point on 1 177 of 1 178. pdfium makes the first line the font size (
CXFA_TextParser::GetLineHeight,bFirst); pdf.js makes it the face's line height less its gap, 1.1172 ems for Arial, and this follows pdf.js. The gap is 0.1172 × size — 1.172 pt at ten points, 0.938 at eight — which is the measured median and quartile exactly. A disagreement with pdfium, not a defect against the reference, and nothing is changed for it.The 20% extra wraps are not pdfium's break tolerance. pdfium lets a line overrun by a fifth of the font size before breaking (
SetLineBreakTolerance(fFontSize * 0.2f)). Turning the same rule on in an instrumented copy moves the agreement 76.3% → 77.2%. Hypothesis tested and rejected.What I could NOT settle
g-1055's unpaired one are untouched.dropEmptyPagesremoves sheets; the version committed here keepssheetAreasin step with it, and no corpus form drops one (560 of 560 record exactly as many sheets as they ship), so the out-of-repository script that did not was not wrong here.Gate:
gofmtclean,go vetclean, exact 100% statement coverage withXFACORPUSunset,-race, 13 cross-compile targets,CGO_ENABLED=0,GOWORK=off, Go 1.27.1 viaGOTOOLCHAIN.🤖 Generated with Claude Code