make cmap glyph offset a symbolic constant
This commit is contained in:
		
							parent
							
								
									5a528944f0
								
							
						
					
					
						commit
						98d628ee3e
					
				
							
								
								
									
										8
									
								
								fonts.js
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								fonts.js
									
									
									
									
									
								
							| @ -790,6 +790,8 @@ var Font = (function Font() { | |||||||
|     encoding: null, |     encoding: null, | ||||||
| 
 | 
 | ||||||
|     checkAndRepair: function font_checkAndRepair(name, font, properties) { |     checkAndRepair: function font_checkAndRepair(name, font, properties) { | ||||||
|  |       var kCmapGlyphOffset = 0xFF; | ||||||
|  | 
 | ||||||
|       function readTableEntry(file) { |       function readTableEntry(file) { | ||||||
|         // tag
 |         // tag
 | ||||||
|         var tag = file.getBytes(4); |         var tag = file.getBytes(4); | ||||||
| @ -1042,17 +1044,17 @@ var Font = (function Font() { | |||||||
|         var encoding = properties.encoding; |         var encoding = properties.encoding; | ||||||
| 
 | 
 | ||||||
|         for (var i = 1; i < numGlyphs; i++) { |         for (var i = 1; i < numGlyphs; i++) { | ||||||
|           glyphs.push({ unicode: i + 0xFF }); |           glyphs.push({ unicode: i + kCmapGlyphOffset }); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if ('undefined' == typeof(encoding[0])) { |         if ('undefined' == typeof(encoding[0])) { | ||||||
|           // the font is directly characters to glyphs with no encoding
 |           // the font is directly characters to glyphs with no encoding
 | ||||||
|           // so create an identity encoding
 |           // so create an identity encoding
 | ||||||
|           for (i = 0; i < numGlyphs; i++) |           for (i = 0; i < numGlyphs; i++) | ||||||
|             encoding[i] = i + 0xFF; |             encoding[i] = i + kCmapGlyphOffset; | ||||||
|         } else { |         } else { | ||||||
|           for (var i in encoding) |           for (var i in encoding) | ||||||
|             encoding[i] = encoding[i] + 0xFF; |             encoding[i] = encoding[i] + kCmapGlyphOffset; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (!cmap) { |         if (!cmap) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user