1313 * limitations under the License.
1414 */
1515/* no-babel-preset */
16- /* eslint-disable no-var */
1716
1817import {
1918 getArrayLookupTableFactory ,
@@ -23,7 +22,7 @@ import {
2322// Some characters, e.g. copyrightserif, are mapped to the private use area
2423// and might not be displayed using standard fonts. Mapping/hacking well-known
2524// chars to the similar equivalents in the normal characters range.
26- var getSpecialPUASymbols = getLookupTableFactory ( function ( t ) {
25+ const getSpecialPUASymbols = getLookupTableFactory ( function ( t ) {
2726 t [ 63721 ] = 0x00a9 ; // copyrightsans (0xF8E9) => copyright
2827 t [ 63193 ] = 0x00a9 ; // copyrightserif (0xF6D9) => copyright
2928 t [ 63720 ] = 0x00ae ; // registersans (0xF8E8) => registered
@@ -63,7 +62,7 @@ function mapSpecialUnicodeValues(code) {
6362}
6463
6564function getUnicodeForGlyph ( name , glyphsUnicodeMap ) {
66- var unicode = glyphsUnicodeMap [ name ] ;
65+ let unicode = glyphsUnicodeMap [ name ] ;
6766 if ( unicode !== undefined ) {
6867 return unicode ;
6968 }
@@ -72,8 +71,8 @@ function getUnicodeForGlyph(name, glyphsUnicodeMap) {
7271 }
7372 // Try to recover valid Unicode values from 'uniXXXX'/'uXXXX{XX}' glyphs.
7473 if ( name [ 0 ] === "u" ) {
75- var nameLen = name . length ,
76- hexStr ;
74+ const nameLen = name . length ;
75+ let hexStr ;
7776
7877 if ( nameLen === 7 && name [ 1 ] === "n" && name [ 2 ] === "i" ) {
7978 // 'uniXXXX'
@@ -95,7 +94,7 @@ function getUnicodeForGlyph(name, glyphsUnicodeMap) {
9594 return - 1 ;
9695}
9796
98- var UnicodeRanges = [
97+ const UnicodeRanges = [
9998 { begin : 0x0000 , end : 0x007f } , // Basic Latin
10099 { begin : 0x0080 , end : 0x00ff } , // Latin-1 Supplement
101100 { begin : 0x0100 , end : 0x017f } , // Latin Extended-A
@@ -222,8 +221,8 @@ var UnicodeRanges = [
222221] ;
223222
224223function getUnicodeRangeFor ( value ) {
225- for ( var i = 0 , ii = UnicodeRanges . length ; i < ii ; i ++ ) {
226- var range = UnicodeRanges [ i ] ;
224+ for ( let i = 0 , ii = UnicodeRanges . length ; i < ii ; i ++ ) {
225+ const range = UnicodeRanges [ i ] ;
227226 if ( value >= range . begin && value < range . end ) {
228227 return i ;
229228 }
@@ -232,7 +231,7 @@ function getUnicodeRangeFor(value) {
232231}
233232
234233function isRTLRangeFor ( value ) {
235- var range = UnicodeRanges [ 13 ] ;
234+ let range = UnicodeRanges [ 13 ] ;
236235 if ( value >= range . begin && value < range . end ) {
237236 return true ;
238237 }
@@ -245,7 +244,7 @@ function isRTLRangeFor(value) {
245244
246245// The normalization table is obtained by filtering the Unicode characters
247246// database with <compat> entries.
248- var getNormalizedUnicodes = getArrayLookupTableFactory ( function ( ) {
247+ const getNormalizedUnicodes = getArrayLookupTableFactory ( function ( ) {
249248 // prettier-ignore
250249 return [
251250 "\u00A8" , "\u0020\u0308" ,
@@ -1629,13 +1628,13 @@ var getNormalizedUnicodes = getArrayLookupTableFactory(function () {
16291628} ) ;
16301629
16311630function reverseIfRtl ( chars ) {
1632- var charsLength = chars . length ;
1631+ const charsLength = chars . length ;
16331632 // Reverse an arabic ligature.
16341633 if ( charsLength <= 1 || ! isRTLRangeFor ( chars . charCodeAt ( 0 ) ) ) {
16351634 return chars ;
16361635 }
1637- var s = "" ;
1638- for ( var ii = charsLength - 1 ; ii >= 0 ; ii -- ) {
1636+ let s = "" ;
1637+ for ( let ii = charsLength - 1 ; ii >= 0 ; ii -- ) {
16391638 s += chars [ ii ] ;
16401639 }
16411640 return s ;
0 commit comments