1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Create a IdentityToUnicodeMap in evaluator.js when toUnicode contains 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`.
This commit is contained in:
Jonas Jenwald 2015-02-09 10:05:55 +01:00
parent ccf05c7a41
commit f19a1db414
2 changed files with 10 additions and 7 deletions

View file

@ -2223,7 +2223,7 @@ var IdentityToUnicodeMap = (function IdentityToUnicodeMapClosure() {
IdentityToUnicodeMap.prototype = {
get length() {
error('should not access .length');
return (this.lastChar + 1) - this.firstChar;
},
forEach: function (callback) {