Replies: 1 comment 4 replies
-
Are you using the latest release (4.1.0)? In #2464, something similar has been implemented if I am not mistaken. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There seems to be a fair bit of code sprinkled about the codebase expressly for the purposes of ensuring that an element of interest (e.g. the "/W" widths array for a CID font dictionary) isn't simply an IndirectObject reference pointing to the "real" element. With some clever adjustments to the IndirectObject class, we may be able to avoid those headaches altogether and provide coverage for lots of additional use cases, no pre-checks and get_object() calls required.
Case in point, I recently ran into another unhandled edge case with layout mode text extraction, namely a CID font whose "/W" widths array was defined as an IndirectObject. Rather than adding another
if isinstance(_w, IndirectObject): _w = _w.get_object()
, I extended IndirectObject with the following implicit resolution routines and retested and it worked like a charm.When that worked to solve the TypeError in the _fonts.py module, I made the following simplification for PageObject._layout_mode_fonts() and retested all of my established use cases. Everything worked without exception.
Does anyone see a downside for pursuing this paradigm in a future PR? There are certainly some pitfalls, chief among them the potential for confusing exception tracebacks, but those pitfalls are solvable IMO.
Beta Was this translation helpful? Give feedback.
All reactions