avoid toString conversion in lookup

This commit is contained in:
Andreas Gal 2011-06-17 21:34:06 -07:00
parent d2e18d35b5
commit 494227dfcc

View File

@ -58,8 +58,8 @@ var Fonts = {
for (var i = 0; i < chars.length; ++i) { for (var i = 0; i < chars.length; ++i) {
var ch = chars.charCodeAt(i); var ch = chars.charCodeAt(i);
var uc = encoding[ch]; var uc = encoding[ch];
if (typeof uc != "number") // we didn't convert the glyph yet if (uc instanceof Name) // we didn't convert the glyph yet
uc = encoding[ch] = GlyphsUnicode[uc]; uc = encoding[ch] = GlyphsUnicode[uc.name];
ret += String.fromCharCode(uc); ret += String.fromCharCode(uc);
} }