Use |toUnicode| when creating the glyph map for standard CIDFontType2 fonts without embedded font file

This commit is contained in:
Jonas Jenwald 2014-09-27 13:14:25 +02:00
parent 744c8e8d7e
commit df2a4afd36
4 changed files with 142 additions and 0 deletions

View File

@ -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)) {

View File

@ -59,6 +59,7 @@
!bug864847.pdf
!issue1002.pdf
!issue925.pdf
!issue2840.pdf
!issue4668.pdf
!issue5039.pdf
!issue5070.pdf

128
test/pdfs/issue2840.pdf Normal file
View File

@ -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 ] 38 [ 722 ] 43 [ 722 ] 40 [ 667 ] 49 [ 722 ] 50 [ 778 ] 15 [ 278 ] 39 [ 722 ] 48 [ 833 ] 44 [ 278 ] 55 [ 611 ] 60 [ 667 ] 620 [ 490 ] 623 [ 556 ] 604 [ 615 ] 630 [ 615 ] 18 [ 278 ] 615 [ 604 ] 629 [ 854 ] 611 [ 615 ] 51 [ 667 ] 82 [ 611 ] 79 [ 278 ] 76 [ 278 ] 70 [ 556 ] 92 [ 556 ] 75 [ 611 ] 71 [ 611 ] 72 [ 556 ] 85 [ 389 ] 81 [ 611 ] 86 [ 556 ] 88 [ 611 ] 83 [ 611 ] 633 [ 583 ] 42 [ 778 ] 74 [ 611 ] 68 [ 556 ] 47 [ 611 ] 80 [ 889 ] 87 [ 333 ] 612 [ 500 ] 609 [ 497 ] 606 [ 635 ] 73 [ 333 ] 77 [ 278 ] 36 [ 722 ] 19 [ 556 ] 22 [ 556 ] 17 [ 278 ] 21 [ 556 ] 20 [ 556 ] 608 [ 709 ] 621 [ 556 ] 28 [ 556 ] 23 [ 556 ] 27 [ 556 ] 24 [ 556 ] 7 [ 556 ] 37 [ 722 ] 54 [ 667 ] 16 [ 333 ] 624 [ 615 ] 9 [ 722 ] 91 [ 556 ] 625 [ 581 ] 69 [ 611 ] 603 [ 618 ] 626 [ 833 ] 78 [ 556 ] 89 [ 556 ] 605 [ 417 ] 29 [ 333 ] 26 [ 556 ] 25 [ 556 ] 622 [ 875 ] 35 [ 975 ] 30 [ 333 ] 90 [ 778 ] 598 [ 719 ] 589 [ 622 ] 14 [ 584 ] ]
>>
endobj
11 0 obj
<<
/Length 929
/Filter /FlateDecode
/Length1 2189
>>
stream
x]VËnÛH¼ Ð?ð˜ÅÔÓ3$@0`Ë1àÃîëädvXÐòÁ¿ÕUC# ûÝ]Ý£Õæþöþ¸¿4«oÓi÷0^š§ýq˜Æ×ÓÛ´Çñy\.7Ã~w™!¿îÛór±ýÃûëe<ÜŸNËÅzݬþ…Ñëezo>]§Çñhý3 ã´?>7Ÿ~lþÿá~<18>—ýå=¾>¼<>Ï/ã[.®®ša|õæ¯íùïíalV×Ó~ûòçÍéeøEôýý<6È0t“rÜ<72>†ñõ¼Ý<C2BC>Óöø<"-ÃßU³¾ÃßÕr1‡ß5»LŸv?·S˜<78>O0Y<E280BA> Wx-hY0UXî$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<C5B8>¢ „U9³ÏVÔIËÌÊÀ62h.2˜“W†1SŠìèJ4 -BµÎ²”[QÅг<C390>|aëû\@MAa+)²!ìÕv,L@ÍÃU%°w T0õ<30>z¯>×^y§ùæ9+BqCÙÐÂpÕ‰“Q7a­ «ma<06>²eÖÏRNÐÀJ ³²®¯…5<E280A6>€R­†õu­¦ÐÕ)´
Ô× Ší†Âd«zqÃIydNæÂS¹¢GÜPëD~C ak¨“Rt%`WÚª„^%8J<38>´à0…²ÃaÝÐV—!Kٴ솅 e+\IƺҨl·¤ŠÀ'J±åðl¹<C2B9>M ˆ<1D>”ó ¦
ÊxÐ;Š\J<>m™wW Ðf2àºÖœqŠë¦$î~,[x6S7<53>:¡+<2B>J`CÀ°Å%¢g; «“ŽYˆRãeˆE%lÅœ^q½'ÊǨU\Êe® ¢gÙÆ®‰<+ö' ·œBùh,¡Õ<C2A1>Æé [ìm(."áÜIÍwÞ}×Èê­3<DT®Ç\çËú™äs©gÄE† dôl¸S|Iç3ÕCü&øx®woÓ„·œ?Vñ5íýqüøyq><3E>é¢þû`Åé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

View File

@ -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",