Merge pull request #11746 from Snuffleupagus/issue-11740
Create the glyph mapping correctly for composite Type1, i.e. CIDFontType0, fonts (issue 11740)
This commit is contained in:
		
						commit
						70c54ab9d9
					
				| @ -3642,6 +3642,22 @@ var Type1Font = (function Type1FontClosure() { | |||||||
| 
 | 
 | ||||||
|     getGlyphMapping: function Type1Font_getGlyphMapping(properties) { |     getGlyphMapping: function Type1Font_getGlyphMapping(properties) { | ||||||
|       var charstrings = this.charstrings; |       var charstrings = this.charstrings; | ||||||
|  | 
 | ||||||
|  |       if (properties.composite) { | ||||||
|  |         const charCodeToGlyphId = Object.create(null); | ||||||
|  |         // Map CIDs directly to GIDs.
 | ||||||
|  |         for ( | ||||||
|  |           let glyphId = 0, charstringsLen = charstrings.length; | ||||||
|  |           glyphId < charstringsLen; | ||||||
|  |           glyphId++ | ||||||
|  |         ) { | ||||||
|  |           const charCode = properties.cMap.charCodeOf(glyphId); | ||||||
|  |           // Add 1 because glyph 0 is duplicated.
 | ||||||
|  |           charCodeToGlyphId[charCode] = glyphId + 1; | ||||||
|  |         } | ||||||
|  |         return charCodeToGlyphId; | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|       var glyphNames = [".notdef"], |       var glyphNames = [".notdef"], | ||||||
|         glyphId; |         glyphId; | ||||||
|       for (glyphId = 0; glyphId < charstrings.length; glyphId++) { |       for (glyphId = 0; glyphId < charstrings.length; glyphId++) { | ||||||
|  | |||||||
| @ -437,7 +437,7 @@ var Type1Parser = (function Type1ParserClosure() { | |||||||
|         r = ((value + r) * c1 + c2) & ((1 << 16) - 1); |         r = ((value + r) * c1 + c2) & ((1 << 16) - 1); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     return Array.prototype.slice.call(decrypted, discardNumber, j); |     return decrypted.slice(discardNumber, j); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   function isSpecial(c) { |   function isSpecial(c) { | ||||||
| @ -457,10 +457,14 @@ var Type1Parser = (function Type1ParserClosure() { | |||||||
|     if (encrypted) { |     if (encrypted) { | ||||||
|       var data = stream.getBytes(); |       var data = stream.getBytes(); | ||||||
|       var isBinary = !( |       var isBinary = !( | ||||||
|         isHexDigit(data[0]) && |         (isHexDigit(data[0]) || isWhiteSpace(data[0])) && | ||||||
|         isHexDigit(data[1]) && |         isHexDigit(data[1]) && | ||||||
|         isHexDigit(data[2]) && |         isHexDigit(data[2]) && | ||||||
|         isHexDigit(data[3]) |         isHexDigit(data[3]) && | ||||||
|  |         isHexDigit(data[4]) && | ||||||
|  |         isHexDigit(data[5]) && | ||||||
|  |         isHexDigit(data[6]) && | ||||||
|  |         isHexDigit(data[7]) | ||||||
|       ); |       ); | ||||||
|       stream = new Stream( |       stream = new Stream( | ||||||
|         isBinary |         isBinary | ||||||
|  | |||||||
| @ -224,6 +224,15 @@ if ( | |||||||
|     Number.isInteger = require("core-js/es/number/is-integer.js"); |     Number.isInteger = require("core-js/es/number/is-integer.js"); | ||||||
|   })(); |   })(); | ||||||
| 
 | 
 | ||||||
|  |   // Provides support for TypedArray.prototype.slice in legacy browsers.
 | ||||||
|  |   // Support: IE
 | ||||||
|  |   (function checkTypedArraySlice() { | ||||||
|  |     if (Uint8Array.prototype.slice) { | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |     require("core-js/es/typed-array/slice"); | ||||||
|  |   })(); | ||||||
|  | 
 | ||||||
|   // Support: IE, Safari<11, Chrome<63
 |   // Support: IE, Safari<11, Chrome<63
 | ||||||
|   (function checkPromise() { |   (function checkPromise() { | ||||||
|     if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("IMAGE_DECODERS")) { |     if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("IMAGE_DECODERS")) { | ||||||
|  | |||||||
							
								
								
									
										1
									
								
								test/pdfs/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								test/pdfs/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -206,6 +206,7 @@ | |||||||
| !bug1011159.pdf | !bug1011159.pdf | ||||||
| !issue5734.pdf | !issue5734.pdf | ||||||
| !issue4875.pdf | !issue4875.pdf | ||||||
|  | !issue11740_reduced.pdf | ||||||
| !issue4881.pdf | !issue4881.pdf | ||||||
| !issue5994.pdf | !issue5994.pdf | ||||||
| !issue6151.pdf | !issue6151.pdf | ||||||
|  | |||||||
							
								
								
									
										
											BIN
										
									
								
								test/pdfs/issue11740_reduced.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								test/pdfs/issue11740_reduced.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -904,6 +904,12 @@ | |||||||
|        "link": false, |        "link": false, | ||||||
|        "type": "eq" |        "type": "eq" | ||||||
|     }, |     }, | ||||||
|  |     {  "id": "issue11740", | ||||||
|  |        "file": "pdfs/issue11740_reduced.pdf", | ||||||
|  |        "md5": "f3f2957f171af52229c6e749e8a5572b", | ||||||
|  |        "rounds": 1, | ||||||
|  |        "type": "eq" | ||||||
|  |     }, | ||||||
|     {  "id": "issue10491", |     {  "id": "issue10491", | ||||||
|        "file": "pdfs/issue10491.pdf", |        "file": "pdfs/issue10491.pdf", | ||||||
|        "md5": "0759ec46739b13bb0b66170a18d33d4f", |        "md5": "0759ec46739b13bb0b66170a18d33d4f", | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user