Repair CFF fonts if stem hints are in wrong order
This commit is contained in:
		
							parent
							
								
									6ebdbb244f
								
							
						
					
					
						commit
						9e990f6f3e
					
				@ -539,6 +539,16 @@ var CFFParser = (function CFFParserClosure() {
 | 
				
			|||||||
        if (validationCommand) {
 | 
					        if (validationCommand) {
 | 
				
			||||||
          if (validationCommand.stem) {
 | 
					          if (validationCommand.stem) {
 | 
				
			||||||
            state.hints += stackSize >> 1;
 | 
					            state.hints += stackSize >> 1;
 | 
				
			||||||
 | 
					            if (value === 3 || value === 23) {
 | 
				
			||||||
 | 
					              // vstem or vstemhm.
 | 
				
			||||||
 | 
					              state.hasVStems = true;
 | 
				
			||||||
 | 
					            } else if (state.hasVStems && (value === 1 || value === 18)) {
 | 
				
			||||||
 | 
					              // Some browsers don't draw glyphs that specify vstems before
 | 
				
			||||||
 | 
					              // hstems. As a workaround, replace hstem (1) and hstemhm (18)
 | 
				
			||||||
 | 
					              // with a pointless vstem (3) or vstemhm (23).
 | 
				
			||||||
 | 
					              warn('CFF stem hints are in wrong order');
 | 
				
			||||||
 | 
					              data[j - 1] = (value === 1) ? 3 : 23;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          if ('min' in validationCommand) {
 | 
					          if ('min' in validationCommand) {
 | 
				
			||||||
            if (!state.undefStack && stackSize < validationCommand.min) {
 | 
					            if (!state.undefStack && stackSize < validationCommand.min) {
 | 
				
			||||||
@ -599,6 +609,7 @@ var CFFParser = (function CFFParserClosure() {
 | 
				
			|||||||
          firstStackClearing: true,
 | 
					          firstStackClearing: true,
 | 
				
			||||||
          seac: null,
 | 
					          seac: null,
 | 
				
			||||||
          width: null,
 | 
					          width: null,
 | 
				
			||||||
 | 
					          hasVStems: false,
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        var valid = true;
 | 
					        var valid = true;
 | 
				
			||||||
        var localSubrToUse = null;
 | 
					        var localSubrToUse = null;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								test/pdfs/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								test/pdfs/.gitignore
									
									
									
									
										vendored
									
									
								
							@ -264,6 +264,7 @@
 | 
				
			|||||||
!annotation-tx3.pdf
 | 
					!annotation-tx3.pdf
 | 
				
			||||||
!coons-allflags-withfunction.pdf
 | 
					!coons-allflags-withfunction.pdf
 | 
				
			||||||
!tensor-allflags-withfunction.pdf
 | 
					!tensor-allflags-withfunction.pdf
 | 
				
			||||||
 | 
					!issue10084_reduced.pdf
 | 
				
			||||||
!issue4246.pdf
 | 
					!issue4246.pdf
 | 
				
			||||||
!issue4461.pdf
 | 
					!issue4461.pdf
 | 
				
			||||||
!issue4573.pdf
 | 
					!issue4573.pdf
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								test/pdfs/issue10084_reduced.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								test/pdfs/issue10084_reduced.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@ -2750,6 +2750,12 @@
 | 
				
			|||||||
       "type": "text",
 | 
					       "type": "text",
 | 
				
			||||||
       "about": "Note that the text layer seems to be off to the right."
 | 
					       "about": "Note that the text layer seems to be off to the right."
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    {  "id": "issue10084",
 | 
				
			||||||
 | 
					       "file": "pdfs/issue10084_reduced.pdf",
 | 
				
			||||||
 | 
					       "md5": "ae37cf36f2e319688c608e4086836824",
 | 
				
			||||||
 | 
					       "rounds": 1,
 | 
				
			||||||
 | 
					       "type": "eq"
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    {  "id": "issue4890",
 | 
					    {  "id": "issue4890",
 | 
				
			||||||
       "file": "pdfs/issue4890.pdf",
 | 
					       "file": "pdfs/issue4890.pdf",
 | 
				
			||||||
       "md5": "1666feb4cd26318c2bdbea6a175dce87",
 | 
					       "md5": "1666feb4cd26318c2bdbea6a175dce87",
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user