Skip to content

Fix the charCodeOf method in IdentityToUnicodeMap in order to prevent text selection from breaking #6725

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

Merged
merged 1 commit into from
Dec 5, 2015
Merged

Fix the charCodeOf method in IdentityToUnicodeMap in order to prevent text selection from breaking #6725

merged 1 commit into from
Dec 5, 2015

Conversation

Snuffleupagus
Copy link
Collaborator

After PR #6590, font.spaceWidth is now called in more cases than before (in PartialEvaluator_getTextContent), which exposed an underlying issue with IdentityToUnicodeMap_charCodeOf throwing an error.
This breaks text-selection in some PDF files found in the wild, hence this patch replaces the error with an actual function instead (modelled after IdentityCMap_charCodeOf).

Edit: An example is the PDF file in https://bugzilla.mozilla.org/show_bug.cgi?id=1020380.

Edit2: Pushed a new version that only updates the commit message, to fix the stupid charCodeAt -> charCodeOf typo.

@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Dec 5, 2015

From: Bot.io (Linux)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.21.233.14:8877/0b770b57fa2ea0c/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Dec 5, 2015

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.22.172.223:8877/cc80bec50ea9f4f/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Dec 5, 2015

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/cc80bec50ea9f4f/output.txt

Total script time: 19.12 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Dec 5, 2015

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/0b770b57fa2ea0c/output.txt

Total script time: 20.42 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

…vent text selection from breaking

After PR 6590, `font.spaceWidth` is now called in more cases than before (in `PartialEvaluator_getTextContent`), which exposed an underlying issue with `IdentityToUnicodeMap_charCodeOf` throwing an error.
This breaks text-selection in some PDF files found in the wild, hence this patch replaces the `error` with an actual function instead (modelled after `IdentityCMap_charCodeOf`).
@Snuffleupagus Snuffleupagus changed the title Fix the charCodeAt method in IdentityToUnicodeMap in order to prevent text selection from breaking Fix the charCodeOf method in IdentityToUnicodeMap in order to prevent text selection from breaking Dec 5, 2015
@yurydelendik
Copy link
Contributor

Looks good, thank you.

/botio makeref

@pdfjsbot
Copy link

pdfjsbot commented Dec 5, 2015

From: Bot.io (Windows)


Received

Command cmd_makeref from @yurydelendik received. Current queue size: 0

Live output at: http://107.22.172.223:8877/a4bc70c6129e968/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Dec 5, 2015

From: Bot.io (Linux)


Received

Command cmd_makeref from @yurydelendik received. Current queue size: 0

Live output at: http://107.21.233.14:8877/f77e1905079fd0e/output.txt

yurydelendik added a commit that referenced this pull request Dec 5, 2015
…CodeOf

Fix the `charCodeOf` method in `IdentityToUnicodeMap` in order to prevent text selection from breaking
@yurydelendik yurydelendik merged commit 171f59c into mozilla:master Dec 5, 2015
@pdfjsbot
Copy link

pdfjsbot commented Dec 5, 2015

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/a4bc70c6129e968/output.txt

Total script time: 19.11 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

@pdfjsbot
Copy link

pdfjsbot commented Dec 5, 2015

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/f77e1905079fd0e/output.txt

Total script time: 20.41 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

@Snuffleupagus Snuffleupagus deleted the IdentityToUnicodeMap_charCodeOf branch December 5, 2015 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants