Enable the no-var
linting rule in src/core/unicode.js
This commit is contained in:
parent
cb82dda755
commit
0897dddbbe
@ -13,7 +13,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* no-babel-preset */
|
/* no-babel-preset */
|
||||||
/* eslint-disable no-var */
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getArrayLookupTableFactory,
|
getArrayLookupTableFactory,
|
||||||
@ -23,7 +22,7 @@ import {
|
|||||||
// Some characters, e.g. copyrightserif, are mapped to the private use area
|
// Some characters, e.g. copyrightserif, are mapped to the private use area
|
||||||
// and might not be displayed using standard fonts. Mapping/hacking well-known
|
// and might not be displayed using standard fonts. Mapping/hacking well-known
|
||||||
// chars to the similar equivalents in the normal characters range.
|
// chars to the similar equivalents in the normal characters range.
|
||||||
var getSpecialPUASymbols = getLookupTableFactory(function (t) {
|
const getSpecialPUASymbols = getLookupTableFactory(function (t) {
|
||||||
t[63721] = 0x00a9; // copyrightsans (0xF8E9) => copyright
|
t[63721] = 0x00a9; // copyrightsans (0xF8E9) => copyright
|
||||||
t[63193] = 0x00a9; // copyrightserif (0xF6D9) => copyright
|
t[63193] = 0x00a9; // copyrightserif (0xF6D9) => copyright
|
||||||
t[63720] = 0x00ae; // registersans (0xF8E8) => registered
|
t[63720] = 0x00ae; // registersans (0xF8E8) => registered
|
||||||
@ -63,7 +62,7 @@ function mapSpecialUnicodeValues(code) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getUnicodeForGlyph(name, glyphsUnicodeMap) {
|
function getUnicodeForGlyph(name, glyphsUnicodeMap) {
|
||||||
var unicode = glyphsUnicodeMap[name];
|
let unicode = glyphsUnicodeMap[name];
|
||||||
if (unicode !== undefined) {
|
if (unicode !== undefined) {
|
||||||
return unicode;
|
return unicode;
|
||||||
}
|
}
|
||||||
@ -72,8 +71,8 @@ function getUnicodeForGlyph(name, glyphsUnicodeMap) {
|
|||||||
}
|
}
|
||||||
// Try to recover valid Unicode values from 'uniXXXX'/'uXXXX{XX}' glyphs.
|
// Try to recover valid Unicode values from 'uniXXXX'/'uXXXX{XX}' glyphs.
|
||||||
if (name[0] === "u") {
|
if (name[0] === "u") {
|
||||||
var nameLen = name.length,
|
const nameLen = name.length;
|
||||||
hexStr;
|
let hexStr;
|
||||||
|
|
||||||
if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
|
if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
|
||||||
// 'uniXXXX'
|
// 'uniXXXX'
|
||||||
@ -95,7 +94,7 @@ function getUnicodeForGlyph(name, glyphsUnicodeMap) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var UnicodeRanges = [
|
const UnicodeRanges = [
|
||||||
{ begin: 0x0000, end: 0x007f }, // Basic Latin
|
{ begin: 0x0000, end: 0x007f }, // Basic Latin
|
||||||
{ begin: 0x0080, end: 0x00ff }, // Latin-1 Supplement
|
{ begin: 0x0080, end: 0x00ff }, // Latin-1 Supplement
|
||||||
{ begin: 0x0100, end: 0x017f }, // Latin Extended-A
|
{ begin: 0x0100, end: 0x017f }, // Latin Extended-A
|
||||||
@ -222,8 +221,8 @@ var UnicodeRanges = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
function getUnicodeRangeFor(value) {
|
function getUnicodeRangeFor(value) {
|
||||||
for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
|
for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
|
||||||
var range = UnicodeRanges[i];
|
const range = UnicodeRanges[i];
|
||||||
if (value >= range.begin && value < range.end) {
|
if (value >= range.begin && value < range.end) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -232,7 +231,7 @@ function getUnicodeRangeFor(value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isRTLRangeFor(value) {
|
function isRTLRangeFor(value) {
|
||||||
var range = UnicodeRanges[13];
|
let range = UnicodeRanges[13];
|
||||||
if (value >= range.begin && value < range.end) {
|
if (value >= range.begin && value < range.end) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -245,7 +244,7 @@ function isRTLRangeFor(value) {
|
|||||||
|
|
||||||
// The normalization table is obtained by filtering the Unicode characters
|
// The normalization table is obtained by filtering the Unicode characters
|
||||||
// database with <compat> entries.
|
// database with <compat> entries.
|
||||||
var getNormalizedUnicodes = getArrayLookupTableFactory(function () {
|
const getNormalizedUnicodes = getArrayLookupTableFactory(function () {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
return [
|
return [
|
||||||
"\u00A8", "\u0020\u0308",
|
"\u00A8", "\u0020\u0308",
|
||||||
@ -1629,13 +1628,13 @@ var getNormalizedUnicodes = getArrayLookupTableFactory(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function reverseIfRtl(chars) {
|
function reverseIfRtl(chars) {
|
||||||
var charsLength = chars.length;
|
const charsLength = chars.length;
|
||||||
// Reverse an arabic ligature.
|
// Reverse an arabic ligature.
|
||||||
if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
|
if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
|
||||||
return chars;
|
return chars;
|
||||||
}
|
}
|
||||||
var s = "";
|
let s = "";
|
||||||
for (var ii = charsLength - 1; ii >= 0; ii--) {
|
for (let ii = charsLength - 1; ii >= 0; ii--) {
|
||||||
s += chars[ii];
|
s += chars[ii];
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user