Skip to content

fix(pdf-codec): start a text run where its first glyph is painted - #1725

Merged
Mearman merged 2 commits into
mainfrom
fix/pdf-word-gaps
Oct 30, 2026
Merged

Mearman merged 2 commits into
mainfrom
fix/pdf-word-gaps

Conversation

@Mearman

@Mearman Mearman commented Oct 30, 2026

Copy link
Copy Markdown
Member

A TJ array that opens with a numeric adjustment moved the pen but not the start of the run that followed, so the run was reported from where the previous text ended and its width swallowed the gap. Typesetters start a new text-showing operator with the word space as a leading adjustment whenever state changes between words (a cross-reference in a link colour inside prose is the usual case), and every such word came out joined to the one before: "inTable", "inFig", "2-2.Generators".

showTextArray now re-takes the run's start matrix after any adjustment met before the run's first glyph, which covers both a leading adjustment and the one that has just ended the previous run. The interpreter test that pinned a leading adjustment as part of the run is changed to expect the run at its first glyph, and two more pin a narrow leading adjustment and a kerning adjustment inside a run. A pdfToMarkdown test builds a line from three TJ operators, the later two opening with -250 and the font scaled by the text matrix, with no space character in the stream; it read "shown inTable 2.Generators" before this change.

Run against a whole typeset textbook that shows the fault, the count of lowercase-then-capital joins in the Markdown dropped from 431 to 24 (the rest are symbol-font equation text), the change only ever split tokens (no new words appeared), and a report already read correctly by the earlier TJ fix came out byte for byte the same.

Closes #1724

A TJ array that opens with a numeric adjustment moved the pen but not the
start of the run that followed, so the run was reported from where the
previous text ended and its advance absorbed the gap. A producer that
starts a new text-showing operator with the word space expressed as an
adjustment (a cross-reference set in a link colour inside prose) then
had that word read as touching the one before it.

An adjustment met before any glyph of a run now moves the run start with
the pen. The interpreter test that pinned a leading adjustment inside the
run is changed to the corrected position.

Closes #1724
@Mearman
Mearman marked this pull request as ready for review October 30, 2026 20:50
@Mearman
Mearman added this pull request to the merge queue Oct 30, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ⚠️ Failed 2026-10-30T20:50:33.348949Z
We couldn’t complete this review. Comment @codex security review to try again.
7d4a56d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins.

Merged via the queue into main with commit dca3643 Oct 30, 2026
34 checks passed
@Mearman
Mearman deleted the fix/pdf-word-gaps branch October 30, 2026 20:56
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 14.6.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pdf-codec: a TJ array that opens with a word-space adjustment joins its first word to the word before

1 participant