Fix for issue #418

This commit is contained in:
Vivien Nicolas 2011-08-31 23:26:34 +02:00
parent c7195a4450
commit 59c4ba0fb9

View File

@ -2208,10 +2208,11 @@ var Type2CFF = (function() {
var charstrings = []; var charstrings = [];
var differences = properties.differences; var differences = properties.differences;
var index = 0; var index = 0, code = 0;
var kCmapGlyphOffset = 0xE000; var kCmapGlyphOffset = 0xE000;
for (var i = 1; i < charsets.length; i++) { for (var i = 1; i < charsets.length; i++) {
var glyph = charsets[i]; var glyph = charsets[i];
if (differences.length) {
for (var j = index; j < differences.length; j++) { for (var j = index; j < differences.length; j++) {
if (differences[j]) { if (differences[j]) {
index = j; index = j;
@ -2219,10 +2220,16 @@ var Type2CFF = (function() {
} }
} }
var code = differences.indexOf(glyph); code = differences.indexOf(glyph);
if (code == -1) if (code == -1)
code = properties.glyphs[glyph] || index; code = properties.glyphs[glyph] || index;
} else {
code = GlyphsUnicode[glyph] || index;
index = code;
}
if (!code)
continue;
var width = widths[code] || defaultWidth; var width = widths[code] || defaultWidth;
properties.encoding[index] = index + kCmapGlyphOffset; properties.encoding[index] = index + kCmapGlyphOffset;
charstrings.push({unicode: code + kCmapGlyphOffset, width: width, gid: i}); charstrings.push({unicode: code + kCmapGlyphOffset, width: width, gid: i});