Skip to content

BUG: Type character widths as float - #3996

Merged
stefan6419846 merged 1 commit into
py-pdf:mainfrom
RavSinghChandan:fix-character-widths-float
Aug 21, 2026
Merged

stefan6419846 merged 1 commit into
py-pdf:mainfrom
RavSinghChandan:fix-character-widths-float

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

The /W array in a CIDFont may hold real numbers, and both parsing branches store the entry as read rather than converting it. A font in the test corpus has a width of 443.35938, which lands in a mapping annotated dict[str, int]. The surrounding code already tests for int or float when deciding which of the two /W formats an entry uses.

_add_space_width returns those values straight back, so its return type follows.

The /W array in a CIDFont may hold real numbers, and both parsing branches
store the entry as read rather than converting it, so a font with a width of
443.35938 puts a float into a mapping annotated dict[str, int]. The code
already tests for int or float when deciding which format an entry uses.

_add_space_width returns those values straight back, so its return type
follows.
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.98%. Comparing base (4c8f707) to head (8d516e8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3996   +/-   ##
=======================================
  Coverage   97.98%   97.98%           
=======================================
  Files          57       57           
  Lines       11098    11098           
  Branches     2078     2078           
=======================================
  Hits        10874    10874           
  Misses        125      125           
  Partials       99       99           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stefan6419846
stefan6419846 merged commit c6d38af into py-pdf:main Aug 21, 2026
33 of 34 checks passed
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.

2 participants