Merge pull request #4437 from yurydelendik/issue4398
Fixes corrupted by Aspose fonts
This commit is contained in:
		
						commit
						2778d75d2c
					
				@ -3269,6 +3269,12 @@ var Font = (function FontClosure() {
 | 
				
			|||||||
        itemEncode(locaData, 0, writeOffset);
 | 
					        itemEncode(locaData, 0, writeOffset);
 | 
				
			||||||
        for (var i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
 | 
					        for (var i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
 | 
				
			||||||
          var endOffset = itemDecode(locaData, j);
 | 
					          var endOffset = itemDecode(locaData, j);
 | 
				
			||||||
 | 
					          if (endOffset > oldGlyfDataLength &&
 | 
				
			||||||
 | 
					              ((oldGlyfDataLength + 3) & ~3) === endOffset) {
 | 
				
			||||||
 | 
					            // Aspose breaks fonts by aligning the glyphs to the qword, but not
 | 
				
			||||||
 | 
					            // the glyf table size, which makes last glyph out of range.
 | 
				
			||||||
 | 
					            endOffset = oldGlyfDataLength;
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
          if (endOffset > oldGlyfDataLength) {
 | 
					          if (endOffset > oldGlyfDataLength) {
 | 
				
			||||||
            // glyph end offset points outside glyf data, rejecting the glyph
 | 
					            // glyph end offset points outside glyf data, rejecting the glyph
 | 
				
			||||||
            itemEncode(locaData, j, writeOffset);
 | 
					            itemEncode(locaData, j, writeOffset);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user