[Pkg-javascript-commits] [pdf.js] 87/119: Merge pull request #5756 from Snuffleupagus/issue-5751
David Prévot
taffit at moszumanska.debian.org
Wed May 13 21:27:45 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 48b2f6d02303719543bc24378990077bf81bbd82
Merge: 71ab5e5 e894a0a
Author: Tim van der Meij <timvandermeij at gmail.com>
Date: Fri Apr 24 23:50:07 2015 +0200
Merge pull request #5756 from Snuffleupagus/issue-5751
Guess CIDFontType0 subtype based on font file contents (issue 5751)
src/core/fonts.js | 18 ++++++++++++++++++
test/pdfs/.gitignore | 1 +
test/pdfs/issue5751.pdf | Bin 0 -> 67017 bytes
test/test_manifest.json | 7 +++++++
4 files changed, 26 insertions(+)
diff --cc src/core/fonts.js
index ba025ed,74609b1..1554ff8
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@@ -2655,39 -2659,21 +2659,53 @@@ var Font = (function FontClosure()
return readUint32(header, 0) === 0x00010000;
}
+ function isType1File(file) {
+ var header = file.peekBytes(2);
+ // All Type1 font programs must begin with the comment '%!' (0x25 + 0x21).
+ if (header[0] === 0x25 && header[1] === 0x21) {
+ return true;
+ }
+ // ... obviously some fonts violate that part of the specification,
+ // please refer to the comment in |Type1Font| below.
+ if (header[0] === 0x80 && header[1] === 0x01) { // pfb file header.
+ return true;
+ }
+ return false;
+ }
+
/**
+ * Helper function for |adjustMapping|.
+ * @return {boolean}
+ */
+ function isProblematicUnicodeLocation(code) {
+ if (code <= 0x1F) { // Control chars
+ return true;
+ }
+ if (code >= 0x80 && code <= 0x9F) { // Control chars
+ return true;
+ }
+ if ((code >= 0x2000 && code <= 0x200F) || // General punctuation chars
+ (code >= 0x2028 && code <= 0x202F) ||
+ (code >= 0x2060 && code <= 0x206F)) {
+ return true;
+ }
+ if (code >= 0xFFF0 && code <= 0xFFFF) { // Specials Unicode block
+ return true;
+ }
+ switch (code) {
+ case 0x7F: // Control char
+ case 0xA0: // Non breaking space
+ case 0xAD: // Soft hyphen
+ case 0x0E33: // Thai character SARA AM
+ case 0x2011: // Non breaking hyphen
+ case 0x205F: // Medium mathematical space
+ case 0x25CC: // Dotted circle (combining mark)
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Rebuilds the char code to glyph ID map by trying to replace the char codes
* with their unicode value. It also moves char codes that are in known
* problematic locations.
--
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