[Pkg-javascript-commits] [pdf.js] 134/204: Use |toUnicode| when creating the glyph map for standard CIDFontType2 fonts without embedded font file

David Prévot taffit at moszumanska.debian.org
Sat Oct 25 18:50:42 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 df2a4afd368a4cac0a9723558c99d74919c65f41
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Sat Sep 27 13:14:25 2014 +0200

    Use |toUnicode| when creating the glyph map for standard CIDFontType2 fonts without embedded font file
---
 src/core/fonts.js       |   6 +++
 test/pdfs/.gitignore    |   1 +
 test/pdfs/issue2840.pdf | 128 ++++++++++++++++++++++++++++++++++++++++++++++++
 test/test_manifest.json |   7 +++
 4 files changed, 142 insertions(+)

diff --git a/src/core/fonts.js b/src/core/fonts.js
index 677e293..b173e02 100644
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@ -2475,6 +2475,12 @@ var Font = (function FontClosure() {
         for (var code in GlyphMapForStandardFonts) {
           map[+code] = GlyphMapForStandardFonts[code];
         }
+        var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
+        if (!isIdentityUnicode) {
+          this.toUnicode.forEach(function(charCode, unicodeCharCode) {
+            map[+charCode] = unicodeCharCode;
+          });
+        }
         this.toFontChar = map;
         this.toUnicode = new ToUnicodeMap(map);
       } else if (/Symbol/i.test(fontName)) {
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index 8edc0bd..2e34a2b 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -59,6 +59,7 @@
 !bug864847.pdf
 !issue1002.pdf
 !issue925.pdf
+!issue2840.pdf
 !issue4668.pdf
 !issue5039.pdf
 !issue5070.pdf
diff --git a/test/pdfs/issue2840.pdf b/test/pdfs/issue2840.pdf
new file mode 100644
index 0000000..b623fe7
--- /dev/null
+++ b/test/pdfs/issue2840.pdf
@@ -0,0 +1,128 @@
+%PDF-1.7
+28 0 obj
+<<
+/Type /Catalog
+/Pages 29 0 R
+>>
+endobj
+29 0 obj
+<<
+/Type /Pages
+/MediaBox [ 0 0 200 50 ]
+/Count 1
+/Kids [ 30 0 R ]
+>>
+endobj
+30 0 obj
+<<
+/Type /Page
+/Parent 29 0 R
+/Resources <<
+/Font <<
+/F1 31 0 R
+>>
+
+>>
+
+/Contents 32 0 R
+>>
+endobj
+31 0 obj
+<<
+/Type /Font
+/Subtype /Type0
+/BaseFont /Arial,Bold
+/Encoding /Identity-H
+/DescendantFonts [ 13 0 R ]
+/ToUnicode 11 0 R
+>>
+endobj
+32 0 obj
+<<
+/Length 79
+>>
+stream
+BT
+10 20 TD
+/F1 20 Tf
+<024702680266025F026A00030269026802650262026B025A> Tj
+ET
+endstream
+endobj
+13 0 obj
+<<
+/Type /Font
+/Subtype /CIDFontType2
+/BaseFont /Arial,Bold
+/CIDSystemInfo 12 0 R
+/FontDescriptor 10 0 R
+/W [ 587 [ 722 ] 588 [ 611 ] 586 [ 667 ] 570 [ 722 ] 591 [ 667 ] 584 [ 778 ] 572 [ 722 ] 583 [ 722 ] 578 [ 719 ] 601 [ 719 ] 3 [ 278 ] 582 [ 833 ] 575 [ 667 ] 574 [ 712 ] 592 [ 730 ] 580 [ 610 ] 597 [ 979 ] 585 [ 719 ] 581 [ 702 ] 195 [ 278 ] 577 [ 626 ] 576 [ 904 ] 600 [ 1031 ] 595 [ 1019 ] 573 [ 567 ] 11 [ 333 ] 571 [ 719 ] 579 [ 719 ] 12 [ 333 ] 616 [ 611 ] 614 [ 740 ] 607 [ 556 ] 618 [ 611 ] 617 [ 604 ] 613 [ 635 ] 610 [ 615 ] 619 [ 556 ] 602 [ 556 ] 46 [ 722 ] 53 [ 722 ] 56 [ 722 ]  [...]
+>>
+endobj
+11 0 obj
+<<
+/Length 929
+/Filter /FlateDecode
+/Length1 2189
+>>
+stream
+x]V�n�H�
�?��
��3$@0`�1�����d�vX�����UC#
��]ݣ�������4�o�i�0^���q����۴���y\.�7�~w�!����r������e<��N��zݬ����ezo>]���h�3
�?>7�~l
���~����=�>���/�[.���a|�������alV��~�����e�E���<6�0t�rܝ����ݍ���<"-��U�����r1
��5��L�v?�S�x���O0Y����Wx-h�Y0UX�$m%-�	�W�,Wiv�Kz+iq�ς�B�#4���@]��6�zV�T�毒I[#�N��t-ض�~#X7)�I����4�fےh��j�@�jU���۰Ec�H9��6�����LX�<�&ٚ����)��;5�&l՜\��id�v�S�� �;Ջ�J�Yu�
+eS��U�+C���

+�!`�V�6� T�i,�|��P��
�U9��V�I����62h.2��W�1S���J4
-B�β�[Q�г��|a�
�\@MA*�a+)�!��v,L@��U%�w
T0��z�>�^y���9+BqC���pՉ�Q7a�	�ma��e���RN��J
������5��R���u�����)�
+��	���d�zq�I�ydN��S��G��P�D~C
ak��Rt%`Wڪ�^%8J���0���a��V�!Kٴ솅	e+\IÆ�Ҩl����'J���l���M
�
���
�
+�x
�;
�\J�m�wW
�f2�֜q��$�~,[x6S7�:�+�J`C���%�g;����Y�R�e�E%lŜ^q�'���U\�e�
�g��
��<+�'���B�h,�Ձ��
[�m(."��I�w�}���3<DT��\�����s�g�E�
d�l�S|I�3
�C�&�x�woӄ��?
V�5
��q��yq>����`��endstream
+endobj
+12 0 obj
+<<
+/Registry (Adobe)
+/Ordering (Identity)
+/Supplement 0
+>>
+endobj
+10 0 obj
+<<
+/Type /FontDescriptor
+/FontName /Arial,Bold
+/FontFamily /Arial,Bold
+/Flags 32
+/FontBBox [ -628 -376 2000 1010 ]
+/ItalicAngle 0
+/Ascent 728
+/Descent -210
+/Leading 117
+/CapHeight 1117
+/StemV 166
+/AvgWidth 479
+/MxWidth 2628
+/MissingWidth 479
+>>
+endobj
+xref
+0 1
+0000000000 65535 f
+10 1
+0000003141 00000 n
+11 1
+0000002051 00000 n
+12 1
+0000003066 00000 n
+13 1
+0000000523 00000 n
+28 1
+0000000009 00000 n
+29 1
+0000000060 00000 n
+30 1
+0000000146 00000 n
+31 1
+0000000254 00000 n
+32 1
+0000000394 00000 n
+trailer
+<<
+/Size 9
+/Root 28 0 R
+>>
+startxref
+3402
+%%EOF
\ No newline at end of file
diff --git a/test/test_manifest.json b/test/test_manifest.json
index 65c145d..45de838 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -746,6 +746,13 @@
        "type": "eq",
        "about": "Seac with differences array that messes up mapping."
     },
+    {  "id": "issue2840",
+       "file": "pdfs/issue2840.pdf",
+       "md5": "d9df49f6d62668d099e0fb7e74f8f337",
+       "rounds": 1,
+       "link": false,
+       "type": "eq"
+    },
     {  "id": "bug866395",
        "file": "pdfs/bug866395.pdf",
        "md5": "f03bc77e84637241980b09a0a220f575",

-- 
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