Skip to content

Keep kerning across word boundaries when checking line fit - #1883

Open
xmsnmo444 wants to merge 1 commit into
foliojs:masterfrom
xmsnmo444:fix/wrap-kerned-table-text
Open

xmsnmo444 wants to merge 1 commit into
foliojs:masterfrom
xmsnmo444:fix/wrap-kerned-table-text

Conversation

@xmsnmo444

Copy link
Copy Markdown
Contributor

Fixes #1882, reported by Jens-Rydholm-Humly.

With Helvetica at 11 pt, PDFKit measures Jane Walker at 59.807 pt. Measuring Jane and Walker separately gives 60.247 pt. When the table draws the cell at its measured width, the wrapper breaks the line before the surname and emits Jane….

When a word appears to overflow a nonempty line, check the width of the joined text before breaking. This accounts for kerning across the break opportunity. Explicit word spacing keeps its existing per-word behavior.

Added a regression through doc.table() and a boundary test for a line at its measured width and 0.1 pt below it. The project suite passed all 673 tests, plus 53 tools tests. Extracting text from a generated PDF also verified the four names in the report and the Jane Smith control.

OpenAI Codex reproduced the report, prepared the change, and ran the checks.

This branch has not been deployed

No deployments
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.

doc.table() truncates cell text with "…" when a space is followed by a kerned letter (regression in 0.21.0)

1 participant