markbruce d0108157f1
fix: use dynamic count for beginbfrange declaration (#1660)
* fix: use dynamic count for beginbfrange declaration

Fixes garbled text copying in Chrome/Edge for PDFs with >256 unique characters

* Add changelog line

Addressed an issue with garbled text copying in Chrome/Edge for PDFs containing more than 256 unique characters.

* test: add tests for beginbfrange count declaration

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 #1659

* Revert "test: add tests for beginbfrange count declaration"

This reverts commit dda6f4a762acbaa09f5986502c494c97959c7643.

* Rewrite tests for beginbfrange count declaraton. Fix code style issue.

* fix(tests): remove unused variables in font.spec.js

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

---------

Co-authored-by: zhang_xiaoning <zxn@winning.com.cn>
2025-11-30 21:52:23 -03:00
..
2025-04-12 12:57:31 -03:00
2025-08-30 15:13:31 -03:00
2025-04-12 12:57:31 -03:00
2025-04-17 06:18:58 -03:00
2025-04-12 12:57:31 -03:00
2025-04-12 12:43:17 -03:00
2025-04-12 12:43:17 -03:00
2025-04-12 12:57:31 -03:00
2025-04-12 12:57:31 -03:00
2025-04-12 12:57:31 -03:00
2025-04-12 12:57:31 -03:00
2025-04-12 12:57:31 -03:00
2025-04-12 12:57:31 -03:00
2025-04-12 12:57:31 -03:00
2025-04-12 12:57:31 -03:00
2025-04-12 12:57:31 -03:00
2025-04-12 12:43:17 -03:00
2025-04-12 12:57:31 -03:00
2025-04-12 12:57:31 -03:00
2025-04-12 12:57:31 -03:00
2025-04-12 12:57:31 -03:00
2025-04-12 12:57:31 -03:00