UNPKG

isoterm

Version:

A Terminal With Precisely Configurable Fonts Using CSS Unicode Ranges

1,410 lines (1,366 loc) 4.9 MB
/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/extract.js": /*!*******************************************************************************!*\ !*** ./addons/xterm-addon-ligatures/node_modules/font-finder/dist/extract.js ***! \*******************************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const os = __webpack_require__(/*! os */ "?dc4c"); var Type; (function (Type) { Type["Serif"] = "serif"; Type["SansSerif"] = "sansSerif"; Type["Monospace"] = "monospace"; Type["Cursive"] = "cursive"; Type["Unknown"] = "unknown"; })(Type = exports.Type || (exports.Type = {})); var Style; (function (Style) { Style["Regular"] = "regular"; Style["Italic"] = "italic"; Style["Oblique"] = "oblique"; Style["Bold"] = "bold"; Style["BoldItalic"] = "boldItalic"; Style["BoldOblique"] = "boldOblique"; Style["Other"] = "other"; })(Style = exports.Style || (exports.Style = {})); const standardEndings = [ ' Regular', ' Bold', ' Bold Italic', ' Bold Oblique', ' Italic', ' Oblique' ]; function name(fontData, language) { const family = fontData.names.preferredFamily && fontData.names.preferredFamily[language] ? fontData.names.preferredFamily[language] : fontData.names.fontFamily[language]; // On Windows, if the full font name doesn't end with one of the standard // forms, the full name is needed to identify the font. Notably, this is not // the same thing as the subfamily matching it, as with 'Roboto Thin Italic' // where the subfamily is 'Thin Italic'. In this case, the 'Italic' should // be removed, but not the 'Thin'. // TODO: actually, 'Roboto' and 'Roboto Thin' seem to both work. This needs // more work to figure out the exact logic if (os.platform() === 'win32') { const subfamily = fontData.names.preferredSubfamily && fontData.names.preferredSubfamily[language] ? fontData.names.preferredSubfamily[language] : fontData.names.fontSubfamily[language]; const fullName = `${family} ${subfamily}`; let endIndex = -1; for (const end of standardEndings) { const index = fullName.lastIndexOf(end); if (index !== -1) { endIndex = index; break; } } if (endIndex !== -1) { return fullName.substring(0, endIndex); } return fullName; } return family; } exports.name = name; function type(fontData) { if (fontData.os2) { // Panose specification: https://monotype.github.io/panose/pan1.htm switch (fontData.os2.panose[0]) { case 2: // https://monotype.github.io/panose/pan2.htm#_Toc380547256 if (fontData.os2.panose[3] === 9) { return Type.Monospace; } // https://monotype.github.io/panose/pan2.htm#Sec2SerifStyle if (fontData.os2.panose[1] >= 11 && fontData.os2.panose[1] <= 15 || fontData.os2.panose[1] === 0) { return Type.SansSerif; } return Type.Serif; case 3: return Type.Cursive; } } else if (fontData.post && fontData.post.isFixedPitch) { return Type.Monospace; } // TODO: better classification return Type.Unknown; } exports.type = type; // https://docs.microsoft.com/en-us/typography/opentype/spec/os2#fsselection function style(fontData) { // If we don't have an OS/2 or head table, there's no good way to figure out // what's in the font if (!fontData.os2 && !fontData.head) { return Style.Other; } const bold = fontData.os2 ? fontData.os2.fsSelection & 0x20 // OS/2: fsSelection bit 5 : fontData.head.macStyle & 0x01; // head: macStyle bit 0 const italic = fontData.os2 ? fontData.os2.fsSelection & 0x01 // OS/2: fsSelection bit 0 : fontData.post ? fontData.post.italicAngle < 0 // post: negative italicAngle : fontData.head.macStyle & 0x02; // head: macStyle bit 1 const oblique = fontData.os2 ? fontData.os2.fsSelection & 0x200 // OS/2: fsSelection bit 9 : fontData.post ? fontData.post.italicAngle > 0 // post: positive italicAngle : 0; // head: N/A const regular = fontData.os2 ? fontData.os2.fsSelection & 0x140 // OS/2: fsSelection bit 6 or 8 (WWS) : 1; // head: N/A (assume yes for fallback) if (bold) { // Oblique has to come before italic for it to get picked up if (oblique) { return Style.BoldOblique; } if (italic) { return Style.BoldItalic; } return Style.Bold; } // Oblique has to come before italic for it to get picked up if (oblique) { return Style.Oblique; } if (italic) { return Style.Italic; } if (regular) { return Style.Regular; } // TODO: better classification return Style.Other; } exports.style = style; const boldStyles = [Style.Bold, Style.BoldItalic, Style.BoldOblique]; function weight(fontData) { if (fontData.os2) { // Use the OS/2 weight class if available return fontData.os2.usWeightClass; } else if (boldStyles.includes(style(fontData))) { // Assume 700 if the font is a bold font return 700; } else { // Assume the standard 400 if all else fails return 400; } } exports.weight = weight; //# sourceMappingURL=extract.js.map /***/ }), /***/ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/index.js": /*!*****************************************************************************!*\ !*** ./addons/xterm-addon-ligatures/node_modules/font-finder/dist/index.js ***! \*****************************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; }; Object.defineProperty(exports, "__esModule", ({ value: true })); const get_system_fonts_1 = __webpack_require__(/*! get-system-fonts */ "./addons/xterm-addon-ligatures/node_modules/get-system-fonts/dist/index.js"); const parse_1 = __webpack_require__(/*! ./parse */ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/parse.js"); const extract = __webpack_require__(/*! ./extract */ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/extract.js"); var extract_1 = __webpack_require__(/*! ./extract */ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/extract.js"); exports.Type = extract_1.Type; exports.Style = extract_1.Style; /** * Retrieve metadata for all fonts installed on the system. * * @param options Options to configure font retrieval */ async function list(options) { const opts = Object.assign({ concurrency: 4, language: 'en', onFontError: null }, options); // TODO: support woff, woff2, ttc const files = await get_system_fonts_1.default({ extensions: ['ttf', 'otf'] }); // Process each font in parallel, swallowing any errors found along the way. const results = await parallelize(async (file) => { try { const fontData = await parse_1.default(file); return getMetadata(file, fontData, opts.language); } catch (e) { if (opts.onFontError) { opts.onFontError(file, e); } } }, files, opts.concurrency); // Group the fonts by their font family const fonts = {}; for (let _a of results.filter(font => font)) { const { name } = _a, font = __rest(_a, ["name"]); if (!fonts[name]) { fonts[name] = []; } fonts[name].push(font); } return fonts; } exports.list = list; /** * Lists all variants found for the provided font family. If no variants are * found, an empty array is returned. * * @param name The name of the font family to retrieve * @param options Options to configure font retrieval */ async function listVariants(name, options) { const fonts = await list(options); return fonts[name] || []; } exports.listVariants = listVariants; /** * Gets metadata for a single font file, returning metadata for the first * font variant found in the file. If there is an error extracting the font, an * error is thrown (unlike in list, where the font is simply ignored). * * @param path Absolute path to the file to retrieve * @param options Options to configure font retrieval */ async function get(path, options) { const opts = Object.assign({ language: 'en' }, options); const fontData = await parse_1.default(path); return getMetadata(path, fontData, opts.language); } exports.get = get; /** * Extracts font metadata, given the font information. * * @param path Absolute path to the font file * @param fontData Table data for the font * @param language Language to use when resolving names */ function getMetadata(path, fontData, language) { return { name: extract.name(fontData, language), path, type: extract.type(fontData), weight: extract.weight(fontData), style: extract.style(fontData) }; } /** * Runs an asynchronous operation against a list of inputs, capping the * concurrency of execution at the provided number. * * @param operation Function to run with each input * @param data Array of inputs to be applied to the function. Inputs are started * in array order * @param concurrency The maximum number of operations to run simultaneously */ async function parallelize(operation, data, concurrency) { const results = []; let index = 0; const wrapper = async (i) => { results.push(await operation(data[i])); if (index < data.length) { await wrapper(index++); } }; const promises = []; for (; index < data.length && index < concurrency; index++) { promises.push(wrapper(index)); } await Promise.all(promises); return results; } //# sourceMappingURL=index.js.map /***/ }), /***/ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/parse.js": /*!*****************************************************************************!*\ !*** ./addons/xterm-addon-ligatures/node_modules/font-finder/dist/parse.js ***! \*****************************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const fs = __webpack_require__(/*! fs */ "?029a"); const promise_stream_reader_1 = __webpack_require__(/*! promise-stream-reader */ "./addons/xterm-addon-ligatures/node_modules/promise-stream-reader/dist/index.js"); const name_1 = __webpack_require__(/*! ./tables/name */ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/name.js"); const ltag_1 = __webpack_require__(/*! ./tables/ltag */ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/ltag.js"); const os2_1 = __webpack_require__(/*! ./tables/os2 */ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/os2.js"); const head_1 = __webpack_require__(/*! ./tables/head */ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/head.js"); const post_1 = __webpack_require__(/*! ./tables/post */ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/post.js"); var SignatureType; (function (SignatureType) { SignatureType[SignatureType["TrueType"] = 0] = "TrueType"; SignatureType[SignatureType["CFF"] = 1] = "CFF"; SignatureType[SignatureType["Woff"] = 2] = "Woff"; })(SignatureType || (SignatureType = {})); const tableInfo = { name: { tag: Buffer.from('name'), parse: name_1.default }, ltag: { tag: Buffer.from('ltag'), parse: ltag_1.default }, os2: { tag: Buffer.from('OS/2'), parse: os2_1.default }, head: { tag: Buffer.from('head'), parse: head_1.default }, post: { tag: Buffer.from('post'), parse: post_1.default } }; /** * Loads the bare minimum information needed to retrieve the metadata that we * want, streaming the data from the file until we've found everything we need. * * @param filePath Absolute path to the font to load */ async function parseFont(filePath) { return new Promise((resolve, reject) => { (async () => { const pStream = promise_stream_reader_1.default(); const stream = fs.createReadStream(filePath); // Track the stream state so we don't try to destroy a closed socket let streamFinished = false; const markFinished = () => { streamFinished = true; }; stream.once('close', markFinished); stream.once('end', markFinished); stream.once('error', e => { streamFinished = true; reject(e); }); stream.pipe(pStream); try { const signature = parseTag(await pStream.read(4)); switch (signature) { case SignatureType.TrueType: case SignatureType.CFF: const numTables = (await pStream.read(2)).readUInt16BE(0); // Skip the rest of the offset table await pStream.skip(6); // Get the table metadata const tableMeta = await findTableRecords(pStream, numTables); // Order the tables based on location in the file. We // want to look for earlier tables first const orderedTables = Object.entries(tableMeta) .sort((a, b) => a[1].offset - b[1].offset); // Get the buffer representing each of the tables const tableData = {}; for (const [name, meta] of orderedTables) { // Skip the data between the end of the previous // table and the start of this one await pStream.skip(meta.offset - pStream.offset); tableData[name] = await pStream.read(meta.length); } // The ltag table is usually not present, but parse it // first if it is because we need it for the name table. let ltag = []; if (tableData.ltag) { ltag = tableInfo.ltag.parse(tableData.ltag); } // If any of the necessary font tables are missing, // throw if (!tableData.name) { throw new Error(`missing required OpenType table 'name' in font file: ${filePath}`); } // Parse and return the tables we need return { names: tableInfo.name.parse(tableData.name, ltag), os2: tableData.os2 && tableInfo.os2.parse(tableData.os2), head: tableData.head && tableInfo.head.parse(tableData.head), post: tableData.post && tableInfo.post.parse(tableData.post) }; case SignatureType.Woff: default: throw new Error('provided font type is not supported yet'); } } finally { // Clean up our state so that the file stream doesn't leak stream.unpipe(pStream); if (!streamFinished) { stream.destroy(); pStream.destroy(); } } })().then(resolve, reject); }); } exports["default"] = parseFont; const signatures = { one: Buffer.from([0x00, 0x01, 0x00, 0x00]), otto: Buffer.from('OTTO'), true: Buffer.from('true'), typ1: Buffer.from('typ1'), woff: Buffer.from('wOFF') }; /** * Parses a tag buffer, returning the type of font contained within. * * @param tag 4-byte buffer to parse for the tag */ function parseTag(tag) { if (tag.equals(signatures.one) || tag.equals(signatures.true) || tag.equals(signatures.typ1)) { return SignatureType.TrueType; } else if (tag.equals(signatures.otto)) { return SignatureType.CFF; } else if (tag.equals(signatures.woff)) { return SignatureType.Woff; } else { throw new Error(`Unsupported signature type: ${tag}`); } } /** * Parse the table record list for the specific tables that we care about. * * @param stream Promise stream positioned at the table record list * @param numTables The number of tables in the table record list */ async function findTableRecords(stream, numTables) { const tableMeta = {}; for (let i = 0; i < numTables; i++) { const tag = await stream.read(4); const data = await stream.read(12); for (const [name, table] of Object.entries(tableInfo)) { if (tag.equals(table.tag)) { tableMeta[name] = { offset: data.readUInt32BE(4), length: data.readUInt32BE(8) }; if (tableMeta.name && tableMeta.ltag && tableMeta.os2) { return tableMeta; } } } } return tableMeta; } //# sourceMappingURL=parse.js.map /***/ }), /***/ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/head.js": /*!***********************************************************************************!*\ !*** ./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/head.js ***! \***********************************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const utility_1 = __webpack_require__(/*! ./utility */ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/utility.js"); // Parse the header `head` table function parseHeadTable(data) { return { version: utility_1.formatFixed(data.readUInt16BE(0), data.readUInt16BE(2)), fontRevision: utility_1.formatFixed(data.readUInt16BE(4), data.readUInt16BE(6)), checkSumAdjustment: data.readUInt32BE(8), magicNumber: data.readUInt32BE(12), flags: data.readUInt16BE(16), unitsPerEm: data.readUInt16BE(18), created: utility_1.formatLongDateTime(data.readUInt32BE(20), data.readUInt32BE(24)), modified: utility_1.formatLongDateTime(data.readUInt32BE(28), data.readUInt32BE(32)), xMin: data.readInt16BE(36), yMin: data.readInt16BE(38), xMax: data.readInt16BE(40), yMax: data.readInt16BE(42), macStyle: data.readUInt16BE(44), lowestRecPPEM: data.readUInt16BE(46), fontDirectionHint: data.readInt16BE(48), indexToLocFormat: data.readInt16BE(50), glyphDataFormat: data.readInt16BE(52) }; } exports["default"] = parseHeadTable; //# sourceMappingURL=head.js.map /***/ }), /***/ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/ltag.js": /*!***********************************************************************************!*\ !*** ./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/ltag.js ***! \***********************************************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; // This file is modified from opentype.js. All credit for the capabilities // provided herein goes to that project and its maintainers. The project can be // found at https://github.com/nodebox/opentype.js Object.defineProperty(exports, "__esModule", ({ value: true })); // The `ltag` table stores IETF BCP-47 language tags. It allows supporting // languages for which TrueType does not assign a numeric code. // https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6ltag.html // http://www.w3.org/International/articles/language-tags/ // http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry function parseLtagTable(data) { const tableVersion = data.readUInt32BE(0); if (tableVersion !== 1) { throw new Error('Unsupported ltag table version.'); } // The 'ltag' specification does not define any flags; skip the field. const numTags = data.readUInt32BE(8); const tags = []; for (let i = 0; i < numTags; i++) { let tag = ''; const offset = data.readUInt16BE(12 + i * 4); const length = data.readUInt16BE(14 + i * 4); for (let j = offset; j < offset + length; ++j) { tag += String.fromCharCode(data.readInt8(j)); } tags.push(tag); } return tags; } exports["default"] = parseLtagTable; //# sourceMappingURL=ltag.js.map /***/ }), /***/ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/name.js": /*!***********************************************************************************!*\ !*** ./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/name.js ***! \***********************************************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; // This file is modified from opentype.js. All credit for the capabilities // provided herein goes to that project and its maintainers. The project can be // found at https://github.com/nodebox/opentype.js Object.defineProperty(exports, "__esModule", ({ value: true })); // The `name` naming table. // https://www.microsoft.com/typography/OTSPEC/name.htm // NameIDs for the name table. const nameTableNames = [ 'copyright', 'fontFamily', 'fontSubfamily', 'uniqueID', 'fullName', 'version', 'postScriptName', 'trademark', 'manufacturer', 'designer', 'description', 'manufacturerURL', 'designerURL', 'license', 'licenseURL', 'reserved', 'preferredFamily', 'preferredSubfamily', 'compatibleFullName', 'sampleText', 'postScriptFindFontName', 'wwsFamily', 'wwsSubfamily' // 22 ]; const macLanguages = { 0: 'en', 1: 'fr', 2: 'de', 3: 'it', 4: 'nl', 5: 'sv', 6: 'es', 7: 'da', 8: 'pt', 9: 'no', 10: 'he', 11: 'ja', 12: 'ar', 13: 'fi', 14: 'el', 15: 'is', 16: 'mt', 17: 'tr', 18: 'hr', 19: 'zh-Hant', 20: 'ur', 21: 'hi', 22: 'th', 23: 'ko', 24: 'lt', 25: 'pl', 26: 'hu', 27: 'es', 28: 'lv', 29: 'se', 30: 'fo', 31: 'fa', 32: 'ru', 33: 'zh', 34: 'nl-BE', 35: 'ga', 36: 'sq', 37: 'ro', 38: 'cz', 39: 'sk', 40: 'si', 41: 'yi', 42: 'sr', 43: 'mk', 44: 'bg', 45: 'uk', 46: 'be', 47: 'uz', 48: 'kk', 49: 'az-Cyrl', 50: 'az-Arab', 51: 'hy', 52: 'ka', 53: 'mo', 54: 'ky', 55: 'tg', 56: 'tk', 57: 'mn-CN', 58: 'mn', 59: 'ps', 60: 'ks', 61: 'ku', 62: 'sd', 63: 'bo', 64: 'ne', 65: 'sa', 66: 'mr', 67: 'bn', 68: 'as', 69: 'gu', 70: 'pa', 71: 'or', 72: 'ml', 73: 'kn', 74: 'ta', 75: 'te', 76: 'si', 77: 'my', 78: 'km', 79: 'lo', 80: 'vi', 81: 'id', 82: 'tl', 83: 'ms', 84: 'ms-Arab', 85: 'am', 86: 'ti', 87: 'om', 88: 'so', 89: 'sw', 90: 'rw', 91: 'rn', 92: 'ny', 93: 'mg', 94: 'eo', 128: 'cy', 129: 'eu', 130: 'ca', 131: 'la', 132: 'qu', 133: 'gn', 134: 'ay', 135: 'tt', 136: 'ug', 137: 'dz', 138: 'jv', 139: 'su', 140: 'gl', 141: 'af', 142: 'br', 143: 'iu', 144: 'gd', 145: 'gv', 146: 'ga', 147: 'to', 148: 'el-polyton', 149: 'kl', 150: 'az', 151: 'nn' }; // While Microsoft indicates a region/country for all its language // IDs, we omit the region code if it's equal to the "most likely // region subtag" according to Unicode CLDR. For scripts, we omit // the subtag if it is equal to the Suppress-Script entry in the // IANA language subtag registry for IETF BCP 47. // // For example, Microsoft states that its language code 0x041A is // Croatian in Croatia. We transform this to the BCP 47 language code 'hr' // and not 'hr-HR' because Croatia is the default country for Croatian, // according to Unicode CLDR. As another example, Microsoft states // that 0x101A is Croatian (Latin) in Bosnia-Herzegovina. We transform // this to 'hr-BA' and not 'hr-Latn-BA' because Latin is the default script // for the Croatian language, according to IANA. // // http://www.unicode.org/cldr/charts/latest/supplemental/likely_subtags.html // http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry const windowsLanguages = { 0x0436: 'af', 0x041C: 'sq', 0x0484: 'gsw', 0x045E: 'am', 0x1401: 'ar-DZ', 0x3C01: 'ar-BH', 0x0C01: 'ar', 0x0801: 'ar-IQ', 0x2C01: 'ar-JO', 0x3401: 'ar-KW', 0x3001: 'ar-LB', 0x1001: 'ar-LY', 0x1801: 'ary', 0x2001: 'ar-OM', 0x4001: 'ar-QA', 0x0401: 'ar-SA', 0x2801: 'ar-SY', 0x1C01: 'aeb', 0x3801: 'ar-AE', 0x2401: 'ar-YE', 0x042B: 'hy', 0x044D: 'as', 0x082C: 'az-Cyrl', 0x042C: 'az', 0x046D: 'ba', 0x042D: 'eu', 0x0423: 'be', 0x0845: 'bn', 0x0445: 'bn-IN', 0x201A: 'bs-Cyrl', 0x141A: 'bs', 0x047E: 'br', 0x0402: 'bg', 0x0403: 'ca', 0x0C04: 'zh-HK', 0x1404: 'zh-MO', 0x0804: 'zh', 0x1004: 'zh-SG', 0x0404: 'zh-TW', 0x0483: 'co', 0x041A: 'hr', 0x101A: 'hr-BA', 0x0405: 'cs', 0x0406: 'da', 0x048C: 'prs', 0x0465: 'dv', 0x0813: 'nl-BE', 0x0413: 'nl', 0x0C09: 'en-AU', 0x2809: 'en-BZ', 0x1009: 'en-CA', 0x2409: 'en-029', 0x4009: 'en-IN', 0x1809: 'en-IE', 0x2009: 'en-JM', 0x4409: 'en-MY', 0x1409: 'en-NZ', 0x3409: 'en-PH', 0x4809: 'en-SG', 0x1C09: 'en-ZA', 0x2C09: 'en-TT', 0x0809: 'en-GB', 0x0409: 'en', 0x3009: 'en-ZW', 0x0425: 'et', 0x0438: 'fo', 0x0464: 'fil', 0x040B: 'fi', 0x080C: 'fr-BE', 0x0C0C: 'fr-CA', 0x040C: 'fr', 0x140C: 'fr-LU', 0x180C: 'fr-MC', 0x100C: 'fr-CH', 0x0462: 'fy', 0x0456: 'gl', 0x0437: 'ka', 0x0C07: 'de-AT', 0x0407: 'de', 0x1407: 'de-LI', 0x1007: 'de-LU', 0x0807: 'de-CH', 0x0408: 'el', 0x046F: 'kl', 0x0447: 'gu', 0x0468: 'ha', 0x040D: 'he', 0x0439: 'hi', 0x040E: 'hu', 0x040F: 'is', 0x0470: 'ig', 0x0421: 'id', 0x045D: 'iu', 0x085D: 'iu-Latn', 0x083C: 'ga', 0x0434: 'xh', 0x0435: 'zu', 0x0410: 'it', 0x0810: 'it-CH', 0x0411: 'ja', 0x044B: 'kn', 0x043F: 'kk', 0x0453: 'km', 0x0486: 'quc', 0x0487: 'rw', 0x0441: 'sw', 0x0457: 'kok', 0x0412: 'ko', 0x0440: 'ky', 0x0454: 'lo', 0x0426: 'lv', 0x0427: 'lt', 0x082E: 'dsb', 0x046E: 'lb', 0x042F: 'mk', 0x083E: 'ms-BN', 0x043E: 'ms', 0x044C: 'ml', 0x043A: 'mt', 0x0481: 'mi', 0x047A: 'arn', 0x044E: 'mr', 0x047C: 'moh', 0x0450: 'mn', 0x0850: 'mn-CN', 0x0461: 'ne', 0x0414: 'nb', 0x0814: 'nn', 0x0482: 'oc', 0x0448: 'or', 0x0463: 'ps', 0x0415: 'pl', 0x0416: 'pt', 0x0816: 'pt-PT', 0x0446: 'pa', 0x046B: 'qu-BO', 0x086B: 'qu-EC', 0x0C6B: 'qu', 0x0418: 'ro', 0x0417: 'rm', 0x0419: 'ru', 0x243B: 'smn', 0x103B: 'smj-NO', 0x143B: 'smj', 0x0C3B: 'se-FI', 0x043B: 'se', 0x083B: 'se-SE', 0x203B: 'sms', 0x183B: 'sma-NO', 0x1C3B: 'sms', 0x044F: 'sa', 0x1C1A: 'sr-Cyrl-BA', 0x0C1A: 'sr', 0x181A: 'sr-Latn-BA', 0x081A: 'sr-Latn', 0x046C: 'nso', 0x0432: 'tn', 0x045B: 'si', 0x041B: 'sk', 0x0424: 'sl', 0x2C0A: 'es-AR', 0x400A: 'es-BO', 0x340A: 'es-CL', 0x240A: 'es-CO', 0x140A: 'es-CR', 0x1C0A: 'es-DO', 0x300A: 'es-EC', 0x440A: 'es-SV', 0x100A: 'es-GT', 0x480A: 'es-HN', 0x080A: 'es-MX', 0x4C0A: 'es-NI', 0x180A: 'es-PA', 0x3C0A: 'es-PY', 0x280A: 'es-PE', 0x500A: 'es-PR', // Microsoft has defined two different language codes for // “Spanish with modern sorting” and “Spanish with traditional // sorting”. This makes sense for collation APIs, and it would be // possible to express this in BCP 47 language tags via Unicode // extensions (eg., es-u-co-trad is Spanish with traditional // sorting). However, for storing names in fonts, the distinction // does not make sense, so we give “es” in both cases. 0x0C0A: 'es', 0x040A: 'es', 0x540A: 'es-US', 0x380A: 'es-UY', 0x200A: 'es-VE', 0x081D: 'sv-FI', 0x041D: 'sv', 0x045A: 'syr', 0x0428: 'tg', 0x085F: 'tzm', 0x0449: 'ta', 0x0444: 'tt', 0x044A: 'te', 0x041E: 'th', 0x0451: 'bo', 0x041F: 'tr', 0x0442: 'tk', 0x0480: 'ug', 0x0422: 'uk', 0x042E: 'hsb', 0x0420: 'ur', 0x0843: 'uz-Cyrl', 0x0443: 'uz', 0x042A: 'vi', 0x0452: 'cy', 0x0488: 'wo', 0x0485: 'sah', 0x0478: 'ii', 0x046A: 'yo' }; // Returns a IETF BCP 47 language code, for example 'zh-Hant' // for 'Chinese in the traditional script'. function getLanguageCode(platformID, languageID, ltag) { switch (platformID) { case 0: // Unicode if (languageID === 0xFFFF) { return 'und'; } else if (ltag) { return ltag[languageID]; } break; case 1: // Macintosh return macLanguages[languageID]; case 3: // Windows return windowsLanguages[languageID]; } return undefined; } const utf16 = 'utf-16'; // MacOS script ID → encoding. This table stores the default case, // which can be overridden by macLanguageEncodings. const macScriptEncodings = { 0: 'macintosh', 1: 'x-mac-japanese', 2: 'x-mac-chinesetrad', 3: 'x-mac-korean', 6: 'x-mac-greek', 7: 'x-mac-cyrillic', 9: 'x-mac-devanagai', 10: 'x-mac-gurmukhi', 11: 'x-mac-gujarati', 12: 'x-mac-oriya', 13: 'x-mac-bengali', 14: 'x-mac-tamil', 15: 'x-mac-telugu', 16: 'x-mac-kannada', 17: 'x-mac-malayalam', 18: 'x-mac-sinhalese', 19: 'x-mac-burmese', 20: 'x-mac-khmer', 21: 'x-mac-thai', 22: 'x-mac-lao', 23: 'x-mac-georgian', 24: 'x-mac-armenian', 25: 'x-mac-chinesesimp', 26: 'x-mac-tibetan', 27: 'x-mac-mongolian', 28: 'x-mac-ethiopic', 29: 'x-mac-ce', 30: 'x-mac-vietnamese', 31: 'x-mac-extarabic' // smExtArabic }; // MacOS language ID → encoding. This table stores the exceptional // cases, which override macScriptEncodings. For writing MacOS naming // tables, we need to emit a MacOS script ID. Therefore, we cannot // merge macScriptEncodings into macLanguageEncodings. // // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt const macLanguageEncodings = { 15: 'x-mac-icelandic', 17: 'x-mac-turkish', 18: 'x-mac-croatian', 24: 'x-mac-ce', 25: 'x-mac-ce', 26: 'x-mac-ce', 27: 'x-mac-ce', 28: 'x-mac-ce', 30: 'x-mac-icelandic', 37: 'x-mac-romanian', 38: 'x-mac-ce', 39: 'x-mac-ce', 40: 'x-mac-ce', 143: 'x-mac-inuit', 146: 'x-mac-gaelic' // langIrishGaelicScript }; function getEncoding(platformID, encodingID, languageID) { switch (platformID) { case 0: // Unicode return utf16; case 1: // Apple Macintosh return macLanguageEncodings[languageID] || macScriptEncodings[encodingID]; case 3: // Microsoft Windows if (encodingID === 1 || encodingID === 10) { return utf16; } break; } return undefined; } // Parse the naming `name` table. // FIXME: Format 1 additional fields are not supported yet. // ltag is the content of the `ltag' table, such as ['en', 'zh-Hans', 'de-CH-1904']. function parseNameTable(data, ltag) { const name = {}; // const format = data.readUInt16BE(0); const count = data.readUInt16BE(2); const stringOffset = data.readUInt16BE(4); let tableOffset = 6; for (let i = 0; i < count; i++) { const platformID = data.readUInt16BE(tableOffset + 0); const encodingID = data.readUInt16BE(tableOffset + 2); const languageID = data.readUInt16BE(tableOffset + 4); const nameID = data.readUInt16BE(tableOffset + 6); const property = nameTableNames[nameID] || String(nameID); const byteLength = data.readUInt16BE(tableOffset + 8); const offset = data.readUInt16BE(tableOffset + 10); const language = getLanguageCode(platformID, languageID, ltag); const encoding = getEncoding(platformID, encodingID, languageID); tableOffset += 12; if (encoding !== undefined && language !== undefined) { let text; if (encoding === utf16) { const charLength = byteLength / 2; const chars = Array(charLength); for (let i = 0; i < charLength; i++) { chars[i] = data.readUInt16BE(stringOffset + offset + i * 2); } text = String.fromCharCode(...chars); } else { text = decodeMacString(data, stringOffset + offset, byteLength, encoding); } if (text) { let translations = name[property]; // tslint:disable-next-line if (translations === undefined) { translations = name[property] = {}; } translations[language] = text; } } } return name; } exports["default"] = parseNameTable; // Data for converting old eight-bit Macintosh encodings to Unicode. // This representation is optimized for decoding; encoding is slower // and needs more memory. The assumption is that all opentype.js users // want to open fonts, but saving a font will be comparatively rare // so it can be more expensive. Keyed by IANA character set name. // // Python script for generating these strings: // // s = u''.join([chr(c).decode('mac_greek') for c in range(128, 256)]) // print(s.encode('utf-8')) /** * @private */ const eightBitMacEncodings = { 'x-mac-croatian': // Python: 'mac_croatian' 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø' + '¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ', 'x-mac-cyrillic': // Python: 'mac_cyrillic' 'АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњ' + 'јЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю', 'x-mac-gaelic': // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/GAELIC.TXT 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæø' + 'ṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ', 'x-mac-greek': // Python: 'mac_greek' 'Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩ' + 'άΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ\u00AD', 'x-mac-icelandic': // Python: 'mac_iceland' 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø' + '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ', 'x-mac-inuit': // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/INUIT.TXT 'ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗ' + 'ᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł', 'x-mac-ce': // Python: 'mac_latin2' 'ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅ' + 'ņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ', macintosh: // Python: 'mac_roman' 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø' + '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ', 'x-mac-romanian': // Python: 'mac_romanian' 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș' + '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ', 'x-mac-turkish': // Python: 'mac_turkish' 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø' + '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ' }; /** * Decodes an old-style Macintosh string. Returns either a Unicode JavaScript * string, or 'undefined' if the encoding is unsupported. For example, we do * not support Chinese, Japanese or Korean because these would need large * mapping tables. * @param {DataView} dataView * @param {number} offset * @param {number} dataLength * @param {string} encoding * @returns {string} */ function decodeMacString(data, offset, dataLength, encoding) { const table = eightBitMacEncodings[encoding]; if (table === undefined) { return undefined; } let result = ''; for (let i = 0; i < dataLength; i++) { const c = data.readUInt8(offset + i); // In all eight-bit Mac encodings, the characters 0x00..0x7F are // mapped to U+0000..U+007F; we only need to look up the others. if (c <= 0x7F) { result += String.fromCharCode(c); } else { result += table[c & 0x7F]; } } return result; } //# sourceMappingURL=name.js.map /***/ }), /***/ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/os2.js": /*!**********************************************************************************!*\ !*** ./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/os2.js ***! \**********************************************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; // This file is modified from opentype.js. All credit for the capabilities // provided herein goes to that project and its maintainers. The project can be // found at https://github.com/nodebox/opentype.js Object.defineProperty(exports, "__esModule", ({ value: true })); // Parse the OS/2 and Windows metrics `OS/2` table function parseOS2Table(data) { // The OS/2 table must be at least 78 bytes long if (data.length < 78) { return undefined; } const os2 = { version: data.readUInt16BE(0), xAvgCharWidth: data.readUInt16BE(2), usWeightClass: data.readUInt16BE(4), usWidthClass: data.readUInt16BE(6), fsType: data.readUInt16BE(8), ySubscriptXSize: data.readInt16BE(10), ySubscriptYSize: data.readInt16BE(12), ySubscriptXOffset: data.readInt16BE(14), ySubscriptYOffset: data.readInt16BE(16), ySuperscriptXSize: data.readInt16BE(18), ySuperscriptYSize: data.readInt16BE(20), ySuperscriptXOffset: data.readInt16BE(22), ySuperscriptYOffset: data.readInt16BE(24), yStrikeoutSize: data.readInt16BE(26), yStrikeoutPosition: data.readInt16BE(28), sFamilyClass: data.readInt16BE(30), panose: [ data.readUInt8(32), data.readUInt8(33), data.readUInt8(34), data.readUInt8(35), data.readUInt8(36), data.readUInt8(37), data.readUInt8(38), data.readUInt8(39), data.readUInt8(40), data.readUInt8(41) ], ulUnicodeRange1: data.readUInt32BE(42), ulUnicodeRange2: data.readUInt32BE(46), ulUnicodeRange3: data.readUInt32BE(50), ulUnicodeRange4: data.readUInt32BE(54), achVendID: String.fromCharCode(data.readUInt8(58), data.readUInt8(59), data.readUInt8(60), data.readUInt8(61)), fsSelection: data.readUInt16BE(62), usFirstCharIndex: data.readUInt16BE(64), usLastCharIndex: data.readUInt16BE(66), sTypoAscender: data.readInt16BE(68), sTypoDescender: data.readInt16BE(70), sTypoLineGap: data.readInt16BE(72), usWinAscent: data.readUInt16BE(74), usWinDescent: data.readUInt16BE(76) }; if (os2.version >= 1 && data.length >= 86) { os2.ulCodePageRange1 = data.readUInt32BE(78); os2.ulCodePageRange2 = data.readUInt32BE(82); } if (os2.version >= 2 && data.length >= 96) { os2.sxHeight = data.readInt16BE(86); os2.sCapHeight = data.readInt16BE(88); os2.usDefaultChar = data.readUInt16BE(90); os2.usBreakChar = data.readUInt16BE(92); os2.usMaxContent = data.readUInt16BE(94); } return os2; } exports["default"] = parseOS2Table; //# sourceMappingURL=os2.js.map /***/ }), /***/ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/post.js": /*!***********************************************************************************!*\ !*** ./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/post.js ***! \***********************************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const utility_1 = __webpack_require__(/*! ./utility */ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/utility.js"); // Parse the PostScript `post` table. We don't bother with version-specific data // because it doesn't impact any of our computations function parsePostTable(data) { return { version: utility_1.formatFixed(data.readUInt16BE(0), data.readUInt16BE(2)), italicAngle: utility_1.formatFixed(data.readUInt16BE(4), data.readUInt16BE(6)), underlinePosition: data.readInt16BE(8), underlineThickness: data.readInt16BE(10), isFixedPitch: data.readUInt32BE(12), minMemType42: data.readUInt32BE(16), maxMemType42: data.readUInt32BE(20), minMemType1: data.readUInt32BE(24), maxMemType1: data.readUInt32BE(28) }; } exports["default"] = parsePostTable; //# sourceMappingURL=post.js.map /***/ }), /***/ "./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/utility.js": /*!**************************************************************************************!*\ !*** ./addons/xterm-addon-ligatures/node_modules/font-finder/dist/tables/utility.js ***! \**************************************************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); function formatFixed(whole, fraction) { return whole + fraction / 2 ** 16; } exports.formatFixed = formatFixed; function formatLongDateTime(high, low) { // OpenType dates are since 1904. We make them since 1970 to align with unix // and multiply by 1000 to make it a millisecond time like the rest of // Javascript return ((high * 2 ** 32) + low - 2082844800) * 1000; } exports.formatLongDateTime = formatLongDateTime; //# sourceMappingURL=utility.js.map /***/ }), /***/ "./addons/xterm-addon-ligatures/node_modules/font-ligatures/dist/flatten.js": /*!**********************************************************************************!*\ !*** ./addons/xterm-addon-ligatures/node_modules/font-ligatures/dist/flatten.js ***! \**********************************************************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); function flatten(tree) { const result = {}; for (const [glyphId, entry] of Object.entries(tree.individual)) { result[glyphId] = flattenEntry(entry); } for (const { range, entry } of tree.range) { const flattened = flattenEntry(entry); for (let glyphId = range[0]; glyphId < range[1]; glyphId++) { result[glyphId] = flattened; } } return result; } exports["default"] = flatten; function flattenEntry(entry) { const result = {}; if (entry.forward) { result.forward = flatten(entry.forward); } if (entry.reverse) { result.reverse = flatten(entry.reverse); } if (entry.lookup) { result.lookup = entry.lookup; } return result; } //# sourceMappingURL=flatten.js.map /***/ }), /***/ "./addons/xterm-addon-ligatures/node_modules/font-ligatures/dist/index.js": /*!********************************************************************************!*\ !*** ./addons/xterm-addon-ligatures/node_modules/font-ligatures/dist/index.js ***! \********************************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const opentype = __webpack_require__(/*! opentype.js */ "./addons/xterm-addon-ligatures/node_modules/opentype.js/src/opentype.js"); const lru = __webpack_require__(/*! lru-cache */ "./addons/xterm-addon-ligatures/node_modules/lru-cache/index.js"); const merge_1 = __webpack_require__(/*! ./merge */ "./addons/xterm-addon-ligatures/node_modules/font-ligatures/dist/merge.js"); const walk_1 = __webpack_require__(/*! ./walk */ "./addons/xterm-addon-ligatures/node_modules/font-ligatures/dist/walk.js"); const mergeRange_1 = __webpack_require__(/*! ./mergeRange */ "./addons/xterm-addon-ligatures/node_modules/font-ligatures/dist/mergeRange.js"); const _6_1_1 = __webpack_require__(/*! ./processors/6-1 */ "./addons/xterm-addon-ligatures/node_modules/font-ligatures/dist/processors/6-1.js"); const _6_2_1 = __webpack_require__(/*! ./processors/6-2 */ "./addons/xterm-addon-ligatures/node_modules/font-ligatures/dist/processors/6-2.js"); const _6_3_1 = __webpack_require__(/*! ./processors/6-3 */ "./addons/xterm-addon-ligatures/node_modules/font-ligatures/dist/processors/6-3.js"); const _8_1_1 = __webpack_require__(/*! ./processors/8-1 */ "./addons/xterm-addon-ligatures/node_modules/font-ligatures/dist/processors/8-1.js"); const flatten_1 = __webpack_require__(/*! ./flatten */ "./addons/xterm-addon-ligatures/node_modules/font-ligatures/dist/flatten.js"); class FontImpl { constructor(font, options) { this._lookupTrees = []; this._glyphLookups = {}; this._font = font; if (options.cacheSize > 0) { this._cache = new lru({ max: options.cacheSize, length: ((val, key) => key.length) }); } const caltFeatures = this._font.tables.gsub && this._font.tables.gsub.features.filter(f => f.tag === 'calt') || []; const lookupIndices = caltFeatures .reduce((acc, val) => [...acc, ...val.feature.lookupListIndexes], []); const allLookups = this._font.tables.gsub && this._font.tables.gsub.lookups || []; const lookupGroups = allLookups.filter((l, i) => lookupIndices.some(idx => idx === i)); for (const [index, lookup] of lookupGroups.entries()) { const trees = []; switch (lookup.lookupType) { case 6: for (const [index, table] of lookup.subtables.entries()) { switch (table.substFormat) { case 1: trees.push(_6_1_1.default(table, allLookups, index)); break; case 2: trees.push(_6_2_1.default(table, allLookups, index)); break; case 3: trees.push(_6_3_1.default(table, allLookups, index)); break; } } break; case 8: for (const [index, table] of lookup.subtables.entries()) { trees.push(_8_1_1.default(table, index)); } break; } const tree = flatten_1.default(merge_1.default(trees)); this._lookupTrees.push({ tree, processForward: lookup.lookupType !== 8 }); for (const glyphId of Object.keys(tree)) { if (!this._glyphLookups[glyphId]) { this._glyphLookups[glyphId] = []; } this._glyphLookups[glyphId].push(index); } } } findLigatures(text) { const cached = this._cache && this._cache.get(text); if (cached && !Array.isArray(cached)) { return cached; } const glyphIds = []; for (const char of text) { glyphIds.push(this._font.charToGlyphIndex(char));