[Pkg-javascript-commits] [pdf.js] 173/207: [CIDFontType2] Map characters missing in toUnicode to the private use area (bug 1028735 and issue 4881)
David Prévot
taffit at moszumanska.debian.org
Mon Jul 28 15:36:45 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit a7c786775da99a429b8a70f6ace4bfa0147be732
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Sat Jun 28 12:38:25 2014 +0200
[CIDFontType2] Map characters missing in toUnicode to the private use area (bug 1028735 and issue 4881)
---
src/core/fonts.js | 17 ++++++++++++-----
test/pdfs/.gitignore | 1 +
test/pdfs/bug1028735.pdf | Bin 0 -> 22886 bytes
test/test_manifest.json | 9 +++++++++
4 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/src/core/fonts.js b/src/core/fonts.js
index 0293b6e..daf6257 100644
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@ -2473,6 +2473,7 @@ var Font = (function FontClosure() {
var toUnicode = properties.toUnicode;
var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
var isIdentityUnicode = properties.isIdentityUnicode;
+ var isCidFontType2 = (properties.type === 'CIDFontType2');
var newMap = Object.create(null);
var toFontChar = [];
var usedFontCharCodes = [];
@@ -2483,11 +2484,17 @@ var Font = (function FontClosure() {
var fontCharCode = originalCharCode;
// First try to map the value to a unicode position if a non identity map
// was created.
- if (!isIdentityUnicode && toUnicode[originalCharCode] !== undefined) {
- var unicode = toUnicode[fontCharCode];
- // TODO: Try to map ligatures to the correct spot.
- if (unicode.length === 1) {
- fontCharCode = unicode.charCodeAt(0);
+ if (!isIdentityUnicode) {
+ if (toUnicode[originalCharCode] !== undefined) {
+ var unicode = toUnicode[fontCharCode];
+ // TODO: Try to map ligatures to the correct spot.
+ if (unicode.length === 1) {
+ fontCharCode = unicode.charCodeAt(0);
+ }
+ } else if (isCidFontType2) {
+ // For CIDFontType2, move characters not present in toUnicode
+ // to the private use area (fixes bug 1028735 and issue 4881).
+ fontCharCode = nextAvailableFontCharCode;
}
}
// Try to move control characters, special characters and already mapped
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index debc332..8713d67 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -56,6 +56,7 @@
!bug903856.pdf
!bug850854.pdf
!bug866395.pdf
+!bug1028735.pdf
!basicapi.pdf
!mixedfonts.pdf
!shading_extend.pdf
diff --git a/test/pdfs/bug1028735.pdf b/test/pdfs/bug1028735.pdf
new file mode 100644
index 0000000..5ff93b5
Binary files /dev/null and b/test/pdfs/bug1028735.pdf differ
diff --git a/test/test_manifest.json b/test/test_manifest.json
index 57eb4c9..6941484 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -176,6 +176,15 @@
"rounds": 1,
"type": "eq"
},
+ { "id": "bug1028735",
+ "file": "pdfs/bug1028735.pdf",
+ "md5": "5d1a2a87d176ff3b24e66af3cb2365be",
+ "rounds": 1,
+ "link": false,
+ "firstPage": 1,
+ "lastPage": 1,
+ "type": "eq"
+ },
{ "id": "issue1512",
"file": "pdfs/issue1512.pdf",
"md5": "41a19fe03d522346ee3baa732403fca4",
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list