A few small optimizations of adjustMapping

Replace a couple of |in| checks with comparisons against undefined.
This commit is contained in:
Jonas Jenwald 2014-06-26 00:03:36 +02:00
parent c121def806
commit c5f4051a75

View File

@ -2483,7 +2483,7 @@ var Font = (function FontClosure() {
var fontCharCode = originalCharCode;
// First try to map the value to a unicode position if a non identity map
// was created.
if (!isIdentityUnicode && originalCharCode in toUnicode) {
if (!isIdentityUnicode && toUnicode[originalCharCode] !== undefined) {
var unicode = toUnicode[fontCharCode];
// TODO: Try to map ligatures to the correct spot.
if (unicode.length === 1) {
@ -2496,7 +2496,7 @@ var Font = (function FontClosure() {
// font was symbolic and there is only an identity unicode map since the
// characters probably aren't in the correct position (fixes an issue
// with firefox and thuluthfont).
if ((fontCharCode in usedFontCharCodes ||
if ((usedFontCharCodes[fontCharCode] !== undefined ||
fontCharCode <= 0x1f || // Control chars
fontCharCode === 0x7F || // Control char
fontCharCode === 0xAD || // Soft hyphen
@ -2514,7 +2514,7 @@ var Font = (function FontClosure() {
nextAvailableFontCharCode = fontCharCode + 1;
}
} while (fontCharCode in usedFontCharCodes &&
} while (usedFontCharCodes[fontCharCode] !== undefined &&
nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END);
}