Skip to content
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

Prevent trying to map characters to the specials unicode block in adjustMapping (issue 4650) #4701

Merged
merged 1 commit into from
Apr 28, 2014

Conversation

Snuffleupagus
Copy link
Collaborator

Attempting to fix #4650.

In the PDF file in the issue a lot of the fonts have bogus ToUnicode dictionaries where all chars point to 0xFFFD, i.e. inside the specials Unicode block [0xFFF0, 0xFFFF]. (This should also explain why even Adobe Reader is unable to copy most of the text in the document)

Given that we currently ignore the specials Unicode block in other places (e.g. in mapSpecialUnicodeValues, fonts.js#L503-L505), it seemed reasonable to do the same thing here.

@yurydelendik In #4671 (comment) you said that it was my turn to fix a font bug, so I've tried! :-D
Does this PR seem reasonable? If so, should I attach a test file?

@timvandermeij
Copy link
Contributor

I can confirm that this fixes the issue for me.

@@ -2446,6 +2446,11 @@ var Font = (function FontClosure() {
// TODO: Try to map ligatures to the correct spot.
if (unicode.length === 1) {
fontCharCode = unicode.charCodeAt(0);

// Prevent drawing characters in the specials unicode block.
if (fontCharCode >= 0xFFF0 && fontCharCode <= 0xFFFF) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will it make sense to move that 10 lines below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will obviously work too (just ran the tests to confirm), furthermore it might also prevent other issues in the future.

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/861d902555c6906/output.txt

@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/2f6d13aafbf1415/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/9f5b8f8ac3e6663/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/2f6d13aafbf1415/output.txt

Total script time: 2.67 mins

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

Image differences available at: http://107.22.172.223:8877/2f6d13aafbf1415/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/9f5b8f8ac3e6663/output.txt

Total script time: 25.87 mins

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

@yurydelendik
Copy link
Contributor

/botio-windows test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/507c0c6e7302420/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/507c0c6e7302420/output.txt

Total script time: 22.15 mins

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

@yurydelendik
Copy link
Contributor

/botio makeref

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/39a0338743633e6/output.txt

@yurydelendik
Copy link
Contributor

Thank you for the patch

yurydelendik added a commit that referenced this pull request Apr 28, 2014
Prevent trying to map characters to the specials unicode block in adjustMapping (issue 4650)
@yurydelendik yurydelendik merged commit 75d6792 into mozilla:master Apr 28, 2014
@Snuffleupagus Snuffleupagus deleted the issue-4650 branch April 28, 2014 22:37
@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/39a0338743633e6/output.txt

Total script time: 22.45 mins

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

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

Total script time: 25.91 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: 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.

Font problems
4 participants