From c5f4051a75f2f6d00c2c2fd5d0e03821f5aa3013 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald <jonas.jenwald@gmail.com> Date: Thu, 26 Jun 2014 00:03:36 +0200 Subject: [PATCH] A few small optimizations of adjustMapping Replace a couple of |in| checks with comparisons against undefined. --- src/core/fonts.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/fonts.js b/src/core/fonts.js index 64f680ed7..0293b6ed6 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -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); }