Merge pull request #14025 from Snuffleupagus/issue-11915
Improve glyph mapping for non-embedded composite standard fonts with a /CIDToGIDMap (issue 11915)
This commit is contained in:
		
						commit
						d6a27860e3
					
				| @ -1073,6 +1073,7 @@ class Font { | ||||
|           map[+charCode] = SupplementalGlyphMapForCalibri[charCode]; | ||||
|         } | ||||
|       } | ||||
| 
 | ||||
|       // Always update the glyph mapping with the `cidToGidMap` when it exists
 | ||||
|       // (fixes issue12418_reduced.pdf).
 | ||||
|       if (cidToGidMap) { | ||||
| @ -1082,6 +1083,20 @@ class Font { | ||||
|             map[+charCode] = cidToGidMap[cid]; | ||||
|           } | ||||
|         } | ||||
|         // When the /CIDToGIDMap is "incomplete", fallback to the included
 | ||||
|         // /ToUnicode-map regardless of its encoding (fixes issue11915.pdf).
 | ||||
|         if ( | ||||
|           cidToGidMap.length !== this.toUnicode.length && | ||||
|           properties.hasIncludedToUnicodeMap && | ||||
|           this.toUnicode instanceof IdentityToUnicodeMap | ||||
|         ) { | ||||
|           this.toUnicode.forEach(function (charCode, unicodeCharCode) { | ||||
|             const cid = map[charCode]; | ||||
|             if (cidToGidMap[cid] === undefined) { | ||||
|               map[+charCode] = unicodeCharCode; | ||||
|             } | ||||
|           }); | ||||
|         } | ||||
|       } | ||||
| 
 | ||||
|       if (!(this.toUnicode instanceof IdentityToUnicodeMap)) { | ||||
|  | ||||
							
								
								
									
										1
									
								
								test/pdfs/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								test/pdfs/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -355,6 +355,7 @@ | ||||
| !tensor-allflags-withfunction.pdf | ||||
| !issue10084_reduced.pdf | ||||
| !issue4246.pdf | ||||
| !issue11915.pdf | ||||
| !js-authors.pdf | ||||
| !issue4461.pdf | ||||
| !issue4573.pdf | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								test/pdfs/issue11915.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								test/pdfs/issue11915.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -2365,6 +2365,12 @@ | ||||
|        "link": false, | ||||
|        "type": "text" | ||||
|     }, | ||||
|     {  "id": "issue11915", | ||||
|        "file": "pdfs/issue11915.pdf", | ||||
|        "md5": "c4f890b4a5b6f21653421856335181d5", | ||||
|        "rounds": 1, | ||||
|        "type": "eq" | ||||
|     }, | ||||
|     {  "id": "issue10614", | ||||
|        "file": "pdfs/issue10614.pdf", | ||||
|        "md5": "c41da60ce9af100cb78e1c2a6ba18232", | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user