Repository navigation
ROB: Do not crash on a composite font without descendant fonts - #4119
Merged
stefan6419846 merged 1 commit intoSep 22, 2026
Merged
Conversation
from_font_resource reads /DescendantFonts directly on the composite-font branch, with a comment stating the entry does not need to be tested for because every other font subtype has already been handled. That holds for the subtype, not for the entry: a /Type0 font which omits /DescendantFonts raised a bare KeyError out of extract_text(), and one storing a dictionary or a string there was cast to an ArrayObject and enumerated. The entry is now read with a default and checked, matching how the same function already reads /FontDescriptor. A composite font whose descendants cannot be read still yields a font, with its widths left empty, rather than failing the page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4119 +/- ##
=======================================
Coverage 98.10% 98.10%
=======================================
Files 59 59
Lines 11547 11553 +6
Branches 2158 2159 +1
=======================================
+ Hits 11328 11334 +6
Misses 124 124
Partials 95 95 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
stefan6419846
approved these changes
Sep 22, 2026
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.
from_font_resource reads /DescendantFonts directly on the composite-font branch,
with a comment stating the entry does not need to be tested for "because all
other fonts have already been dealt with".
That holds for the subtype, not for the entry. A /Type0 font which omits
/DescendantFonts raises a bare KeyError out of extract_text(), and one storing a
dictionary or a string there is cast to an ArrayObject and enumerated.
The entry is now read with a default and checked, matching how the same function
already reads /FontDescriptor. The half of the comment that is no longer true
was removed; the half describing the /W array was kept.
Offline suite passes, 1390 tests.
Used Claude (Opus) to help locate and patch this; I reviewed and tested the change.