-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: use dynamic count for beginbfrange declaration #1660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes garbled text copying in Chrome/Edge for PDFs with >256 unique characters
Addressed an issue with garbled text copying in Chrome/Edge for PDFs containing more than 256 unique characters.
Add test cases to verify that the beginbfrange count declaration in ToUnicode CMap matches the actual number of bfrange entries. - Test for fonts with >256 characters (multiple ranges) - Test for fonts with <=256 characters (single range) These tests ensure the fix for the beginbfrange count bug is correct and prevent regression. Related to foliojs#1659
| }); | ||
| }); | ||
|
|
||
| test.each([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removed this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for that. Maybe I use wrong version of the file to generate tests code. I have fixed it.
tests/unit/font.spec.js
Outdated
| const font = PDFFontFactory.open( | ||
| document, | ||
| 'tests/fonts/Roboto-Regular.ttf', | ||
| 'tests/fonts/Roboto-Regular.ttf' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run prettier to make style consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for that. Maybe I use wrong version of the file to generate tests code. I have fixed it.
|
There s one remaining eslint error |
Replace for loops with unused match variables with spread operator to directly get array length, fixing ESLint no-unused-vars errors. - Replace loop counting with [...rangeMatches].length - Fixes ESLint errors at lines 152 and 197 in tests/unit/font.spec.js - All tests pass successfully
My bad. I Fixed it. ToT |
|
Many thanks |
Fixes garbled text copying in Chrome/Edge for PDFs with >256 unique characters
What kind of change does this PR introduce?
Bug fix
issue : #1659
Checklist:
PDF standards 1.3 Chapter 5. Page 344
(https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/pdfreference1.3.pdf)