Browse Source

A few small optimizations of adjustMapping

Replace a couple of |in| checks with comparisons against undefined.
Jonas Jenwald 11 years ago
parent
commit
c5f4051a75
  1. 6
      src/core/fonts.js

6
src/core/fonts.js

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

Loading…
Cancel
Save