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

Create a IdentityToUnicodeMap in evaluator.js when toUnicode contains IdentityH/IdentityV #5713

Merged
merged 1 commit into from
Mar 25, 2015
Merged

Create a IdentityToUnicodeMap in evaluator.js when toUnicode contains IdentityH/IdentityV #5713

merged 1 commit into from
Mar 25, 2015

Conversation

Snuffleupagus
Copy link
Collaborator

Currently if a font contains a toUnicode entry, we always create a new ToUnicodeMap in evaluator.js. This is done even for IdentityV/IdentityH, despite to possibility to use the much more compact IdentityToUnicodeMap representation.
This patch refactors the IdentityH/IdentityV cases, to:

  • Avoid calling IdentityCMap.getMap, since this prevents allocating and iterating through an array with 65536 elements.
  • Ensure that the handling of toUnicode is actually correct in fonts.js.
    We rely on toUnicode instanceof IdentityToUnicodeMap in a few places, and currently this does not work correctly for IdentityH/IdentityV.

… IdentityH/IdentityV

Currently if a font contains a `toUnicode` entry, we always create a new `ToUnicodeMap` in evaluator.js. This is done even for `IdentityV/IdentityH`, despite to possibility to use the much more compact `IdentityToUnicodeMap` representation.
This patch refactors the `IdentityH/IdentityV` cases, to:
 - Avoid calling `IdentityCMap.getMap`, since this prevents allocating and iterating through an array with 65536 elements.

 - Ensure that the handling of `toUnicode` is actually correct in fonts.js.
We rely on `toUnicode instanceof IdentityToUnicodeMap` in a few places, and currently this does not work correctly for `IdentityH/IdentityV`.
@CodingFabian
Copy link
Contributor

sweet, looks ok. do you have a pdf where this results in a performance improvement? would help me checking.

@Snuffleupagus
Copy link
Collaborator Author

I didn't have a particular test-case when writing the patch; it's the result of reading various parts of the font code while debugging. In practice these kinds of toUnicode maps seem to be quite rare.
However, the PDF file in issue #4402 could probably serve as a test-case.

@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/199f8a02d306a46/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/e5f7260747eca7f/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/199f8a02d306a46/output.txt

Total script time: 17.12 mins

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Failed

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

Total script time: 22.90 mins

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

Image differences available at: http://107.21.233.14:8877/e5f7260747eca7f/reftest-analyzer.html#web=eq.log

@brendandahl
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/42d0f067a4e1de2/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

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

Total script time: 17.86 mins

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Failed

Full output at http://107.21.233.14:8877/42d0f067a4e1de2/output.txt

Total script time: 22.06 mins

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

Image differences available at: http://107.21.233.14:8877/42d0f067a4e1de2/reftest-analyzer.html#web=eq.log

@brendandahl
Copy link
Contributor

/botio makeref

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

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

Total script time: 17.88 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/c933b2d11cd7767/output.txt

Total script time: 21.94 mins

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

brendandahl added a commit that referenced this pull request Mar 25, 2015
…deMap

Create a IdentityToUnicodeMap in evaluator.js when toUnicode contains IdentityH/IdentityV
@brendandahl brendandahl merged commit 3a8d4a7 into mozilla:master Mar 25, 2015
@Snuffleupagus Snuffleupagus deleted the evaluator-IdentityToUnicodeMap branch March 25, 2015 19:38
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.

4 participants