Skip to content

Preserve word spacing across rotated text runs - #199

Merged
silverstein merged 2 commits into
masterfrom
fix-rotated-word-spacing-20260918
Sep 18, 2026
Merged

silverstein merged 2 commits into
masterfrom
fix-rotated-word-spacing-20260918

Conversation

@silverstein

@silverstein silverstein commented Sep 18, 2026

Copy link
Copy Markdown
Member

Summary

Preserve source-backed spaces between text runs on rotated pages. The layout builder previously measured gaps only in viewport x coordinates, which can turn a real gap into an apparent overlap on an upside-down page.

The shared implementation now projects adjoining edges along their co-directed text advance. Existing spacing thresholds, line grouping, source order, and degenerate/differently directed fallback remain unchanged. This also corrects spacing within already-grouped short quarter-turn runs; it does not reconstruct rotated paragraphs.

Source and packaged-share implementations are identical. The extraction oracle was regenerated through the existing generator; only three source-identity metadata values changed, not expected document results. No schema, tool registration, version or dependency change.

Verification

  • Stonebook macOS 15.7.9, Intel x64, Node 26.5.0, one test worker.
  • Initial focused/adjoining bank: 215/215 across eight files, including all three extraction-oracle suites.
  • Reviewer-requested short-run expansion: 48/48 native PDF spacing cases. Runtime and oracle unchanged from the initial bank.
  • Negative mutation restoring only the old gap formula: eight expected positive-gap failures, 40 passing controls.
  • All rotations, offset CropBox/UserUnit, positive/touching/overlapping gaps, source/share parity, source replay, and mocked inverted LTR/RTL controls.
  • Actual MCP development regression on independently transformed external PDF: 40/40 sampled text anchors and 5/5 geometry checks; original 39/40 failure preserved. Four unaffected variant bodies remain byte-identical. All conversions still report their unrelated partial-coverage gaps.
  • Independent review approved exact 55a80765a0914cec462e12c01a762fb67d3c7c5b and separately verified the retained regression hashes and original failure. Full supported-runtime CI remains the merge gate.

No OCR, model/provider calls, release, whole-document completeness, or comparative benchmark claim.

@silverstein
silverstein merged commit b0deb60 into master Sep 18, 2026
2 checks passed
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