From: notmasteryet Date: Tue, 6 Dec 2011 02:42:39 +0000 (-0600) Subject: Use unicode mapping cmap when simple identity cmap was originally used X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=b8a5d6b8a7751b892264ccb78c48e6b3743dcb6c;p=pdf.js.git Use unicode mapping cmap when simple identity cmap was originally used --- diff --git a/src/fonts.js b/src/fonts.js index 672739e..3959518 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -1758,7 +1758,7 @@ var Font = (function Font() { var hasShortCmap = !!cmapTable.hasShortCmap; var toUnicode = this.toUnicode; - if (hasShortCmap && toUnicode) { + if (toUnicode) { // checking if cmap is just identity map var isIdentity = true; for (var i = 0, ii = glyphs.length; i < ii; i++) { @@ -2110,6 +2110,10 @@ var Font = (function Font() { unicode = charcode; break; case 'TrueType': + if (this.useToUnicode) { + unicode = this.toUnicode[charcode] || charcode; + break; + } var glyphName = this.differences[charcode] || this.encoding[charcode]; if (!glyphName) glyphName = Encodings.StandardEncoding[charcode]; diff --git a/test/pdfs/tutorial.pdf.link b/test/pdfs/tutorial.pdf.link new file mode 100644 index 0000000..ec8141c --- /dev/null +++ b/test/pdfs/tutorial.pdf.link @@ -0,0 +1 @@ +http://cplusplus.com/files/tutorial.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index bfa131d..c530a0e 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -296,5 +296,12 @@ "md5": "20d88011dd7e3c4fb5274979094dab93", "rounds": 1, "type": "eq" + }, + { "id": "tutorial", + "file": "pdfs/tutorial.pdf", + "md5": "6e122f618c27f3aa9a689423e3be6b8d", + "link": true, + "rounds": 1, + "type": "eq" } ]