Repository navigation
ROB: Keep the text state when a text state operator has no operand in layout mode - #4232
Merged
stefan6419846 merged 1 commit intoOct 27, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4232 +/- ##
==========================================
- Coverage 98.19% 98.19% -0.01%
==========================================
Files 59 59
Lines 11850 11847 -3
Branches 2228 2228
==========================================
- Hits 11636 11633 -3
Misses 118 118
Partials 96 96 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
stefan6419846
requested changes
Oct 21, 2026
Contributor
Author
|
I tried it, but it is not quite equivalent: for |
stefan6419846
approved these changes
Oct 27, 2026
This was referenced Oct 28, 2026
stefan6419846
pushed a commit
that referenced
this pull request
Oct 31, 2026
* ROB: Tolerate extra operands before Tm/cm in layout mode A matrix operator consumes the 6 operands nearest to it; values left on the operand stack before those (malformed content streams) overflowed TextStateManager.new_transform() and raised TypeError in layout mode text extraction. Complete the matrix with only the last 6 operands in _complete_matrix and add_cm, mirroring the tolerance already in place for missing/non-numeric TD and Tz operands (#4232, #4233). Fixes #4283 Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com> * Add layout-mode tests for extra operands before Tm/cm Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com> --------- Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>
stefan6419846
added a commit
that referenced
this pull request
Oct 31, 2026
* ROB: Tolerate extra operands before Tm/cm in layout mode A matrix operator consumes the 6 operands nearest to it; values left on the operand stack before those (malformed content streams) overflowed TextStateManager.new_transform() and raised TypeError in layout mode text extraction. Complete the matrix with only the last 6 operands in _complete_matrix and add_cm, mirroring the tolerance already in place for missing/non-numeric TD and Tz operands (#4232, #4233). Fixes #4283 Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com> * Fix set_page_label TypeError when start=None The start parameter is annotated Optional[int] and its validation accepts None as "not set", but _set_page_label used , which treats None as a value to write and crashes in NumberObject. Only write /St when a concrete non-zero start was provided. Fixes #4285 Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com> * Add tests for set_page_label with start=None Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com> * Update tests/test_writer.py * Update tests/test_writer.py --------- Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com> Co-authored-by: Stefan <96178532+stefan6419846@users.noreply.github.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.
In layout mode, a
Tc,Tw,Tz,TLorTsoperator without any operand madeextract_text()raiseIndexError, becauseset_state_param()readvalue[0]from an empty list. Plain mode already ignores these.A missing operand is now handled like a non-numeric one (#4214):
_as_float()getsNoneand the parameter keeps its current value, so the text around it is still extracted.set_font_operation()from #4228 now uses_as_float()for the size too, so there is a single float conversion in layout mode.