{
"version": 3,
"sources": ["../../../node_modules/opentype.js/dist/opentype.js", "../src/fontLigatures/index.ts", "../../../node_modules/lru-cache/src/diagnostics-channel-node.ts", "../../../node_modules/lru-cache/src/perf.ts", "../../../node_modules/lru-cache/src/index.ts", "../src/fontLigatures/merge.ts", "../src/fontLigatures/walk.ts", "../src/fontLigatures/mergeRange.ts", "../src/fontLigatures/processors/coverage.ts", "../src/fontLigatures/processors/substitution.ts", "../src/fontLigatures/processors/helper.ts", "../src/fontLigatures/processors/6-1.ts", "../src/fontLigatures/processors/classDef.ts", "../src/fontLigatures/processors/6-2.ts", "../src/fontLigatures/processors/6-3.ts", "../src/fontLigatures/processors/8-1.ts", "../src/fontLigatures/flatten.ts", "../src/parse.ts", "../src/font.ts", "../src/index.ts", "../src/LigaturesAddon.ts"],
"sourcesContent": ["var opentype = (() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n // src/opentype.mjs\n var opentype_exports = {};\n __export(opentype_exports, {\n BoundingBox: () => bbox_default,\n Font: () => font_default,\n Glyph: () => glyph_default,\n Path: () => path_default,\n _parse: () => parse_default,\n load: () => load,\n loadSync: () => loadSync,\n parse: () => parseBuffer\n });\n\n // src/tiny-inflate@1.0.3.esm.mjs\n var TINF_OK = 0;\n var TINF_DATA_ERROR = -3;\n function Tree() {\n this.table = new Uint16Array(16);\n this.trans = new Uint16Array(288);\n }\n function Data(source, dest) {\n this.source = source;\n this.sourceIndex = 0;\n this.tag = 0;\n this.bitcount = 0;\n this.dest = dest;\n this.destLen = 0;\n this.ltree = new Tree();\n this.dtree = new Tree();\n }\n var sltree = new Tree();\n var sdtree = new Tree();\n var length_bits = new Uint8Array(30);\n var length_base = new Uint16Array(30);\n var dist_bits = new Uint8Array(30);\n var dist_base = new Uint16Array(30);\n var clcidx = new Uint8Array([\n 16,\n 17,\n 18,\n 0,\n 8,\n 7,\n 9,\n 6,\n 10,\n 5,\n 11,\n 4,\n 12,\n 3,\n 13,\n 2,\n 14,\n 1,\n 15\n ]);\n var code_tree = new Tree();\n var lengths = new Uint8Array(288 + 32);\n function tinf_build_bits_base(bits, base, delta, first) {\n var i, sum;\n for (i = 0; i < delta; ++i) bits[i] = 0;\n for (i = 0; i < 30 - delta; ++i) bits[i + delta] = i / delta | 0;\n for (sum = first, i = 0; i < 30; ++i) {\n base[i] = sum;\n sum += 1 << bits[i];\n }\n }\n function tinf_build_fixed_trees(lt, dt) {\n var i;\n for (i = 0; i < 7; ++i) lt.table[i] = 0;\n lt.table[7] = 24;\n lt.table[8] = 152;\n lt.table[9] = 112;\n for (i = 0; i < 24; ++i) lt.trans[i] = 256 + i;\n for (i = 0; i < 144; ++i) lt.trans[24 + i] = i;\n for (i = 0; i < 8; ++i) lt.trans[24 + 144 + i] = 280 + i;\n for (i = 0; i < 112; ++i) lt.trans[24 + 144 + 8 + i] = 144 + i;\n for (i = 0; i < 5; ++i) dt.table[i] = 0;\n dt.table[5] = 32;\n for (i = 0; i < 32; ++i) dt.trans[i] = i;\n }\n var offs = new Uint16Array(16);\n function tinf_build_tree(t, lengths2, off, num) {\n var i, sum;\n for (i = 0; i < 16; ++i) t.table[i] = 0;\n for (i = 0; i < num; ++i) t.table[lengths2[off + i]]++;\n t.table[0] = 0;\n for (sum = 0, i = 0; i < 16; ++i) {\n offs[i] = sum;\n sum += t.table[i];\n }\n for (i = 0; i < num; ++i) {\n if (lengths2[off + i]) t.trans[offs[lengths2[off + i]]++] = i;\n }\n }\n function tinf_getbit(d) {\n if (!d.bitcount--) {\n d.tag = d.source[d.sourceIndex++];\n d.bitcount = 7;\n }\n var bit = d.tag & 1;\n d.tag >>>= 1;\n return bit;\n }\n function tinf_read_bits(d, num, base) {\n if (!num)\n return base;\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount;\n d.bitcount += 8;\n }\n var val = d.tag & 65535 >>> 16 - num;\n d.tag >>>= num;\n d.bitcount -= num;\n return val + base;\n }\n function tinf_decode_symbol(d, t) {\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount;\n d.bitcount += 8;\n }\n var sum = 0, cur = 0, len = 0;\n var tag = d.tag;\n do {\n cur = 2 * cur + (tag & 1);\n tag >>>= 1;\n ++len;\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n d.tag = tag;\n d.bitcount -= len;\n return t.trans[sum + cur];\n }\n function tinf_decode_trees(d, lt, dt) {\n var hlit, hdist, hclen;\n var i, num, length;\n hlit = tinf_read_bits(d, 5, 257);\n hdist = tinf_read_bits(d, 5, 1);\n hclen = tinf_read_bits(d, 4, 4);\n for (i = 0; i < 19; ++i) lengths[i] = 0;\n for (i = 0; i < hclen; ++i) {\n var clen = tinf_read_bits(d, 3, 0);\n lengths[clcidx[i]] = clen;\n }\n tinf_build_tree(code_tree, lengths, 0, 19);\n for (num = 0; num < hlit + hdist; ) {\n var sym = tinf_decode_symbol(d, code_tree);\n switch (sym) {\n case 16:\n var prev = lengths[num - 1];\n for (length = tinf_read_bits(d, 2, 3); length; --length) {\n lengths[num++] = prev;\n }\n break;\n case 17:\n for (length = tinf_read_bits(d, 3, 3); length; --length) {\n lengths[num++] = 0;\n }\n break;\n case 18:\n for (length = tinf_read_bits(d, 7, 11); length; --length) {\n lengths[num++] = 0;\n }\n break;\n default:\n lengths[num++] = sym;\n break;\n }\n }\n tinf_build_tree(lt, lengths, 0, hlit);\n tinf_build_tree(dt, lengths, hlit, hdist);\n }\n function tinf_inflate_block_data(d, lt, dt) {\n for (; ; ) {\n var sym = tinf_decode_symbol(d, lt);\n if (sym === 256) {\n return TINF_OK;\n }\n if (sym < 256) {\n d.dest[d.destLen++] = sym;\n } else {\n var length, dist, offs2;\n var i;\n sym -= 257;\n length = tinf_read_bits(d, length_bits[sym], length_base[sym]);\n dist = tinf_decode_symbol(d, dt);\n offs2 = d.destLen - tinf_read_bits(d, dist_bits[dist], dist_base[dist]);\n for (i = offs2; i < offs2 + length; ++i) {\n d.dest[d.destLen++] = d.dest[i];\n }\n }\n }\n }\n function tinf_inflate_uncompressed_block(d) {\n var length, invlength;\n var i;\n while (d.bitcount > 8) {\n d.sourceIndex--;\n d.bitcount -= 8;\n }\n length = d.source[d.sourceIndex + 1];\n length = 256 * length + d.source[d.sourceIndex];\n invlength = d.source[d.sourceIndex + 3];\n invlength = 256 * invlength + d.source[d.sourceIndex + 2];\n if (length !== (~invlength & 65535))\n return TINF_DATA_ERROR;\n d.sourceIndex += 4;\n for (i = length; i; --i)\n d.dest[d.destLen++] = d.source[d.sourceIndex++];\n d.bitcount = 0;\n return TINF_OK;\n }\n function tinf_uncompress(source, dest) {\n var d = new Data(source, dest);\n var bfinal, btype, res;\n do {\n bfinal = tinf_getbit(d);\n btype = tinf_read_bits(d, 2, 0);\n switch (btype) {\n case 0:\n res = tinf_inflate_uncompressed_block(d);\n break;\n case 1:\n res = tinf_inflate_block_data(d, sltree, sdtree);\n break;\n case 2:\n tinf_decode_trees(d, d.ltree, d.dtree);\n res = tinf_inflate_block_data(d, d.ltree, d.dtree);\n break;\n default:\n res = TINF_DATA_ERROR;\n }\n if (res !== TINF_OK)\n throw new Error(\"Data error\");\n } while (!bfinal);\n if (d.destLen < d.dest.length) {\n if (typeof d.dest.slice === \"function\")\n return d.dest.slice(0, d.destLen);\n else\n return d.dest.subarray(0, d.destLen);\n }\n return d.dest;\n }\n tinf_build_fixed_trees(sltree, sdtree);\n tinf_build_bits_base(length_bits, length_base, 4, 3);\n tinf_build_bits_base(dist_bits, dist_base, 2, 1);\n length_bits[28] = 0;\n length_base[28] = 258;\n\n // src/bbox.mjs\n function derive(v0, v1, v2, v3, t) {\n return Math.pow(1 - t, 3) * v0 + 3 * Math.pow(1 - t, 2) * t * v1 + 3 * (1 - t) * Math.pow(t, 2) * v2 + Math.pow(t, 3) * v3;\n }\n function BoundingBox() {\n this.x1 = Number.NaN;\n this.y1 = Number.NaN;\n this.x2 = Number.NaN;\n this.y2 = Number.NaN;\n }\n BoundingBox.prototype.isEmpty = function() {\n return isNaN(this.x1) || isNaN(this.y1) || isNaN(this.x2) || isNaN(this.y2);\n };\n BoundingBox.prototype.addPoint = function(x, y) {\n if (typeof x === \"number\") {\n if (isNaN(this.x1) || isNaN(this.x2)) {\n this.x1 = x;\n this.x2 = x;\n }\n if (x < this.x1) {\n this.x1 = x;\n }\n if (x > this.x2) {\n this.x2 = x;\n }\n }\n if (typeof y === \"number\") {\n if (isNaN(this.y1) || isNaN(this.y2)) {\n this.y1 = y;\n this.y2 = y;\n }\n if (y < this.y1) {\n this.y1 = y;\n }\n if (y > this.y2) {\n this.y2 = y;\n }\n }\n };\n BoundingBox.prototype.addX = function(x) {\n this.addPoint(x, null);\n };\n BoundingBox.prototype.addY = function(y) {\n this.addPoint(null, y);\n };\n BoundingBox.prototype.addBezier = function(x0, y0, x1, y1, x2, y2, x, y) {\n const p0 = [x0, y0];\n const p1 = [x1, y1];\n const p2 = [x2, y2];\n const p3 = [x, y];\n this.addPoint(x0, y0);\n this.addPoint(x, y);\n for (let i = 0; i <= 1; i++) {\n const b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i];\n const a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i];\n const c = 3 * p1[i] - 3 * p0[i];\n if (a === 0) {\n if (b === 0) continue;\n const t = -c / b;\n if (0 < t && t < 1) {\n if (i === 0) this.addX(derive(p0[i], p1[i], p2[i], p3[i], t));\n if (i === 1) this.addY(derive(p0[i], p1[i], p2[i], p3[i], t));\n }\n continue;\n }\n const b2ac = Math.pow(b, 2) - 4 * c * a;\n if (b2ac < 0) continue;\n const t1 = (-b + Math.sqrt(b2ac)) / (2 * a);\n if (0 < t1 && t1 < 1) {\n if (i === 0) this.addX(derive(p0[i], p1[i], p2[i], p3[i], t1));\n if (i === 1) this.addY(derive(p0[i], p1[i], p2[i], p3[i], t1));\n }\n const t2 = (-b - Math.sqrt(b2ac)) / (2 * a);\n if (0 < t2 && t2 < 1) {\n if (i === 0) this.addX(derive(p0[i], p1[i], p2[i], p3[i], t2));\n if (i === 1) this.addY(derive(p0[i], p1[i], p2[i], p3[i], t2));\n }\n }\n };\n BoundingBox.prototype.addQuad = function(x0, y0, x1, y1, x, y) {\n const cp1x = x0 + 2 / 3 * (x1 - x0);\n const cp1y = y0 + 2 / 3 * (y1 - y0);\n const cp2x = cp1x + 1 / 3 * (x - x0);\n const cp2y = cp1y + 1 / 3 * (y - y0);\n this.addBezier(x0, y0, cp1x, cp1y, cp2x, cp2y, x, y);\n };\n var bbox_default = BoundingBox;\n\n // src/path.mjs\n function Path() {\n this.commands = [];\n this.fill = \"black\";\n this.stroke = null;\n this.strokeWidth = 1;\n }\n var decimalRoundingCache = {};\n function roundDecimal(float, places) {\n const integerPart = Math.floor(float);\n const decimalPart = float - integerPart;\n if (!decimalRoundingCache[places]) {\n decimalRoundingCache[places] = {};\n }\n if (decimalRoundingCache[places][decimalPart] !== void 0) {\n const roundedDecimalPart2 = decimalRoundingCache[places][decimalPart];\n return integerPart + roundedDecimalPart2;\n }\n const roundedDecimalPart = +(Math.round(decimalPart + \"e+\" + places) + \"e-\" + places);\n decimalRoundingCache[places][decimalPart] = roundedDecimalPart;\n return integerPart + roundedDecimalPart;\n }\n function optimizeCommands(commands) {\n let subpaths = [[]];\n let startX = 0, startY = 0;\n for (let i = 0; i < commands.length; i += 1) {\n const subpath = subpaths[subpaths.length - 1];\n const cmd = commands[i];\n const firstCommand = subpath[0];\n const secondCommand = subpath[1];\n const previousCommand = subpath[subpath.length - 1];\n const nextCommand = commands[i + 1];\n subpath.push(cmd);\n if (cmd.type === \"M\") {\n startX = cmd.x;\n startY = cmd.y;\n } else if (cmd.type === \"L\" && (!nextCommand || nextCommand.type === \"Z\")) {\n if (!(Math.abs(cmd.x - startX) > 1 || Math.abs(cmd.y - startY) > 1)) {\n subpath.pop();\n }\n } else if (cmd.type === \"L\" && previousCommand && previousCommand.x === cmd.x && previousCommand.y === cmd.y) {\n subpath.pop();\n } else if (cmd.type === \"Z\") {\n if (firstCommand && secondCommand && previousCommand && firstCommand.type === \"M\" && secondCommand.type === \"L\" && previousCommand.type === \"L\" && previousCommand.x === firstCommand.x && previousCommand.y === firstCommand.y) {\n subpath.shift();\n subpath[0].type = \"M\";\n }\n if (i + 1 < commands.length) {\n subpaths.push([]);\n }\n }\n }\n commands = [].concat.apply([], subpaths);\n return commands;\n }\n function createSVGParsingOptions(options) {\n const defaultOptions = {\n decimalPlaces: 2,\n optimize: true,\n flipY: true,\n flipYBase: void 0,\n scale: 1,\n x: 0,\n y: 0\n };\n const newOptions = Object.assign({}, defaultOptions, options);\n return newOptions;\n }\n function createSVGOutputOptions(options) {\n if (parseInt(options) === options) {\n options = { decimalPlaces: options, flipY: false };\n }\n const defaultOptions = {\n decimalPlaces: 2,\n optimize: true,\n flipY: true,\n flipYBase: void 0\n };\n const newOptions = Object.assign({}, defaultOptions, options);\n return newOptions;\n }\n Path.prototype.fromSVG = function(pathData, options = {}) {\n if (typeof SVGPathElement !== \"undefined\" && pathData instanceof SVGPathElement) {\n pathData = pathData.getAttribute(\"d\");\n }\n options = createSVGParsingOptions(options);\n this.commands = [];\n const number = \"0123456789\";\n const supportedCommands = \"MmLlQqCcZzHhVv\";\n const unsupportedCommands = \"SsTtAa\";\n const sign = \"-+\";\n let command = {};\n let buffer = [\"\"];\n let isUnexpected = false;\n function parseBuffer2(buffer2) {\n return buffer2.filter((b) => b.length).map((b) => {\n let float = parseFloat(b);\n if (options.decimalPlaces || options.decimalPlaces === 0) {\n float = roundDecimal(float, options.decimalPlaces);\n }\n return float;\n });\n }\n function makeRelative(buffer2) {\n if (!this.commands.length) {\n return buffer2;\n }\n const lastCommand = this.commands[this.commands.length - 1];\n for (let i = 0; i < buffer2.length; i++) {\n buffer2[i] += lastCommand[i & 1 ? \"y\" : \"x\"];\n }\n return buffer2;\n }\n function applyCommand() {\n if (command.type === void 0) {\n return;\n }\n const commandType = command.type.toUpperCase();\n const relative = commandType !== \"Z\" && command.type.toUpperCase() !== command.type;\n let parsedBuffer = parseBuffer2(buffer);\n buffer = [\"\"];\n if (!parsedBuffer.length && commandType !== \"Z\") {\n return;\n }\n if (relative && commandType !== \"H\" && commandType !== \"V\") {\n parsedBuffer = makeRelative.apply(this, [parsedBuffer]);\n }\n const currentX = this.commands.length ? this.commands[this.commands.length - 1].x || 0 : 0;\n const currentY = this.commands.length ? this.commands[this.commands.length - 1].y || 0 : 0;\n switch (commandType) {\n case \"M\":\n this.moveTo(...parsedBuffer);\n break;\n case \"L\":\n this.lineTo(...parsedBuffer);\n break;\n case \"V\":\n for (let i = 0; i < parsedBuffer.length; i++) {\n let offset = 0;\n if (relative) {\n offset = this.commands.length ? this.commands[this.commands.length - 1].y || 0 : 0;\n }\n this.lineTo(currentX, parsedBuffer[i] + offset);\n }\n break;\n case \"H\":\n for (let i = 0; i < parsedBuffer.length; i++) {\n let offset = 0;\n if (relative) {\n offset = this.commands.length ? this.commands[this.commands.length - 1].x || 0 : 0;\n }\n this.lineTo(parsedBuffer[i] + offset, currentY);\n }\n break;\n case \"C\":\n this.bezierCurveTo(...parsedBuffer);\n break;\n case \"Q\":\n this.quadraticCurveTo(...parsedBuffer);\n break;\n case \"Z\":\n if (this.commands.length < 1 || this.commands[this.commands.length - 1].type !== \"Z\") {\n this.close();\n }\n break;\n }\n if (this.commands.length) {\n for (const prop in this.commands[this.commands.length - 1]) {\n if (this.commands[this.commands.length - 1][prop] === void 0) {\n this.commands[this.commands.length - 1][prop] = 0;\n }\n }\n }\n }\n for (let i = 0; i < pathData.length; i++) {\n const token = pathData.charAt(i);\n const lastBuffer = buffer[buffer.length - 1];\n if (number.indexOf(token) > -1) {\n buffer[buffer.length - 1] += token;\n } else if (sign.indexOf(token) > -1) {\n if (!command.type && !this.commands.length) {\n command.type = \"L\";\n }\n if (token === \"-\") {\n if (!command.type || lastBuffer.indexOf(\"-\") > 0) {\n isUnexpected = true;\n } else if (lastBuffer.length) {\n buffer.push(\"-\");\n } else {\n buffer[buffer.length - 1] = token;\n }\n } else {\n if (!command.type || lastBuffer.length > 0) {\n isUnexpected = true;\n } else {\n continue;\n }\n }\n } else if (supportedCommands.indexOf(token) > -1) {\n if (command.type) {\n applyCommand.apply(this);\n command = { type: token };\n } else {\n command.type = token;\n }\n } else if (unsupportedCommands.indexOf(token) > -1) {\n throw new Error(\"Unsupported path command: \" + token + \". Currently supported commands are \" + supportedCommands.split(\"\").join(\", \") + \".\");\n } else if (\" ,\t\\n\\r\\f\\v\".indexOf(token) > -1) {\n buffer.push(\"\");\n } else if (token === \".\") {\n if (!command.type || lastBuffer.indexOf(token) > -1) {\n isUnexpected = true;\n } else {\n buffer[buffer.length - 1] += token;\n }\n } else {\n isUnexpected = true;\n }\n if (isUnexpected) {\n throw new Error(\"Unexpected character: \" + token + \" at offset \" + i);\n }\n }\n applyCommand.apply(this);\n if (options.optimize) {\n this.commands = optimizeCommands(this.commands);\n }\n const flipY = options.flipY;\n let flipYBase = options.flipYBase;\n if (flipY === true && options.flipYBase === void 0) {\n const boundingBox = this.getBoundingBox();\n flipYBase = boundingBox.y1 + boundingBox.y2;\n }\n for (const i in this.commands) {\n const cmd = this.commands[i];\n for (const prop in cmd) {\n if ([\"x\", \"x1\", \"x2\"].includes(prop)) {\n this.commands[i][prop] = options.x + cmd[prop] * options.scale;\n } else if ([\"y\", \"y1\", \"y2\"].includes(prop)) {\n this.commands[i][prop] = options.y + (flipY ? flipYBase - cmd[prop] : cmd[prop]) * options.scale;\n }\n }\n }\n return this;\n };\n Path.fromSVG = function(path, options) {\n const newPath = new Path();\n return newPath.fromSVG(path, options);\n };\n Path.prototype.moveTo = function(x, y) {\n this.commands.push({\n type: \"M\",\n x,\n y\n });\n };\n Path.prototype.lineTo = function(x, y) {\n this.commands.push({\n type: \"L\",\n x,\n y\n });\n };\n Path.prototype.curveTo = Path.prototype.bezierCurveTo = function(x1, y1, x2, y2, x, y) {\n this.commands.push({\n type: \"C\",\n x1,\n y1,\n x2,\n y2,\n x,\n y\n });\n };\n Path.prototype.quadTo = Path.prototype.quadraticCurveTo = function(x1, y1, x, y) {\n this.commands.push({\n type: \"Q\",\n x1,\n y1,\n x,\n y\n });\n };\n Path.prototype.close = Path.prototype.closePath = function() {\n this.commands.push({\n type: \"Z\"\n });\n };\n Path.prototype.extend = function(pathOrCommands) {\n if (pathOrCommands.commands) {\n pathOrCommands = pathOrCommands.commands;\n } else if (pathOrCommands instanceof bbox_default) {\n const box = pathOrCommands;\n this.moveTo(box.x1, box.y1);\n this.lineTo(box.x2, box.y1);\n this.lineTo(box.x2, box.y2);\n this.lineTo(box.x1, box.y2);\n this.close();\n return;\n }\n Array.prototype.push.apply(this.commands, pathOrCommands);\n };\n Path.prototype.getBoundingBox = function() {\n const box = new bbox_default();\n let startX = 0;\n let startY = 0;\n let prevX = 0;\n let prevY = 0;\n for (let i = 0; i < this.commands.length; i++) {\n const cmd = this.commands[i];\n switch (cmd.type) {\n case \"M\":\n box.addPoint(cmd.x, cmd.y);\n startX = prevX = cmd.x;\n startY = prevY = cmd.y;\n break;\n case \"L\":\n box.addPoint(cmd.x, cmd.y);\n prevX = cmd.x;\n prevY = cmd.y;\n break;\n case \"Q\":\n box.addQuad(prevX, prevY, cmd.x1, cmd.y1, cmd.x, cmd.y);\n prevX = cmd.x;\n prevY = cmd.y;\n break;\n case \"C\":\n box.addBezier(prevX, prevY, cmd.x1, cmd.y1, cmd.x2, cmd.y2, cmd.x, cmd.y);\n prevX = cmd.x;\n prevY = cmd.y;\n break;\n case \"Z\":\n prevX = startX;\n prevY = startY;\n break;\n default:\n throw new Error(\"Unexpected path command \" + cmd.type);\n }\n }\n if (box.isEmpty()) {\n box.addPoint(0, 0);\n }\n return box;\n };\n Path.prototype.draw = function(ctx) {\n const layers = this._layers;\n if (layers && layers.length) {\n for (let l = 0; l < layers.length; l++) {\n this.draw.call(layers[l], ctx);\n }\n return;\n }\n const image = this._image;\n if (image) {\n ctx.drawImage(image.image, image.x, image.y, image.width, image.height);\n return;\n }\n ctx.beginPath();\n for (let i = 0; i < this.commands.length; i += 1) {\n const cmd = this.commands[i];\n if (cmd.type === \"M\") {\n ctx.moveTo(cmd.x, cmd.y);\n } else if (cmd.type === \"L\") {\n ctx.lineTo(cmd.x, cmd.y);\n } else if (cmd.type === \"C\") {\n ctx.bezierCurveTo(cmd.x1, cmd.y1, cmd.x2, cmd.y2, cmd.x, cmd.y);\n } else if (cmd.type === \"Q\") {\n ctx.quadraticCurveTo(cmd.x1, cmd.y1, cmd.x, cmd.y);\n } else if (cmd.type === \"Z\" && this.stroke && this.strokeWidth) {\n ctx.closePath();\n }\n }\n if (this.fill) {\n ctx.fillStyle = this.fill;\n ctx.fill();\n }\n if (this.stroke) {\n ctx.strokeStyle = this.stroke;\n ctx.lineWidth = this.strokeWidth;\n ctx.stroke();\n }\n };\n Path.prototype.toPathData = function(options) {\n options = createSVGOutputOptions(options);\n function floatToString(v) {\n const rounded = roundDecimal(v, options.decimalPlaces);\n if (Math.round(v) === rounded) {\n return \"\" + rounded;\n } else {\n return rounded.toFixed(options.decimalPlaces);\n }\n }\n function packValues() {\n let s = \"\";\n for (let i = 0; i < arguments.length; i += 1) {\n const v = arguments[i];\n if (v >= 0 && i > 0) {\n s += \" \";\n }\n s += floatToString(v);\n }\n return s;\n }\n let commandsCopy = this.commands;\n if (options.optimize) {\n commandsCopy = JSON.parse(JSON.stringify(this.commands));\n commandsCopy = optimizeCommands(commandsCopy);\n }\n const flipY = options.flipY;\n let flipYBase = options.flipYBase;\n if (flipY === true && flipYBase === void 0) {\n const tempPath = new Path();\n tempPath.extend(commandsCopy);\n const boundingBox = tempPath.getBoundingBox();\n flipYBase = boundingBox.y1 + boundingBox.y2;\n }\n let d = \"\";\n for (let i = 0; i < commandsCopy.length; i += 1) {\n const cmd = commandsCopy[i];\n if (cmd.type === \"M\") {\n d += \"M\" + packValues(\n cmd.x,\n flipY ? flipYBase - cmd.y : cmd.y\n );\n } else if (cmd.type === \"L\") {\n d += \"L\" + packValues(\n cmd.x,\n flipY ? flipYBase - cmd.y : cmd.y\n );\n } else if (cmd.type === \"C\") {\n d += \"C\" + packValues(\n cmd.x1,\n flipY ? flipYBase - cmd.y1 : cmd.y1,\n cmd.x2,\n flipY ? flipYBase - cmd.y2 : cmd.y2,\n cmd.x,\n flipY ? flipYBase - cmd.y : cmd.y\n );\n } else if (cmd.type === \"Q\") {\n d += \"Q\" + packValues(\n cmd.x1,\n flipY ? flipYBase - cmd.y1 : cmd.y1,\n cmd.x,\n flipY ? flipYBase - cmd.y : cmd.y\n );\n } else if (cmd.type === \"Z\") {\n d += \"Z\";\n }\n }\n return d;\n };\n Path.prototype.toSVG = function(options, pathData) {\n if (this._layers && this._layers.length) {\n console.warn(\"toSVG() does not support colr font layers yet\");\n }\n if (this._image) {\n console.warn(\"toSVG() does not support SVG glyphs yet\");\n }\n if (!pathData) {\n pathData = this.toPathData(options);\n }\n let svg = '\";\n return svg;\n };\n Path.prototype.toDOMElement = function(options, pathData) {\n if (this._layers && this._layers.length) {\n console.warn(\"toDOMElement() does not support colr font layers yet\");\n }\n if (!pathData) {\n pathData = this.toPathData(options);\n }\n const newPath = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n newPath.setAttribute(\"d\", pathData);\n if (this.fill !== void 0 && this.fill !== \"black\") {\n if (this.fill === null) {\n newPath.setAttribute(\"fill\", \"none\");\n } else {\n newPath.setAttribute(\"fill\", this.fill);\n }\n }\n if (this.stroke) {\n newPath.setAttribute(\"stroke\", this.stroke);\n newPath.setAttribute(\"stroke-width\", this.strokeWidth);\n }\n return newPath;\n };\n var path_default = Path;\n\n // src/check.mjs\n function fail(message) {\n throw new Error(message);\n }\n function argument(predicate, message) {\n if (!predicate) {\n fail(message);\n }\n }\n var check_default = { fail, argument, assert: argument };\n\n // src/types.mjs\n var LIMIT16 = 32768;\n var LIMIT32 = 2147483648;\n var MIN_16_16 = -(1 << 15);\n var MAX_16_16 = (1 << 15) - 1 + 1 / (1 << 16);\n var decode = {};\n var encode = {};\n var sizeOf = {};\n function constant(v) {\n return function() {\n return v;\n };\n }\n encode.BYTE = function(v) {\n check_default.argument(v >= 0 && v <= 255, \"Byte value should be between 0 and 255.\");\n return [v];\n };\n sizeOf.BYTE = constant(1);\n encode.CHAR = function(v) {\n return [v.charCodeAt(0)];\n };\n sizeOf.CHAR = constant(1);\n encode.CHARARRAY = function(v) {\n if (v === null || typeof v === \"undefined\") {\n v = \"\";\n console.warn(\"CHARARRAY with undefined or null value encountered and treated as an empty string. This is probably caused by a missing glyph name.\");\n }\n const b = [];\n for (let i = 0; i < v.length; i += 1) {\n b[i] = v.charCodeAt(i);\n }\n return b;\n };\n sizeOf.CHARARRAY = function(v) {\n if (typeof v === \"undefined\") {\n return 0;\n }\n return v.length;\n };\n encode.USHORT = function(v) {\n return [v >> 8 & 255, v & 255];\n };\n sizeOf.USHORT = constant(2);\n encode.SHORT = function(v) {\n if (v >= LIMIT16) {\n v = -(2 * LIMIT16 - v);\n }\n return [v >> 8 & 255, v & 255];\n };\n sizeOf.SHORT = constant(2);\n encode.UINT24 = function(v) {\n return [v >> 16 & 255, v >> 8 & 255, v & 255];\n };\n sizeOf.UINT24 = constant(3);\n encode.ULONG = function(v) {\n return [v >> 24 & 255, v >> 16 & 255, v >> 8 & 255, v & 255];\n };\n sizeOf.ULONG = constant(4);\n encode.LONG = function(v) {\n if (v >= LIMIT32) {\n v = -(2 * LIMIT32 - v);\n }\n return [v >> 24 & 255, v >> 16 & 255, v >> 8 & 255, v & 255];\n };\n sizeOf.LONG = constant(4);\n encode.FLOAT = function(v) {\n if (v > MAX_16_16 || v < MIN_16_16) {\n throw new Error(`Value ${v} is outside the range of representable values in 16.16 format`);\n }\n const fixedValue = Math.round(v * (1 << 16)) << 0;\n return encode.ULONG(fixedValue);\n };\n sizeOf.FLOAT = sizeOf.ULONG;\n encode.FIXED = encode.ULONG;\n sizeOf.FIXED = sizeOf.ULONG;\n encode.FWORD = encode.SHORT;\n sizeOf.FWORD = sizeOf.SHORT;\n encode.UFWORD = encode.USHORT;\n sizeOf.UFWORD = sizeOf.USHORT;\n encode.F2DOT14 = function(v) {\n return encode.USHORT(v * 16384);\n };\n sizeOf.F2DOT14 = sizeOf.USHORT;\n encode.LONGDATETIME = function(v) {\n return [0, 0, 0, 0, v >> 24 & 255, v >> 16 & 255, v >> 8 & 255, v & 255];\n };\n sizeOf.LONGDATETIME = constant(8);\n encode.TAG = function(v) {\n check_default.argument(v.length === 4, \"Tag should be exactly 4 ASCII characters.\");\n return [\n v.charCodeAt(0),\n v.charCodeAt(1),\n v.charCodeAt(2),\n v.charCodeAt(3)\n ];\n };\n sizeOf.TAG = constant(4);\n encode.Card8 = encode.BYTE;\n sizeOf.Card8 = sizeOf.BYTE;\n encode.Card16 = encode.USHORT;\n sizeOf.Card16 = sizeOf.USHORT;\n encode.OffSize = encode.BYTE;\n sizeOf.OffSize = sizeOf.BYTE;\n encode.SID = encode.USHORT;\n sizeOf.SID = sizeOf.USHORT;\n encode.NUMBER = function(v) {\n if (v >= -107 && v <= 107) {\n return [v + 139];\n } else if (v >= 108 && v <= 1131) {\n v = v - 108;\n return [(v >> 8) + 247, v & 255];\n } else if (v >= -1131 && v <= -108) {\n v = -v - 108;\n return [(v >> 8) + 251, v & 255];\n } else if (v >= -32768 && v <= 32767) {\n return encode.NUMBER16(v);\n } else {\n return encode.NUMBER32(v);\n }\n };\n sizeOf.NUMBER = function(v) {\n return encode.NUMBER(v).length;\n };\n encode.NUMBER16 = function(v) {\n return [28, v >> 8 & 255, v & 255];\n };\n sizeOf.NUMBER16 = constant(3);\n encode.NUMBER32 = function(v) {\n return [29, v >> 24 & 255, v >> 16 & 255, v >> 8 & 255, v & 255];\n };\n sizeOf.NUMBER32 = constant(5);\n encode.REAL = function(v) {\n let value = v.toString();\n const m = /\\.(\\d*?)(?:9{5,20}|0{5,20})\\d{0,2}(?:e(.+)|$)/.exec(value);\n if (m) {\n const epsilon = parseFloat(\"1e\" + ((m[2] ? +m[2] : 0) + m[1].length));\n value = (Math.round(v * epsilon) / epsilon).toString();\n }\n let nibbles = \"\";\n for (let i = 0, ii = value.length; i < ii; i += 1) {\n const c = value[i];\n if (c === \"e\") {\n nibbles += value[++i] === \"-\" ? \"c\" : \"b\";\n } else if (c === \".\") {\n nibbles += \"a\";\n } else if (c === \"-\") {\n nibbles += \"e\";\n } else {\n nibbles += c;\n }\n }\n nibbles += nibbles.length & 1 ? \"f\" : \"ff\";\n const out = [30];\n for (let i = 0, ii = nibbles.length; i < ii; i += 2) {\n out.push(parseInt(nibbles.substr(i, 2), 16));\n }\n return out;\n };\n sizeOf.REAL = function(v) {\n return encode.REAL(v).length;\n };\n encode.NAME = encode.CHARARRAY;\n sizeOf.NAME = sizeOf.CHARARRAY;\n encode.STRING = encode.CHARARRAY;\n sizeOf.STRING = sizeOf.CHARARRAY;\n decode.UTF8 = function(data, offset, numBytes) {\n const codePoints = [];\n const numChars = numBytes;\n for (let j = 0; j < numChars; j++, offset += 1) {\n codePoints[j] = data.getUint8(offset);\n }\n return String.fromCharCode.apply(null, codePoints);\n };\n decode.UTF16 = function(data, offset, numBytes) {\n const codePoints = [];\n const numChars = numBytes / 2;\n for (let j = 0; j < numChars; j++, offset += 2) {\n codePoints[j] = data.getUint16(offset);\n }\n return String.fromCharCode.apply(null, codePoints);\n };\n encode.UTF16 = function(v) {\n const b = [];\n for (let i = 0; i < v.length; i += 1) {\n const codepoint = v.charCodeAt(i);\n b[b.length] = codepoint >> 8 & 255;\n b[b.length] = codepoint & 255;\n }\n return b;\n };\n sizeOf.UTF16 = function(v) {\n return v.length * 2;\n };\n var eightBitMacEncodings = {\n \"x-mac-croatian\": (\n // Python: 'mac_croatian'\n \"\\xC4\\xC5\\xC7\\xC9\\xD1\\xD6\\xDC\\xE1\\xE0\\xE2\\xE4\\xE3\\xE5\\xE7\\xE9\\xE8\\xEA\\xEB\\xED\\xEC\\xEE\\xEF\\xF1\\xF3\\xF2\\xF4\\xF6\\xF5\\xFA\\xF9\\xFB\\xFC\\u2020\\xB0\\xA2\\xA3\\xA7\\u2022\\xB6\\xDF\\xAE\\u0160\\u2122\\xB4\\xA8\\u2260\\u017D\\xD8\\u221E\\xB1\\u2264\\u2265\\u2206\\xB5\\u2202\\u2211\\u220F\\u0161\\u222B\\xAA\\xBA\\u03A9\\u017E\\xF8\\xBF\\xA1\\xAC\\u221A\\u0192\\u2248\\u0106\\xAB\\u010C\\u2026\\xA0\\xC0\\xC3\\xD5\\u0152\\u0153\\u0110\\u2014\\u201C\\u201D\\u2018\\u2019\\xF7\\u25CA\\uF8FF\\xA9\\u2044\\u20AC\\u2039\\u203A\\xC6\\xBB\\u2013\\xB7\\u201A\\u201E\\u2030\\xC2\\u0107\\xC1\\u010D\\xC8\\xCD\\xCE\\xCF\\xCC\\xD3\\xD4\\u0111\\xD2\\xDA\\xDB\\xD9\\u0131\\u02C6\\u02DC\\xAF\\u03C0\\xCB\\u02DA\\xB8\\xCA\\xE6\\u02C7\"\n ),\n \"x-mac-cyrillic\": (\n // Python: 'mac_cyrillic'\n \"\\u0410\\u0411\\u0412\\u0413\\u0414\\u0415\\u0416\\u0417\\u0418\\u0419\\u041A\\u041B\\u041C\\u041D\\u041E\\u041F\\u0420\\u0421\\u0422\\u0423\\u0424\\u0425\\u0426\\u0427\\u0428\\u0429\\u042A\\u042B\\u042C\\u042D\\u042E\\u042F\\u2020\\xB0\\u0490\\xA3\\xA7\\u2022\\xB6\\u0406\\xAE\\xA9\\u2122\\u0402\\u0452\\u2260\\u0403\\u0453\\u221E\\xB1\\u2264\\u2265\\u0456\\xB5\\u0491\\u0408\\u0404\\u0454\\u0407\\u0457\\u0409\\u0459\\u040A\\u045A\\u0458\\u0405\\xAC\\u221A\\u0192\\u2248\\u2206\\xAB\\xBB\\u2026\\xA0\\u040B\\u045B\\u040C\\u045C\\u0455\\u2013\\u2014\\u201C\\u201D\\u2018\\u2019\\xF7\\u201E\\u040E\\u045E\\u040F\\u045F\\u2116\\u0401\\u0451\\u044F\\u0430\\u0431\\u0432\\u0433\\u0434\\u0435\\u0436\\u0437\\u0438\\u0439\\u043A\\u043B\\u043C\\u043D\\u043E\\u043F\\u0440\\u0441\\u0442\\u0443\\u0444\\u0445\\u0446\\u0447\\u0448\\u0449\\u044A\\u044B\\u044C\\u044D\\u044E\"\n ),\n \"x-mac-gaelic\": (\n // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/GAELIC.TXT\n \"\\xC4\\xC5\\xC7\\xC9\\xD1\\xD6\\xDC\\xE1\\xE0\\xE2\\xE4\\xE3\\xE5\\xE7\\xE9\\xE8\\xEA\\xEB\\xED\\xEC\\xEE\\xEF\\xF1\\xF3\\xF2\\xF4\\xF6\\xF5\\xFA\\xF9\\xFB\\xFC\\u2020\\xB0\\xA2\\xA3\\xA7\\u2022\\xB6\\xDF\\xAE\\xA9\\u2122\\xB4\\xA8\\u2260\\xC6\\xD8\\u1E02\\xB1\\u2264\\u2265\\u1E03\\u010A\\u010B\\u1E0A\\u1E0B\\u1E1E\\u1E1F\\u0120\\u0121\\u1E40\\xE6\\xF8\\u1E41\\u1E56\\u1E57\\u027C\\u0192\\u017F\\u1E60\\xAB\\xBB\\u2026\\xA0\\xC0\\xC3\\xD5\\u0152\\u0153\\u2013\\u2014\\u201C\\u201D\\u2018\\u2019\\u1E61\\u1E9B\\xFF\\u0178\\u1E6A\\u20AC\\u2039\\u203A\\u0176\\u0177\\u1E6B\\xB7\\u1EF2\\u1EF3\\u204A\\xC2\\xCA\\xC1\\xCB\\xC8\\xCD\\xCE\\xCF\\xCC\\xD3\\xD4\\u2663\\xD2\\xDA\\xDB\\xD9\\u0131\\xDD\\xFD\\u0174\\u0175\\u1E84\\u1E85\\u1E80\\u1E81\\u1E82\\u1E83\"\n ),\n \"x-mac-greek\": (\n // Python: 'mac_greek'\n \"\\xC4\\xB9\\xB2\\xC9\\xB3\\xD6\\xDC\\u0385\\xE0\\xE2\\xE4\\u0384\\xA8\\xE7\\xE9\\xE8\\xEA\\xEB\\xA3\\u2122\\xEE\\xEF\\u2022\\xBD\\u2030\\xF4\\xF6\\xA6\\u20AC\\xF9\\xFB\\xFC\\u2020\\u0393\\u0394\\u0398\\u039B\\u039E\\u03A0\\xDF\\xAE\\xA9\\u03A3\\u03AA\\xA7\\u2260\\xB0\\xB7\\u0391\\xB1\\u2264\\u2265\\xA5\\u0392\\u0395\\u0396\\u0397\\u0399\\u039A\\u039C\\u03A6\\u03AB\\u03A8\\u03A9\\u03AC\\u039D\\xAC\\u039F\\u03A1\\u2248\\u03A4\\xAB\\xBB\\u2026\\xA0\\u03A5\\u03A7\\u0386\\u0388\\u0153\\u2013\\u2015\\u201C\\u201D\\u2018\\u2019\\xF7\\u0389\\u038A\\u038C\\u038E\\u03AD\\u03AE\\u03AF\\u03CC\\u038F\\u03CD\\u03B1\\u03B2\\u03C8\\u03B4\\u03B5\\u03C6\\u03B3\\u03B7\\u03B9\\u03BE\\u03BA\\u03BB\\u03BC\\u03BD\\u03BF\\u03C0\\u03CE\\u03C1\\u03C3\\u03C4\\u03B8\\u03C9\\u03C2\\u03C7\\u03C5\\u03B6\\u03CA\\u03CB\\u0390\\u03B0\\xAD\"\n ),\n \"x-mac-icelandic\": (\n // Python: 'mac_iceland'\n \"\\xC4\\xC5\\xC7\\xC9\\xD1\\xD6\\xDC\\xE1\\xE0\\xE2\\xE4\\xE3\\xE5\\xE7\\xE9\\xE8\\xEA\\xEB\\xED\\xEC\\xEE\\xEF\\xF1\\xF3\\xF2\\xF4\\xF6\\xF5\\xFA\\xF9\\xFB\\xFC\\xDD\\xB0\\xA2\\xA3\\xA7\\u2022\\xB6\\xDF\\xAE\\xA9\\u2122\\xB4\\xA8\\u2260\\xC6\\xD8\\u221E\\xB1\\u2264\\u2265\\xA5\\xB5\\u2202\\u2211\\u220F\\u03C0\\u222B\\xAA\\xBA\\u03A9\\xE6\\xF8\\xBF\\xA1\\xAC\\u221A\\u0192\\u2248\\u2206\\xAB\\xBB\\u2026\\xA0\\xC0\\xC3\\xD5\\u0152\\u0153\\u2013\\u2014\\u201C\\u201D\\u2018\\u2019\\xF7\\u25CA\\xFF\\u0178\\u2044\\u20AC\\xD0\\xF0\\xDE\\xFE\\xFD\\xB7\\u201A\\u201E\\u2030\\xC2\\xCA\\xC1\\xCB\\xC8\\xCD\\xCE\\xCF\\xCC\\xD3\\xD4\\uF8FF\\xD2\\xDA\\xDB\\xD9\\u0131\\u02C6\\u02DC\\xAF\\u02D8\\u02D9\\u02DA\\xB8\\u02DD\\u02DB\\u02C7\"\n ),\n \"x-mac-inuit\": (\n // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/INUIT.TXT\n \"\\u1403\\u1404\\u1405\\u1406\\u140A\\u140B\\u1431\\u1432\\u1433\\u1434\\u1438\\u1439\\u1449\\u144E\\u144F\\u1450\\u1451\\u1455\\u1456\\u1466\\u146D\\u146E\\u146F\\u1470\\u1472\\u1473\\u1483\\u148B\\u148C\\u148D\\u148E\\u1490\\u1491\\xB0\\u14A1\\u14A5\\u14A6\\u2022\\xB6\\u14A7\\xAE\\xA9\\u2122\\u14A8\\u14AA\\u14AB\\u14BB\\u14C2\\u14C3\\u14C4\\u14C5\\u14C7\\u14C8\\u14D0\\u14EF\\u14F0\\u14F1\\u14F2\\u14F4\\u14F5\\u1505\\u14D5\\u14D6\\u14D7\\u14D8\\u14DA\\u14DB\\u14EA\\u1528\\u1529\\u152A\\u152B\\u152D\\u2026\\xA0\\u152E\\u153E\\u1555\\u1556\\u1557\\u2013\\u2014\\u201C\\u201D\\u2018\\u2019\\u1558\\u1559\\u155A\\u155D\\u1546\\u1547\\u1548\\u1549\\u154B\\u154C\\u1550\\u157F\\u1580\\u1581\\u1582\\u1583\\u1584\\u1585\\u158F\\u1590\\u1591\\u1592\\u1593\\u1594\\u1595\\u1671\\u1672\\u1673\\u1674\\u1675\\u1676\\u1596\\u15A0\\u15A1\\u15A2\\u15A3\\u15A4\\u15A5\\u15A6\\u157C\\u0141\\u0142\"\n ),\n \"x-mac-ce\": (\n // Python: 'mac_latin2'\n \"\\xC4\\u0100\\u0101\\xC9\\u0104\\xD6\\xDC\\xE1\\u0105\\u010C\\xE4\\u010D\\u0106\\u0107\\xE9\\u0179\\u017A\\u010E\\xED\\u010F\\u0112\\u0113\\u0116\\xF3\\u0117\\xF4\\xF6\\xF5\\xFA\\u011A\\u011B\\xFC\\u2020\\xB0\\u0118\\xA3\\xA7\\u2022\\xB6\\xDF\\xAE\\xA9\\u2122\\u0119\\xA8\\u2260\\u0123\\u012E\\u012F\\u012A\\u2264\\u2265\\u012B\\u0136\\u2202\\u2211\\u0142\\u013B\\u013C\\u013D\\u013E\\u0139\\u013A\\u0145\\u0146\\u0143\\xAC\\u221A\\u0144\\u0147\\u2206\\xAB\\xBB\\u2026\\xA0\\u0148\\u0150\\xD5\\u0151\\u014C\\u2013\\u2014\\u201C\\u201D\\u2018\\u2019\\xF7\\u25CA\\u014D\\u0154\\u0155\\u0158\\u2039\\u203A\\u0159\\u0156\\u0157\\u0160\\u201A\\u201E\\u0161\\u015A\\u015B\\xC1\\u0164\\u0165\\xCD\\u017D\\u017E\\u016A\\xD3\\xD4\\u016B\\u016E\\xDA\\u016F\\u0170\\u0171\\u0172\\u0173\\xDD\\xFD\\u0137\\u017B\\u0141\\u017C\\u0122\\u02C7\"\n ),\n macintosh: (\n // Python: 'mac_roman'\n \"\\xC4\\xC5\\xC7\\xC9\\xD1\\xD6\\xDC\\xE1\\xE0\\xE2\\xE4\\xE3\\xE5\\xE7\\xE9\\xE8\\xEA\\xEB\\xED\\xEC\\xEE\\xEF\\xF1\\xF3\\xF2\\xF4\\xF6\\xF5\\xFA\\xF9\\xFB\\xFC\\u2020\\xB0\\xA2\\xA3\\xA7\\u2022\\xB6\\xDF\\xAE\\xA9\\u2122\\xB4\\xA8\\u2260\\xC6\\xD8\\u221E\\xB1\\u2264\\u2265\\xA5\\xB5\\u2202\\u2211\\u220F\\u03C0\\u222B\\xAA\\xBA\\u03A9\\xE6\\xF8\\xBF\\xA1\\xAC\\u221A\\u0192\\u2248\\u2206\\xAB\\xBB\\u2026\\xA0\\xC0\\xC3\\xD5\\u0152\\u0153\\u2013\\u2014\\u201C\\u201D\\u2018\\u2019\\xF7\\u25CA\\xFF\\u0178\\u2044\\u20AC\\u2039\\u203A\\uFB01\\uFB02\\u2021\\xB7\\u201A\\u201E\\u2030\\xC2\\xCA\\xC1\\xCB\\xC8\\xCD\\xCE\\xCF\\xCC\\xD3\\xD4\\uF8FF\\xD2\\xDA\\xDB\\xD9\\u0131\\u02C6\\u02DC\\xAF\\u02D8\\u02D9\\u02DA\\xB8\\u02DD\\u02DB\\u02C7\"\n ),\n \"x-mac-romanian\": (\n // Python: 'mac_romanian'\n \"\\xC4\\xC5\\xC7\\xC9\\xD1\\xD6\\xDC\\xE1\\xE0\\xE2\\xE4\\xE3\\xE5\\xE7\\xE9\\xE8\\xEA\\xEB\\xED\\xEC\\xEE\\xEF\\xF1\\xF3\\xF2\\xF4\\xF6\\xF5\\xFA\\xF9\\xFB\\xFC\\u2020\\xB0\\xA2\\xA3\\xA7\\u2022\\xB6\\xDF\\xAE\\xA9\\u2122\\xB4\\xA8\\u2260\\u0102\\u0218\\u221E\\xB1\\u2264\\u2265\\xA5\\xB5\\u2202\\u2211\\u220F\\u03C0\\u222B\\xAA\\xBA\\u03A9\\u0103\\u0219\\xBF\\xA1\\xAC\\u221A\\u0192\\u2248\\u2206\\xAB\\xBB\\u2026\\xA0\\xC0\\xC3\\xD5\\u0152\\u0153\\u2013\\u2014\\u201C\\u201D\\u2018\\u2019\\xF7\\u25CA\\xFF\\u0178\\u2044\\u20AC\\u2039\\u203A\\u021A\\u021B\\u2021\\xB7\\u201A\\u201E\\u2030\\xC2\\xCA\\xC1\\xCB\\xC8\\xCD\\xCE\\xCF\\xCC\\xD3\\xD4\\uF8FF\\xD2\\xDA\\xDB\\xD9\\u0131\\u02C6\\u02DC\\xAF\\u02D8\\u02D9\\u02DA\\xB8\\u02DD\\u02DB\\u02C7\"\n ),\n \"x-mac-turkish\": (\n // Python: 'mac_turkish'\n \"\\xC4\\xC5\\xC7\\xC9\\xD1\\xD6\\xDC\\xE1\\xE0\\xE2\\xE4\\xE3\\xE5\\xE7\\xE9\\xE8\\xEA\\xEB\\xED\\xEC\\xEE\\xEF\\xF1\\xF3\\xF2\\xF4\\xF6\\xF5\\xFA\\xF9\\xFB\\xFC\\u2020\\xB0\\xA2\\xA3\\xA7\\u2022\\xB6\\xDF\\xAE\\xA9\\u2122\\xB4\\xA8\\u2260\\xC6\\xD8\\u221E\\xB1\\u2264\\u2265\\xA5\\xB5\\u2202\\u2211\\u220F\\u03C0\\u222B\\xAA\\xBA\\u03A9\\xE6\\xF8\\xBF\\xA1\\xAC\\u221A\\u0192\\u2248\\u2206\\xAB\\xBB\\u2026\\xA0\\xC0\\xC3\\xD5\\u0152\\u0153\\u2013\\u2014\\u201C\\u201D\\u2018\\u2019\\xF7\\u25CA\\xFF\\u0178\\u011E\\u011F\\u0130\\u0131\\u015E\\u015F\\u2021\\xB7\\u201A\\u201E\\u2030\\xC2\\xCA\\xC1\\xCB\\xC8\\xCD\\xCE\\xCF\\xCC\\xD3\\xD4\\uF8FF\\xD2\\xDA\\xDB\\xD9\\uF8A0\\u02C6\\u02DC\\xAF\\u02D8\\u02D9\\u02DA\\xB8\\u02DD\\u02DB\\u02C7\"\n )\n };\n decode.MACSTRING = function(dataView, offset, dataLength, encoding) {\n const table = eightBitMacEncodings[encoding];\n if (table === void 0) {\n return void 0;\n }\n let result = \"\";\n for (let i = 0; i < dataLength; i++) {\n const c = dataView.getUint8(offset + i);\n if (c <= 127) {\n result += String.fromCharCode(c);\n } else {\n result += table[c & 127];\n }\n }\n return result;\n };\n var macEncodingTableCache = typeof WeakMap === \"function\" && /* @__PURE__ */ new WeakMap();\n var macEncodingCacheKeys;\n var getMacEncodingTable = function(encoding) {\n if (!macEncodingCacheKeys) {\n macEncodingCacheKeys = {};\n for (let e in eightBitMacEncodings) {\n macEncodingCacheKeys[e] = new String(e);\n }\n }\n const cacheKey = macEncodingCacheKeys[encoding];\n if (cacheKey === void 0) {\n return void 0;\n }\n if (macEncodingTableCache) {\n const cachedTable = macEncodingTableCache.get(cacheKey);\n if (cachedTable !== void 0) {\n return cachedTable;\n }\n }\n const decodingTable = eightBitMacEncodings[encoding];\n if (decodingTable === void 0) {\n return void 0;\n }\n const encodingTable = {};\n for (let i = 0; i < decodingTable.length; i++) {\n encodingTable[decodingTable.charCodeAt(i)] = i + 128;\n }\n if (macEncodingTableCache) {\n macEncodingTableCache.set(cacheKey, encodingTable);\n }\n return encodingTable;\n };\n encode.MACSTRING = function(str, encoding) {\n const table = getMacEncodingTable(encoding);\n if (table === void 0) {\n return void 0;\n }\n const result = [];\n for (let i = 0; i < str.length; i++) {\n let c = str.charCodeAt(i);\n if (c >= 128) {\n c = table[c];\n if (c === void 0) {\n return void 0;\n }\n }\n result[i] = c;\n }\n return result;\n };\n sizeOf.MACSTRING = function(str, encoding) {\n const b = encode.MACSTRING(str, encoding);\n if (b !== void 0) {\n return b.length;\n } else {\n return 0;\n }\n };\n function isByteEncodable(value) {\n return value >= -128 && value <= 127;\n }\n function encodeVarDeltaRunAsZeroes(deltas, pos, result) {\n let runLength = 0;\n const numDeltas = deltas.length;\n while (pos < numDeltas && runLength < 64 && deltas[pos] === 0) {\n ++pos;\n ++runLength;\n }\n result.push(128 | runLength - 1);\n return pos;\n }\n function encodeVarDeltaRunAsBytes(deltas, offset, result) {\n let runLength = 0;\n const numDeltas = deltas.length;\n let pos = offset;\n while (pos < numDeltas && runLength < 64) {\n const value = deltas[pos];\n if (!isByteEncodable(value)) {\n break;\n }\n if (value === 0 && pos + 1 < numDeltas && deltas[pos + 1] === 0) {\n break;\n }\n ++pos;\n ++runLength;\n }\n result.push(runLength - 1);\n for (let i = offset; i < pos; ++i) {\n result.push(deltas[i] + 256 & 255);\n }\n return pos;\n }\n function encodeVarDeltaRunAsWords(deltas, offset, result) {\n let runLength = 0;\n const numDeltas = deltas.length;\n let pos = offset;\n while (pos < numDeltas && runLength < 64) {\n const value = deltas[pos];\n if (value === 0) {\n break;\n }\n if (isByteEncodable(value) && pos + 1 < numDeltas && isByteEncodable(deltas[pos + 1])) {\n break;\n }\n ++pos;\n ++runLength;\n }\n result.push(64 | runLength - 1);\n for (let i = offset; i < pos; ++i) {\n const val = deltas[i];\n result.push(val + 65536 >> 8 & 255, val + 256 & 255);\n }\n return pos;\n }\n encode.VARDELTAS = function(deltas) {\n let pos = 0;\n const result = [];\n while (pos < deltas.length) {\n const value = deltas[pos];\n if (value === 0) {\n pos = encodeVarDeltaRunAsZeroes(deltas, pos, result);\n } else if (value >= -128 && value <= 127) {\n pos = encodeVarDeltaRunAsBytes(deltas, pos, result);\n } else {\n pos = encodeVarDeltaRunAsWords(deltas, pos, result);\n }\n }\n return result;\n };\n encode.INDEX = function(l) {\n let offset = 1;\n const offsets = [offset];\n const data = [];\n for (let i = 0; i < l.length; i += 1) {\n const v = encode.OBJECT(l[i]);\n Array.prototype.push.apply(data, v);\n offset += v.length;\n offsets.push(offset);\n }\n if (data.length === 0) {\n return [0, 0];\n }\n const encodedOffsets = [];\n const offSize = 1 + Math.floor(Math.log(offset) / Math.log(2)) / 8 | 0;\n const offsetEncoder = [void 0, encode.BYTE, encode.USHORT, encode.UINT24, encode.ULONG][offSize];\n for (let i = 0; i < offsets.length; i += 1) {\n const encodedOffset = offsetEncoder(offsets[i]);\n Array.prototype.push.apply(encodedOffsets, encodedOffset);\n }\n return Array.prototype.concat(\n encode.Card16(l.length),\n encode.OffSize(offSize),\n encodedOffsets,\n data\n );\n };\n sizeOf.INDEX = function(v) {\n return encode.INDEX(v).length;\n };\n encode.DICT = function(m) {\n let d = [];\n const keys = Object.keys(m);\n const length = keys.length;\n for (let i = 0; i < length; i += 1) {\n const k = parseInt(keys[i], 0);\n const v = m[k];\n const enc1 = encode.OPERAND(v.value, v.type);\n const enc2 = encode.OPERATOR(k);\n for (let j = 0; j < enc1.length; j++) {\n d.push(enc1[j]);\n }\n for (let j = 0; j < enc2.length; j++) {\n d.push(enc2[j]);\n }\n }\n return d;\n };\n sizeOf.DICT = function(m) {\n return encode.DICT(m).length;\n };\n encode.OPERATOR = function(v) {\n if (v < 1200) {\n return [v];\n } else {\n return [12, v - 1200];\n }\n };\n encode.OPERAND = function(v, type) {\n let d = [];\n if (Array.isArray(type)) {\n for (let i = 0; i < type.length; i += 1) {\n check_default.argument(v.length === type.length, \"Not enough arguments given for type\" + type);\n const enc1 = encode.OPERAND(v[i], type[i]);\n for (let j = 0; j < enc1.length; j++) {\n d.push(enc1[j]);\n }\n }\n } else {\n if (type === \"SID\") {\n const enc1 = encode.NUMBER(v);\n for (let j = 0; j < enc1.length; j++) {\n d.push(enc1[j]);\n }\n } else if (type === \"offset\") {\n const enc1 = encode.NUMBER32(v);\n for (let j = 0; j < enc1.length; j++) {\n d.push(enc1[j]);\n }\n } else if (type === \"number\") {\n const enc1 = encode.NUMBER(v);\n for (let j = 0; j < enc1.length; j++) {\n d.push(enc1[j]);\n }\n } else if (type === \"real\") {\n const enc1 = encode.REAL(v);\n for (let j = 0; j < enc1.length; j++) {\n d.push(enc1[j]);\n }\n } else {\n throw new Error(\"Unknown operand type \" + type);\n }\n }\n return d;\n };\n encode.OP = encode.BYTE;\n sizeOf.OP = sizeOf.BYTE;\n var wmm = typeof WeakMap === \"function\" && /* @__PURE__ */ new WeakMap();\n encode.CHARSTRING = function(ops) {\n if (wmm) {\n const cachedValue = wmm.get(ops);\n if (cachedValue !== void 0) {\n return cachedValue;\n }\n }\n let d = [];\n const length = ops.length;\n for (let i = 0; i < length; i += 1) {\n const op = ops[i];\n const enc1 = encode[op.type](op.value);\n for (let j = 0; j < enc1.length; j++) {\n d.push(enc1[j]);\n }\n }\n if (wmm) {\n wmm.set(ops, d);\n }\n return d;\n };\n sizeOf.CHARSTRING = function(ops) {\n return encode.CHARSTRING(ops).length;\n };\n encode.OBJECT = function(v) {\n const encodingFunction = encode[v.type];\n check_default.argument(encodingFunction !== void 0, \"No encoding function for type \" + v.type);\n return encodingFunction(v.value);\n };\n sizeOf.OBJECT = function(v) {\n const sizeOfFunction = sizeOf[v.type];\n check_default.argument(sizeOfFunction !== void 0, \"No sizeOf function for type \" + v.type);\n return sizeOfFunction(v.value);\n };\n encode.TABLE = function(table) {\n let d = [];\n const length = (table.fields || []).length;\n const subtables = [];\n const subtableOffsets = [];\n for (let i = 0; i < length; i += 1) {\n const field = table.fields[i];\n const encodingFunction = encode[field.type];\n check_default.argument(encodingFunction !== void 0, \"No encoding function for field type \" + field.type + \" (\" + field.name + \")\");\n let value = table[field.name];\n if (value === void 0) {\n value = field.value;\n }\n const bytes = encodingFunction(value);\n if (field.type === \"TABLE\") {\n if (value.fields !== null) {\n subtableOffsets.push(d.length);\n subtables.push(bytes);\n }\n d.push(...[0, 0]);\n } else {\n for (let j = 0; j < bytes.length; j++) {\n d.push(bytes[j]);\n }\n }\n }\n for (let i = 0; i < subtables.length; i += 1) {\n const o = subtableOffsets[i];\n const offset = d.length;\n check_default.argument(offset < 65536, \"Table \" + table.tableName + \" too big.\");\n d[o] = offset >> 8;\n d[o + 1] = offset & 255;\n for (let j = 0; j < subtables[i].length; j++) {\n d.push(subtables[i][j]);\n }\n }\n return d;\n };\n sizeOf.TABLE = function(table) {\n let numBytes = 0;\n const length = (table.fields || []).length;\n for (let i = 0; i < length; i += 1) {\n const field = table.fields[i];\n const sizeOfFunction = sizeOf[field.type];\n check_default.argument(sizeOfFunction !== void 0, \"No sizeOf function for field type \" + field.type + \" (\" + field.name + \")\");\n let value = table[field.name];\n if (value === void 0) {\n value = field.value;\n }\n numBytes += sizeOfFunction(value);\n if (field.type === \"TABLE\") {\n numBytes += 2;\n }\n }\n return numBytes;\n };\n encode.RECORD = encode.TABLE;\n sizeOf.RECORD = sizeOf.TABLE;\n encode.LITERAL = function(v) {\n return v;\n };\n sizeOf.LITERAL = function(v) {\n return v.length;\n };\n\n // src/table.mjs\n function Table(tableName, fields, options) {\n if (fields && fields.length) {\n for (let i = 0; i < fields.length; i += 1) {\n const field = fields[i];\n this[field.name] = field.value;\n }\n }\n this.tableName = tableName;\n this.fields = fields;\n if (options) {\n const optionKeys = Object.keys(options);\n for (let i = 0; i < optionKeys.length; i += 1) {\n const k = optionKeys[i];\n const v = options[k];\n if (this[k] !== void 0) {\n this[k] = v;\n }\n }\n }\n }\n Table.prototype.encode = function() {\n return encode.TABLE(this);\n };\n Table.prototype.sizeOf = function() {\n return sizeOf.TABLE(this);\n };\n function ushortList(itemName, list, count) {\n if (count === void 0) {\n count = list.length;\n }\n const fields = new Array(list.length + 1);\n fields[0] = { name: itemName + \"Count\", type: \"USHORT\", value: count };\n for (let i = 0; i < list.length; i++) {\n fields[i + 1] = { name: itemName + i, type: \"USHORT\", value: list[i] };\n }\n return fields;\n }\n function tableList(itemName, records, itemCallback) {\n const count = records.length;\n const fields = new Array(count + 1);\n fields[0] = { name: itemName + \"Count\", type: \"USHORT\", value: count };\n for (let i = 0; i < count; i++) {\n fields[i + 1] = { name: itemName + i, type: \"TABLE\", value: itemCallback(records[i], i) };\n }\n return fields;\n }\n function recordList(itemName, records, itemCallback) {\n const count = records.length;\n let fields = [];\n fields[0] = { name: itemName + \"Count\", type: \"USHORT\", value: count };\n for (let i = 0; i < count; i++) {\n fields = fields.concat(itemCallback(records[i], i));\n }\n return fields;\n }\n function Coverage(coverageTable) {\n if (coverageTable.format === 1) {\n Table.call(\n this,\n \"coverageTable\",\n [{ name: \"coverageFormat\", type: \"USHORT\", value: 1 }].concat(ushortList(\"glyph\", coverageTable.glyphs))\n );\n } else if (coverageTable.format === 2) {\n Table.call(\n this,\n \"coverageTable\",\n [{ name: \"coverageFormat\", type: \"USHORT\", value: 2 }].concat(recordList(\"rangeRecord\", coverageTable.ranges, function(RangeRecord, i) {\n return [\n { name: \"startGlyphID\" + i, type: \"USHORT\", value: RangeRecord.start },\n { name: \"endGlyphID\" + i, type: \"USHORT\", value: RangeRecord.end },\n { name: \"startCoverageIndex\" + i, type: \"USHORT\", value: RangeRecord.index }\n ];\n }))\n );\n } else {\n check_default.assert(false, \"Coverage format must be 1 or 2.\");\n }\n }\n Coverage.prototype = Object.create(Table.prototype);\n Coverage.prototype.constructor = Coverage;\n function ScriptList(scriptListTable) {\n Table.call(\n this,\n \"scriptListTable\",\n recordList(\"scriptRecord\", scriptListTable, function(scriptRecord, i) {\n const script = scriptRecord.script;\n let defaultLangSys = script.defaultLangSys;\n check_default.assert(!!defaultLangSys, \"Unable to write GSUB: script \" + scriptRecord.tag + \" has no default language system.\");\n return [\n { name: \"scriptTag\" + i, type: \"TAG\", value: scriptRecord.tag },\n { name: \"script\" + i, type: \"TABLE\", value: new Table(\"scriptTable\", [\n { name: \"defaultLangSys\", type: \"TABLE\", value: new Table(\"defaultLangSys\", [\n { name: \"lookupOrder\", type: \"USHORT\", value: 0 },\n { name: \"reqFeatureIndex\", type: \"USHORT\", value: defaultLangSys.reqFeatureIndex }\n ].concat(ushortList(\"featureIndex\", defaultLangSys.featureIndexes))) }\n ].concat(recordList(\"langSys\", script.langSysRecords, function(langSysRecord, i2) {\n const langSys = langSysRecord.langSys;\n return [\n { name: \"langSysTag\" + i2, type: \"TAG\", value: langSysRecord.tag },\n { name: \"langSys\" + i2, type: \"TABLE\", value: new Table(\"langSys\", [\n { name: \"lookupOrder\", type: \"USHORT\", value: 0 },\n { name: \"reqFeatureIndex\", type: \"USHORT\", value: langSys.reqFeatureIndex }\n ].concat(ushortList(\"featureIndex\", langSys.featureIndexes))) }\n ];\n }))) }\n ];\n })\n );\n }\n ScriptList.prototype = Object.create(Table.prototype);\n ScriptList.prototype.constructor = ScriptList;\n function FeatureList(featureListTable) {\n Table.call(\n this,\n \"featureListTable\",\n recordList(\"featureRecord\", featureListTable, function(featureRecord, i) {\n const feature = featureRecord.feature;\n return [\n { name: \"featureTag\" + i, type: \"TAG\", value: featureRecord.tag },\n { name: \"feature\" + i, type: \"TABLE\", value: new Table(\"featureTable\", [\n { name: \"featureParams\", type: \"USHORT\", value: feature.featureParams }\n ].concat(ushortList(\"lookupListIndex\", feature.lookupListIndexes))) }\n ];\n })\n );\n }\n FeatureList.prototype = Object.create(Table.prototype);\n FeatureList.prototype.constructor = FeatureList;\n function LookupList(lookupListTable, subtableMakers3) {\n Table.call(this, \"lookupListTable\", tableList(\"lookup\", lookupListTable, function(lookupTable) {\n let subtableCallback = subtableMakers3[lookupTable.lookupType];\n check_default.assert(!!subtableCallback, \"Unable to write GSUB lookup type \" + lookupTable.lookupType + \" tables.\");\n return new Table(\"lookupTable\", [\n { name: \"lookupType\", type: \"USHORT\", value: lookupTable.lookupType },\n { name: \"lookupFlag\", type: \"USHORT\", value: lookupTable.lookupFlag }\n ].concat(tableList(\"subtable\", lookupTable.subtables, subtableCallback)));\n }));\n }\n LookupList.prototype = Object.create(Table.prototype);\n LookupList.prototype.constructor = LookupList;\n function ClassDef(classDefTable) {\n if (classDefTable.format === 1) {\n Table.call(\n this,\n \"classDefTable\",\n [\n { name: \"classFormat\", type: \"USHORT\", value: 1 },\n { name: \"startGlyphID\", type: \"USHORT\", value: classDefTable.startGlyph }\n ].concat(ushortList(\"glyph\", classDefTable.classes))\n );\n } else if (classDefTable.format === 2) {\n Table.call(\n this,\n \"classDefTable\",\n [{ name: \"classFormat\", type: \"USHORT\", value: 2 }].concat(recordList(\"rangeRecord\", classDefTable.ranges, function(RangeRecord, i) {\n return [\n { name: \"startGlyphID\" + i, type: \"USHORT\", value: RangeRecord.start },\n { name: \"endGlyphID\" + i, type: \"USHORT\", value: RangeRecord.end },\n { name: \"class\" + i, type: \"USHORT\", value: RangeRecord.classId }\n ];\n }))\n );\n } else {\n check_default.assert(false, \"Class format must be 1 or 2.\");\n }\n }\n ClassDef.prototype = Object.create(Table.prototype);\n ClassDef.prototype.constructor = ClassDef;\n var table_default = {\n Table,\n Record: Table,\n Coverage,\n ClassDef,\n ScriptList,\n FeatureList,\n LookupList,\n ushortList,\n tableList,\n recordList\n };\n\n // src/parse.mjs\n function getByte(dataView, offset) {\n return dataView.getUint8(offset);\n }\n function getUShort(dataView, offset) {\n return dataView.getUint16(offset, false);\n }\n function getShort(dataView, offset) {\n return dataView.getInt16(offset, false);\n }\n function getUInt24(dataView, offset) {\n return (dataView.getUint16(offset) << 8) + dataView.getUint8(offset + 2);\n }\n function getULong(dataView, offset) {\n return dataView.getUint32(offset, false);\n }\n function getLong(dataView, offset) {\n return dataView.getInt32(offset, false);\n }\n function getFixed(dataView, offset) {\n const decimal = dataView.getInt16(offset, false);\n const fraction = dataView.getUint16(offset + 2, false);\n return decimal + fraction / 65535;\n }\n function getTag(dataView, offset) {\n let tag = \"\";\n for (let i = offset; i < offset + 4; i += 1) {\n tag += String.fromCharCode(dataView.getInt8(i));\n }\n return tag;\n }\n function getOffset(dataView, offset, offSize) {\n let v = 0;\n for (let i = 0; i < offSize; i += 1) {\n v <<= 8;\n v += dataView.getUint8(offset + i);\n }\n return v;\n }\n function getBytes(dataView, startOffset, endOffset) {\n const bytes = [];\n for (let i = startOffset; i < endOffset; i += 1) {\n bytes.push(dataView.getUint8(i));\n }\n return bytes;\n }\n function bytesToString(bytes) {\n let s = \"\";\n for (let i = 0; i < bytes.length; i += 1) {\n s += String.fromCharCode(bytes[i]);\n }\n return s;\n }\n var typeOffsets = {\n byte: 1,\n uShort: 2,\n f2dot14: 2,\n short: 2,\n uInt24: 3,\n uLong: 4,\n fixed: 4,\n longDateTime: 8,\n tag: 4\n };\n var masks = {\n LONG_WORDS: 32768,\n WORD_DELTA_COUNT_MASK: 32767,\n SHARED_POINT_NUMBERS: 32768,\n COUNT_MASK: 4095,\n EMBEDDED_PEAK_TUPLE: 32768,\n INTERMEDIATE_REGION: 16384,\n PRIVATE_POINT_NUMBERS: 8192,\n TUPLE_INDEX_MASK: 4095,\n POINTS_ARE_WORDS: 128,\n POINT_RUN_COUNT_MASK: 127,\n DELTAS_ARE_ZERO: 128,\n DELTAS_ARE_WORDS: 64,\n DELTA_RUN_COUNT_MASK: 63,\n INNER_INDEX_BIT_COUNT_MASK: 15,\n MAP_ENTRY_SIZE_MASK: 48\n };\n function Parser(data, offset) {\n this.data = data;\n this.offset = offset;\n this.relativeOffset = 0;\n }\n Parser.prototype.parseByte = function() {\n const v = this.data.getUint8(this.offset + this.relativeOffset);\n this.relativeOffset += 1;\n return v;\n };\n Parser.prototype.parseChar = function() {\n const v = this.data.getInt8(this.offset + this.relativeOffset);\n this.relativeOffset += 1;\n return v;\n };\n Parser.prototype.parseCard8 = Parser.prototype.parseByte;\n Parser.prototype.parseUShort = function() {\n const v = this.data.getUint16(this.offset + this.relativeOffset);\n this.relativeOffset += 2;\n return v;\n };\n Parser.prototype.parseCard16 = Parser.prototype.parseUShort;\n Parser.prototype.parseSID = Parser.prototype.parseUShort;\n Parser.prototype.parseOffset16 = Parser.prototype.parseUShort;\n Parser.prototype.parseShort = function() {\n const v = this.data.getInt16(this.offset + this.relativeOffset);\n this.relativeOffset += 2;\n return v;\n };\n Parser.prototype.parseF2Dot14 = function() {\n const v = this.data.getInt16(this.offset + this.relativeOffset) / 16384;\n this.relativeOffset += 2;\n return v;\n };\n Parser.prototype.parseUInt24 = function() {\n const v = getUInt24(this.data, this.offset + this.relativeOffset);\n this.relativeOffset += 3;\n return v;\n };\n Parser.prototype.parseULong = function() {\n const v = getULong(this.data, this.offset + this.relativeOffset);\n this.relativeOffset += 4;\n return v;\n };\n Parser.prototype.parseLong = function() {\n const v = getLong(this.data, this.offset + this.relativeOffset);\n this.relativeOffset += 4;\n return v;\n };\n Parser.prototype.parseOffset32 = Parser.prototype.parseULong;\n Parser.prototype.parseFixed = function() {\n const v = getFixed(this.data, this.offset + this.relativeOffset);\n this.relativeOffset += 4;\n return v;\n };\n Parser.prototype.parseString = function(length) {\n const dataView = this.data;\n const offset = this.offset + this.relativeOffset;\n let string = \"\";\n this.relativeOffset += length;\n for (let i = 0; i < length; i++) {\n string += String.fromCharCode(dataView.getUint8(offset + i));\n }\n return string;\n };\n Parser.prototype.parseTag = function() {\n return this.parseString(4);\n };\n Parser.prototype.parseLongDateTime = function() {\n let v = getULong(this.data, this.offset + this.relativeOffset + 4);\n v -= 2082844800;\n this.relativeOffset += 8;\n return v;\n };\n Parser.prototype.parseVersion = function(minorBase) {\n const major = getUShort(this.data, this.offset + this.relativeOffset);\n const minor = getUShort(this.data, this.offset + this.relativeOffset + 2);\n this.relativeOffset += 4;\n if (minorBase === void 0) minorBase = 4096;\n return major + minor / minorBase / 10;\n };\n Parser.prototype.skip = function(type, amount) {\n if (amount === void 0) {\n amount = 1;\n }\n this.relativeOffset += typeOffsets[type] * amount;\n };\n Parser.prototype.parseULongList = function(count) {\n if (count === void 0) {\n count = this.parseULong();\n }\n const offsets = new Array(count);\n const dataView = this.data;\n let offset = this.offset + this.relativeOffset;\n for (let i = 0; i < count; i++) {\n offsets[i] = dataView.getUint32(offset);\n offset += 4;\n }\n this.relativeOffset += count * 4;\n return offsets;\n };\n Parser.prototype.parseOffset16List = Parser.prototype.parseUShortList = function(count) {\n if (count === void 0) {\n count = this.parseUShort();\n }\n const offsets = new Array(count);\n const dataView = this.data;\n let offset = this.offset + this.relativeOffset;\n for (let i = 0; i < count; i++) {\n offsets[i] = dataView.getUint16(offset);\n offset += 2;\n }\n this.relativeOffset += count * 2;\n return offsets;\n };\n Parser.prototype.parseShortList = function(count) {\n const list = new Array(count);\n const dataView = this.data;\n let offset = this.offset + this.relativeOffset;\n for (let i = 0; i < count; i++) {\n list[i] = dataView.getInt16(offset);\n offset += 2;\n }\n this.relativeOffset += count * 2;\n return list;\n };\n Parser.prototype.parseByteList = function(count) {\n const list = new Array(count);\n const dataView = this.data;\n let offset = this.offset + this.relativeOffset;\n for (let i = 0; i < count; i++) {\n list[i] = dataView.getUint8(offset++);\n }\n this.relativeOffset += count;\n return list;\n };\n Parser.prototype.parseList = function(count, itemCallback) {\n if (!itemCallback) {\n itemCallback = count;\n count = this.parseUShort();\n }\n const list = new Array(count);\n for (let i = 0; i < count; i++) {\n list[i] = itemCallback.call(this);\n }\n return list;\n };\n Parser.prototype.parseList32 = function(count, itemCallback) {\n if (!itemCallback) {\n itemCallback = count;\n count = this.parseULong();\n }\n const list = new Array(count);\n for (let i = 0; i < count; i++) {\n list[i] = itemCallback.call(this);\n }\n return list;\n };\n Parser.prototype.parseRecordList = function(count, recordDescription) {\n if (!recordDescription) {\n recordDescription = count;\n count = this.parseUShort();\n }\n const records = new Array(count);\n const fields = Object.keys(recordDescription);\n for (let i = 0; i < count; i++) {\n const rec = {};\n for (let j = 0; j < fields.length; j++) {\n const fieldName = fields[j];\n const fieldType = recordDescription[fieldName];\n rec[fieldName] = fieldType.call(this);\n }\n records[i] = rec;\n }\n return records;\n };\n Parser.prototype.parseRecordList32 = function(count, recordDescription) {\n if (!recordDescription) {\n recordDescription = count;\n count = this.parseULong();\n }\n const records = new Array(count);\n const fields = Object.keys(recordDescription);\n for (let i = 0; i < count; i++) {\n const rec = {};\n for (let j = 0; j < fields.length; j++) {\n const fieldName = fields[j];\n const fieldType = recordDescription[fieldName];\n rec[fieldName] = fieldType.call(this);\n }\n records[i] = rec;\n }\n return records;\n };\n Parser.prototype.parseTupleRecords = function(tupleCount, axisCount) {\n let tuples = [];\n for (let i = 0; i < tupleCount; i++) {\n let tuple = [];\n for (let axisIndex = 0; axisIndex < axisCount; axisIndex++) {\n tuple.push(this.parseF2Dot14());\n }\n tuples.push(tuple);\n }\n return tuples;\n };\n Parser.prototype.parseStruct = function(description) {\n if (typeof description === \"function\") {\n return description.call(this);\n } else {\n const fields = Object.keys(description);\n const struct = {};\n for (let j = 0; j < fields.length; j++) {\n const fieldName = fields[j];\n const fieldType = description[fieldName];\n struct[fieldName] = fieldType.call(this);\n }\n return struct;\n }\n };\n Parser.prototype.parseValueRecord = function(valueFormat) {\n if (valueFormat === void 0) {\n valueFormat = this.parseUShort();\n }\n if (valueFormat === 0) {\n return;\n }\n const valueRecord = {};\n if (valueFormat & 1) {\n valueRecord.xPlacement = this.parseShort();\n }\n if (valueFormat & 2) {\n valueRecord.yPlacement = this.parseShort();\n }\n if (valueFormat & 4) {\n valueRecord.xAdvance = this.parseShort();\n }\n if (valueFormat & 8) {\n valueRecord.yAdvance = this.parseShort();\n }\n if (valueFormat & 16) {\n valueRecord.xPlaDevice = void 0;\n this.parseShort();\n }\n if (valueFormat & 32) {\n valueRecord.yPlaDevice = void 0;\n this.parseShort();\n }\n if (valueFormat & 64) {\n valueRecord.xAdvDevice = void 0;\n this.parseShort();\n }\n if (valueFormat & 128) {\n valueRecord.yAdvDevice = void 0;\n this.parseShort();\n }\n return valueRecord;\n };\n Parser.prototype.parseValueRecordList = function() {\n const valueFormat = this.parseUShort();\n const valueCount = this.parseUShort();\n const values = new Array(valueCount);\n for (let i = 0; i < valueCount; i++) {\n values[i] = this.parseValueRecord(valueFormat);\n }\n return values;\n };\n Parser.prototype.parsePointer = function(description) {\n const structOffset = this.parseOffset16();\n if (structOffset > 0) {\n return new Parser(this.data, this.offset + structOffset).parseStruct(description);\n }\n return void 0;\n };\n Parser.prototype.parsePointer32 = function(description) {\n const structOffset = this.parseOffset32();\n if (structOffset > 0) {\n return new Parser(this.data, this.offset + structOffset).parseStruct(description);\n }\n return void 0;\n };\n Parser.prototype.parseListOfLists = function(itemCallback) {\n const offsets = this.parseOffset16List();\n const count = offsets.length;\n const relativeOffset = this.relativeOffset;\n const list = new Array(count);\n for (let i = 0; i < count; i++) {\n const start = offsets[i];\n if (start === 0) {\n list[i] = void 0;\n continue;\n }\n this.relativeOffset = start;\n if (itemCallback) {\n const subOffsets = this.parseOffset16List();\n const subList = new Array(subOffsets.length);\n for (let j = 0; j < subOffsets.length; j++) {\n this.relativeOffset = start + subOffsets[j];\n subList[j] = itemCallback.call(this);\n }\n list[i] = subList;\n } else {\n list[i] = this.parseUShortList();\n }\n }\n this.relativeOffset = relativeOffset;\n return list;\n };\n Parser.prototype.parseCoverage = function() {\n const startOffset = this.offset + this.relativeOffset;\n const format = this.parseUShort();\n const count = this.parseUShort();\n if (format === 1) {\n return {\n format: 1,\n glyphs: this.parseUShortList(count)\n };\n } else if (format === 2) {\n const ranges = new Array(count);\n for (let i = 0; i < count; i++) {\n ranges[i] = {\n start: this.parseUShort(),\n end: this.parseUShort(),\n index: this.parseUShort()\n };\n }\n return {\n format: 2,\n ranges\n };\n }\n throw new Error(\"0x\" + startOffset.toString(16) + \": Coverage format must be 1 or 2.\");\n };\n Parser.prototype.parseClassDef = function() {\n const startOffset = this.offset + this.relativeOffset;\n const format = this.parseUShort();\n if (format === 1) {\n return {\n format: 1,\n startGlyph: this.parseUShort(),\n classes: this.parseUShortList()\n };\n } else if (format === 2) {\n return {\n format: 2,\n ranges: this.parseRecordList({\n start: Parser.uShort,\n end: Parser.uShort,\n classId: Parser.uShort\n })\n };\n }\n console.warn(`0x${startOffset.toString(16)}: This font file uses an invalid ClassDef format of ${format}. It might be corrupted and should be reacquired if it doesn't display as intended.`);\n return {\n format\n };\n };\n Parser.list = function(count, itemCallback) {\n return function() {\n return this.parseList(count, itemCallback);\n };\n };\n Parser.list32 = function(count, itemCallback) {\n return function() {\n return this.parseList32(count, itemCallback);\n };\n };\n Parser.recordList = function(count, recordDescription) {\n return function() {\n return this.parseRecordList(count, recordDescription);\n };\n };\n Parser.recordList32 = function(count, recordDescription) {\n return function() {\n return this.parseRecordList32(count, recordDescription);\n };\n };\n Parser.pointer = function(description) {\n return function() {\n return this.parsePointer(description);\n };\n };\n Parser.pointer32 = function(description) {\n return function() {\n return this.parsePointer32(description);\n };\n };\n Parser.tag = Parser.prototype.parseTag;\n Parser.byte = Parser.prototype.parseByte;\n Parser.uShort = Parser.offset16 = Parser.prototype.parseUShort;\n Parser.uShortList = Parser.prototype.parseUShortList;\n Parser.uInt24 = Parser.prototype.parseUInt24;\n Parser.uLong = Parser.offset32 = Parser.prototype.parseULong;\n Parser.uLongList = Parser.prototype.parseULongList;\n Parser.fixed = Parser.prototype.parseFixed;\n Parser.f2Dot14 = Parser.prototype.parseF2Dot14;\n Parser.struct = Parser.prototype.parseStruct;\n Parser.coverage = Parser.prototype.parseCoverage;\n Parser.classDef = Parser.prototype.parseClassDef;\n var langSysTable = {\n reserved: Parser.uShort,\n reqFeatureIndex: Parser.uShort,\n featureIndexes: Parser.uShortList\n };\n Parser.prototype.parseScriptList = function() {\n return this.parsePointer(Parser.recordList({\n tag: Parser.tag,\n script: Parser.pointer({\n defaultLangSys: Parser.pointer(langSysTable),\n langSysRecords: Parser.recordList({\n tag: Parser.tag,\n langSys: Parser.pointer(langSysTable)\n })\n })\n })) || [];\n };\n Parser.prototype.parseFeatureList = function() {\n return this.parsePointer(Parser.recordList({\n tag: Parser.tag,\n feature: Parser.pointer({\n featureParams: Parser.offset16,\n lookupListIndexes: Parser.uShortList\n })\n })) || [];\n };\n Parser.prototype.parseLookupList = function(lookupTableParsers) {\n return this.parsePointer(Parser.list(Parser.pointer(function() {\n const lookupType = this.parseUShort();\n check_default.argument(1 <= lookupType && lookupType <= 9, \"GPOS/GSUB lookup type \" + lookupType + \" unknown.\");\n const lookupFlag = this.parseUShort();\n const useMarkFilteringSet = lookupFlag & 16;\n return {\n lookupType,\n lookupFlag,\n subtables: this.parseList(Parser.pointer(lookupTableParsers[lookupType])),\n markFilteringSet: useMarkFilteringSet ? this.parseUShort() : void 0\n };\n }))) || [];\n };\n Parser.prototype.parseFeatureVariationsList = function() {\n return this.parsePointer32(function() {\n const majorVersion = this.parseUShort();\n const minorVersion = this.parseUShort();\n check_default.argument(majorVersion === 1 && minorVersion < 1, \"GPOS/GSUB feature variations table unknown.\");\n const featureVariations = this.parseRecordList32({\n conditionSetOffset: Parser.offset32,\n featureTableSubstitutionOffset: Parser.offset32\n });\n return featureVariations;\n }) || [];\n };\n Parser.prototype.parseVariationStore = function() {\n const vsOffset = this.relativeOffset;\n const length = this.parseUShort();\n const variationStore = {\n itemVariationStore: this.parseItemVariationStore()\n };\n this.relativeOffset = vsOffset + length + 2;\n return variationStore;\n };\n Parser.prototype.parseItemVariationStore = function() {\n const itemStoreOffset = this.relativeOffset;\n const iVStore = {\n format: this.parseUShort(),\n variationRegions: [],\n itemVariationSubtables: []\n };\n const variationRegionListOffset = this.parseOffset32();\n const itemVariationDataCount = this.parseUShort();\n const itemVariationDataOffsets = this.parseULongList(itemVariationDataCount);\n this.relativeOffset = itemStoreOffset + variationRegionListOffset;\n iVStore.variationRegions = this.parseVariationRegionList();\n for (let i = 0; i < itemVariationDataCount; i++) {\n const subtableOffset = itemVariationDataOffsets[i];\n this.relativeOffset = itemStoreOffset + subtableOffset;\n iVStore.itemVariationSubtables.push(this.parseItemVariationSubtable());\n }\n return iVStore;\n };\n Parser.prototype.parseVariationRegionList = function() {\n const axisCount = this.parseUShort();\n const regionCount = this.parseUShort();\n return this.parseRecordList(regionCount, {\n regionAxes: Parser.recordList(axisCount, {\n startCoord: Parser.f2Dot14,\n peakCoord: Parser.f2Dot14,\n endCoord: Parser.f2Dot14\n })\n });\n };\n Parser.prototype.parseItemVariationSubtable = function() {\n const itemCount = this.parseUShort();\n const wordDeltaCount = this.parseUShort();\n const regionIndexes = this.parseUShortList();\n const regionIndexCount = regionIndexes.length;\n const subtable = {\n regionIndexes,\n deltaSets: itemCount && regionIndexCount ? this.parseDeltaSets(itemCount, wordDeltaCount, regionIndexCount) : []\n };\n return subtable;\n };\n Parser.prototype.parseDeltaSetIndexMap = function() {\n const format = this.parseByte();\n const entryFormat = this.parseByte();\n const map = [];\n let mapCount = 0;\n switch (format) {\n case 0:\n mapCount = this.parseUShort();\n break;\n case 1:\n mapCount = this.parseULong();\n break;\n default:\n console.error(`unsupported DeltaSetIndexMap format ${format}`);\n }\n if (!mapCount) return {\n format,\n entryFormat\n };\n const bitCount = (entryFormat & masks.INNER_INDEX_BIT_COUNT_MASK) + 1;\n const entrySize = ((entryFormat & masks.MAP_ENTRY_SIZE_MASK) >> 4) + 1;\n for (let n = 0; n < mapCount; n++) {\n let entry;\n if (entrySize === 1) {\n entry = this.parseByte();\n } else if (entrySize === 2) {\n entry = this.parseUShort();\n } else if (entrySize === 3) {\n entry = this.parseUInt24();\n } else if (entrySize === 4) {\n entry = this.parseULong();\n } else {\n throw new Error(`Invalid entry size of ${entrySize}`);\n }\n const outerIndex = entry >> bitCount;\n const innerIndex = entry & (1 << bitCount) - 1;\n map.push({ outerIndex, innerIndex });\n }\n return {\n format,\n entryFormat,\n map\n };\n };\n Parser.prototype.parseDeltaSets = function(itemCount, wordDeltaCount, regionIndexCount) {\n const deltas = Array.from({ length: itemCount }, () => []);\n const longFlag = wordDeltaCount & masks.LONG_WORDS;\n const wordCount = wordDeltaCount & masks.WORD_DELTA_COUNT_MASK;\n if (wordCount > regionIndexCount) {\n throw Error(\"wordCount must be less than or equal to regionIndexCount\");\n }\n const wordParser = (longFlag ? this.parseLong : this.parseShort).bind(this);\n const restParser = (longFlag ? this.parseShort : this.parseChar).bind(this);\n for (let i = 0; i < itemCount; i++) {\n for (let j = 0; j < regionIndexCount; j++) {\n if (j < wordCount) {\n deltas[i].push(wordParser());\n } else {\n deltas[i].push(restParser());\n }\n }\n }\n return deltas;\n };\n Parser.prototype.parseTupleVariationStoreList = function(axisCount, flavor, glyphs) {\n const glyphCount = this.parseUShort();\n const flags = this.parseUShort();\n const offsetSizeIs32Bit = flags & 1;\n const glyphVariationDataArrayOffset = this.parseOffset32();\n const parseOffset = (offsetSizeIs32Bit ? this.parseULong : this.parseUShort).bind(this);\n const glyphVariations = {};\n let currentOffset = parseOffset();\n if (!offsetSizeIs32Bit) currentOffset *= 2;\n let nextOffset;\n for (let i = 0; i < glyphCount; i++) {\n nextOffset = parseOffset();\n if (!offsetSizeIs32Bit) nextOffset *= 2;\n const length = nextOffset - currentOffset;\n glyphVariations[i] = length ? this.parseTupleVariationStore(\n glyphVariationDataArrayOffset + currentOffset,\n axisCount,\n flavor,\n glyphs,\n i\n ) : void 0;\n currentOffset = nextOffset;\n }\n return glyphVariations;\n };\n Parser.prototype.parseTupleVariationStore = function(tableOffset, axisCount, flavor, glyphs, glyphIndex) {\n const relativeOffset = this.relativeOffset;\n this.relativeOffset = tableOffset;\n if (flavor === \"cvar\") {\n this.relativeOffset += 4;\n }\n const tupleVariationCount = this.parseUShort();\n const hasSharedPoints = !!(tupleVariationCount & masks.SHARED_POINT_NUMBERS);\n const count = tupleVariationCount & masks.COUNT_MASK;\n let dataOffset = this.parseOffset16();\n const headers = [];\n let sharedPoints = [];\n for (let h = 0; h < count; h++) {\n const headerData = this.parseTupleVariationHeader(axisCount, flavor);\n headers.push(headerData);\n }\n if (this.relativeOffset !== tableOffset + dataOffset) {\n console.warn(`Unexpected offset after parsing tuple variation headers! Expected ${tableOffset + dataOffset}, actually ${this.relativeOffset}`);\n this.relativeOffset = tableOffset + dataOffset;\n }\n if (hasSharedPoints) {\n sharedPoints = this.parsePackedPointNumbers();\n }\n let serializedDataOffset = this.relativeOffset;\n for (let h = 0; h < count; h++) {\n const header = headers[h];\n header.privatePoints = [];\n this.relativeOffset = serializedDataOffset;\n if (flavor === \"cvar\" && !header.peakTuple) {\n console.warn(\"An embedded peak tuple is required in TupleVariationHeaders for the cvar table.\");\n }\n if (header.flags.privatePointNumbers) {\n header.privatePoints = this.parsePackedPointNumbers();\n }\n delete header.flags;\n const deltasOffset = this.offset;\n const deltasRelativeOffset = this.relativeOffset;\n const defineDeltas = (propertyName) => {\n let _deltas = void 0;\n let _deltasY = void 0;\n const parseDeltas = () => {\n let pointsCount = 0;\n if (flavor === \"gvar\") {\n pointsCount = header.privatePoints.length || sharedPoints.length;\n if (!pointsCount) {\n const glyph = glyphs.get(glyphIndex);\n glyph.path;\n pointsCount = glyph.points.length;\n pointsCount += 4;\n }\n } else if (flavor === \"cvar\") {\n pointsCount = glyphs.length;\n }\n this.offset = deltasOffset;\n this.relativeOffset = deltasRelativeOffset;\n _deltas = this.parsePackedDeltas(pointsCount);\n if (flavor === \"gvar\") {\n _deltasY = this.parsePackedDeltas(pointsCount);\n }\n };\n return {\n configurable: true,\n get: function() {\n if (_deltas === void 0) parseDeltas();\n return propertyName === \"deltasY\" ? _deltasY : _deltas;\n },\n set: function(deltas) {\n if (_deltas === void 0) parseDeltas();\n if (propertyName === \"deltasY\") {\n _deltasY = deltas;\n } else {\n _deltas = deltas;\n }\n }\n };\n };\n Object.defineProperty(header, \"deltas\", defineDeltas.call(this, \"deltas\"));\n if (flavor === \"gvar\") {\n Object.defineProperty(header, \"deltasY\", defineDeltas.call(this, \"deltasY\"));\n }\n serializedDataOffset += header.variationDataSize;\n delete header.variationDataSize;\n }\n this.relativeOffset = relativeOffset;\n const result = {\n headers\n };\n result.sharedPoints = sharedPoints;\n return result;\n };\n Parser.prototype.parseTupleVariationHeader = function(axisCount, flavor) {\n const variationDataSize = this.parseUShort();\n const tupleIndex = this.parseUShort();\n const embeddedPeakTuple = !!(tupleIndex & masks.EMBEDDED_PEAK_TUPLE);\n const intermediateRegion = !!(tupleIndex & masks.INTERMEDIATE_REGION);\n const privatePointNumbers = !!(tupleIndex & masks.PRIVATE_POINT_NUMBERS);\n const sharedTupleRecordsIndex = embeddedPeakTuple ? void 0 : tupleIndex & masks.TUPLE_INDEX_MASK;\n const peakTuple = embeddedPeakTuple ? this.parseTupleRecords(1, axisCount)[0] : void 0;\n const intermediateStartTuple = intermediateRegion ? this.parseTupleRecords(1, axisCount)[0] : void 0;\n const intermediateEndTuple = intermediateRegion ? this.parseTupleRecords(1, axisCount)[0] : void 0;\n const result = {\n variationDataSize,\n peakTuple,\n intermediateStartTuple,\n intermediateEndTuple,\n flags: {\n embeddedPeakTuple,\n intermediateRegion,\n privatePointNumbers\n }\n };\n if (flavor === \"gvar\") {\n result.sharedTupleRecordsIndex = sharedTupleRecordsIndex;\n }\n return result;\n };\n Parser.prototype.parsePackedPointNumbers = function() {\n const countByte1 = this.parseByte();\n const points = [];\n let totalPointCount = countByte1;\n if (countByte1 >= 128) {\n const countByte2 = this.parseByte();\n totalPointCount = (countByte1 & masks.POINT_RUN_COUNT_MASK) << 8 | countByte2;\n }\n let lastPoint = 0;\n while (points.length < totalPointCount) {\n const controlByte = this.parseByte();\n const numbersAre16Bit = !!(controlByte & masks.POINTS_ARE_WORDS);\n let runCount = (controlByte & masks.POINT_RUN_COUNT_MASK) + 1;\n for (let i = 0; i < runCount && points.length < totalPointCount; i++) {\n let pointDelta;\n if (numbersAre16Bit) {\n pointDelta = this.parseUShort();\n } else {\n pointDelta = this.parseByte();\n }\n lastPoint = lastPoint + pointDelta;\n points.push(lastPoint);\n }\n }\n return points;\n };\n Parser.prototype.parsePackedDeltas = function(expectedCount) {\n const deltas = [];\n while (deltas.length < expectedCount) {\n const controlByte = this.parseByte();\n const zeroData = !!(controlByte & masks.DELTAS_ARE_ZERO);\n const deltaWords = !!(controlByte & masks.DELTAS_ARE_WORDS);\n const runCount = (controlByte & masks.DELTA_RUN_COUNT_MASK) + 1;\n for (let i = 0; i < runCount && deltas.length < expectedCount; i++) {\n if (zeroData) {\n deltas.push(0);\n } else if (deltaWords) {\n deltas.push(this.parseShort());\n } else {\n deltas.push(this.parseChar());\n }\n }\n }\n return deltas;\n };\n var parse_default = {\n getByte,\n getCard8: getByte,\n getUShort,\n getCard16: getUShort,\n getShort,\n getUInt24,\n getULong,\n getFixed,\n getTag,\n getOffset,\n getBytes,\n bytesToString,\n Parser\n };\n\n // src/tables/name.mjs\n var nameTableNames = [\n \"copyright\",\n // 0\n \"fontFamily\",\n // 1\n \"fontSubfamily\",\n // 2\n \"uniqueID\",\n // 3\n \"fullName\",\n // 4\n \"version\",\n // 5\n \"postScriptName\",\n // 6\n \"trademark\",\n // 7\n \"manufacturer\",\n // 8\n \"designer\",\n // 9\n \"description\",\n // 10\n \"manufacturerURL\",\n // 11\n \"designerURL\",\n // 12\n \"license\",\n // 13\n \"licenseURL\",\n // 14\n \"reserved\",\n // 15\n \"preferredFamily\",\n // 16\n \"preferredSubfamily\",\n // 17\n \"compatibleFullName\",\n // 18\n \"sampleText\",\n // 19\n \"postScriptFindFontName\",\n // 20\n \"wwsFamily\",\n // 21\n \"wwsSubfamily\"\n // 22\n ];\n var macLanguages = {\n 0: \"en\",\n 1: \"fr\",\n 2: \"de\",\n 3: \"it\",\n 4: \"nl\",\n 5: \"sv\",\n 6: \"es\",\n 7: \"da\",\n 8: \"pt\",\n 9: \"no\",\n 10: \"he\",\n 11: \"ja\",\n 12: \"ar\",\n 13: \"fi\",\n 14: \"el\",\n 15: \"is\",\n 16: \"mt\",\n 17: \"tr\",\n 18: \"hr\",\n 19: \"zh-Hant\",\n 20: \"ur\",\n 21: \"hi\",\n 22: \"th\",\n 23: \"ko\",\n 24: \"lt\",\n 25: \"pl\",\n 26: \"hu\",\n 27: \"es\",\n 28: \"lv\",\n 29: \"se\",\n 30: \"fo\",\n 31: \"fa\",\n 32: \"ru\",\n 33: \"zh\",\n 34: \"nl-BE\",\n 35: \"ga\",\n 36: \"sq\",\n 37: \"ro\",\n 38: \"cz\",\n 39: \"sk\",\n 40: \"si\",\n 41: \"yi\",\n 42: \"sr\",\n 43: \"mk\",\n 44: \"bg\",\n 45: \"uk\",\n 46: \"be\",\n 47: \"uz\",\n 48: \"kk\",\n 49: \"az-Cyrl\",\n 50: \"az-Arab\",\n 51: \"hy\",\n 52: \"ka\",\n 53: \"mo\",\n 54: \"ky\",\n 55: \"tg\",\n 56: \"tk\",\n 57: \"mn-CN\",\n 58: \"mn\",\n 59: \"ps\",\n 60: \"ks\",\n 61: \"ku\",\n 62: \"sd\",\n 63: \"bo\",\n 64: \"ne\",\n 65: \"sa\",\n 66: \"mr\",\n 67: \"bn\",\n 68: \"as\",\n 69: \"gu\",\n 70: \"pa\",\n 71: \"or\",\n 72: \"ml\",\n 73: \"kn\",\n 74: \"ta\",\n 75: \"te\",\n 76: \"si\",\n 77: \"my\",\n 78: \"km\",\n 79: \"lo\",\n 80: \"vi\",\n 81: \"id\",\n 82: \"tl\",\n 83: \"ms\",\n 84: \"ms-Arab\",\n 85: \"am\",\n 86: \"ti\",\n 87: \"om\",\n 88: \"so\",\n 89: \"sw\",\n 90: \"rw\",\n 91: \"rn\",\n 92: \"ny\",\n 93: \"mg\",\n 94: \"eo\",\n 128: \"cy\",\n 129: \"eu\",\n 130: \"ca\",\n 131: \"la\",\n 132: \"qu\",\n 133: \"gn\",\n 134: \"ay\",\n 135: \"tt\",\n 136: \"ug\",\n 137: \"dz\",\n 138: \"jv\",\n 139: \"su\",\n 140: \"gl\",\n 141: \"af\",\n 142: \"br\",\n 143: \"iu\",\n 144: \"gd\",\n 145: \"gv\",\n 146: \"ga\",\n 147: \"to\",\n 148: \"el-polyton\",\n 149: \"kl\",\n 150: \"az\",\n 151: \"nn\"\n };\n var macLanguageToScript = {\n 0: 0,\n // langEnglish \u2192 smRoman\n 1: 0,\n // langFrench \u2192 smRoman\n 2: 0,\n // langGerman \u2192 smRoman\n 3: 0,\n // langItalian \u2192 smRoman\n 4: 0,\n // langDutch \u2192 smRoman\n 5: 0,\n // langSwedish \u2192 smRoman\n 6: 0,\n // langSpanish \u2192 smRoman\n 7: 0,\n // langDanish \u2192 smRoman\n 8: 0,\n // langPortuguese \u2192 smRoman\n 9: 0,\n // langNorwegian \u2192 smRoman\n 10: 5,\n // langHebrew \u2192 smHebrew\n 11: 1,\n // langJapanese \u2192 smJapanese\n 12: 4,\n // langArabic \u2192 smArabic\n 13: 0,\n // langFinnish \u2192 smRoman\n 14: 6,\n // langGreek \u2192 smGreek\n 15: 0,\n // langIcelandic \u2192 smRoman (modified)\n 16: 0,\n // langMaltese \u2192 smRoman\n 17: 0,\n // langTurkish \u2192 smRoman (modified)\n 18: 0,\n // langCroatian \u2192 smRoman (modified)\n 19: 2,\n // langTradChinese \u2192 smTradChinese\n 20: 4,\n // langUrdu \u2192 smArabic\n 21: 9,\n // langHindi \u2192 smDevanagari\n 22: 21,\n // langThai \u2192 smThai\n 23: 3,\n // langKorean \u2192 smKorean\n 24: 29,\n // langLithuanian \u2192 smCentralEuroRoman\n 25: 29,\n // langPolish \u2192 smCentralEuroRoman\n 26: 29,\n // langHungarian \u2192 smCentralEuroRoman\n 27: 29,\n // langEstonian \u2192 smCentralEuroRoman\n 28: 29,\n // langLatvian \u2192 smCentralEuroRoman\n 29: 0,\n // langSami \u2192 smRoman\n 30: 0,\n // langFaroese \u2192 smRoman (modified)\n 31: 4,\n // langFarsi \u2192 smArabic (modified)\n 32: 7,\n // langRussian \u2192 smCyrillic\n 33: 25,\n // langSimpChinese \u2192 smSimpChinese\n 34: 0,\n // langFlemish \u2192 smRoman\n 35: 0,\n // langIrishGaelic \u2192 smRoman (modified)\n 36: 0,\n // langAlbanian \u2192 smRoman\n 37: 0,\n // langRomanian \u2192 smRoman (modified)\n 38: 29,\n // langCzech \u2192 smCentralEuroRoman\n 39: 29,\n // langSlovak \u2192 smCentralEuroRoman\n 40: 0,\n // langSlovenian \u2192 smRoman (modified)\n 41: 5,\n // langYiddish \u2192 smHebrew\n 42: 7,\n // langSerbian \u2192 smCyrillic\n 43: 7,\n // langMacedonian \u2192 smCyrillic\n 44: 7,\n // langBulgarian \u2192 smCyrillic\n 45: 7,\n // langUkrainian \u2192 smCyrillic (modified)\n 46: 7,\n // langByelorussian \u2192 smCyrillic\n 47: 7,\n // langUzbek \u2192 smCyrillic\n 48: 7,\n // langKazakh \u2192 smCyrillic\n 49: 7,\n // langAzerbaijani \u2192 smCyrillic\n 50: 4,\n // langAzerbaijanAr \u2192 smArabic\n 51: 24,\n // langArmenian \u2192 smArmenian\n 52: 23,\n // langGeorgian \u2192 smGeorgian\n 53: 7,\n // langMoldavian \u2192 smCyrillic\n 54: 7,\n // langKirghiz \u2192 smCyrillic\n 55: 7,\n // langTajiki \u2192 smCyrillic\n 56: 7,\n // langTurkmen \u2192 smCyrillic\n 57: 27,\n // langMongolian \u2192 smMongolian\n 58: 7,\n // langMongolianCyr \u2192 smCyrillic\n 59: 4,\n // langPashto \u2192 smArabic\n 60: 4,\n // langKurdish \u2192 smArabic\n 61: 4,\n // langKashmiri \u2192 smArabic\n 62: 4,\n // langSindhi \u2192 smArabic\n 63: 26,\n // langTibetan \u2192 smTibetan\n 64: 9,\n // langNepali \u2192 smDevanagari\n 65: 9,\n // langSanskrit \u2192 smDevanagari\n 66: 9,\n // langMarathi \u2192 smDevanagari\n 67: 13,\n // langBengali \u2192 smBengali\n 68: 13,\n // langAssamese \u2192 smBengali\n 69: 11,\n // langGujarati \u2192 smGujarati\n 70: 10,\n // langPunjabi \u2192 smGurmukhi\n 71: 12,\n // langOriya \u2192 smOriya\n 72: 17,\n // langMalayalam \u2192 smMalayalam\n 73: 16,\n // langKannada \u2192 smKannada\n 74: 14,\n // langTamil \u2192 smTamil\n 75: 15,\n // langTelugu \u2192 smTelugu\n 76: 18,\n // langSinhalese \u2192 smSinhalese\n 77: 19,\n // langBurmese \u2192 smBurmese\n 78: 20,\n // langKhmer \u2192 smKhmer\n 79: 22,\n // langLao \u2192 smLao\n 80: 30,\n // langVietnamese \u2192 smVietnamese\n 81: 0,\n // langIndonesian \u2192 smRoman\n 82: 0,\n // langTagalog \u2192 smRoman\n 83: 0,\n // langMalayRoman \u2192 smRoman\n 84: 4,\n // langMalayArabic \u2192 smArabic\n 85: 28,\n // langAmharic \u2192 smEthiopic\n 86: 28,\n // langTigrinya \u2192 smEthiopic\n 87: 28,\n // langOromo \u2192 smEthiopic\n 88: 0,\n // langSomali \u2192 smRoman\n 89: 0,\n // langSwahili \u2192 smRoman\n 90: 0,\n // langKinyarwanda \u2192 smRoman\n 91: 0,\n // langRundi \u2192 smRoman\n 92: 0,\n // langNyanja \u2192 smRoman\n 93: 0,\n // langMalagasy \u2192 smRoman\n 94: 0,\n // langEsperanto \u2192 smRoman\n 128: 0,\n // langWelsh \u2192 smRoman (modified)\n 129: 0,\n // langBasque \u2192 smRoman\n 130: 0,\n // langCatalan \u2192 smRoman\n 131: 0,\n // langLatin \u2192 smRoman\n 132: 0,\n // langQuechua \u2192 smRoman\n 133: 0,\n // langGuarani \u2192 smRoman\n 134: 0,\n // langAymara \u2192 smRoman\n 135: 7,\n // langTatar \u2192 smCyrillic\n 136: 4,\n // langUighur \u2192 smArabic\n 137: 26,\n // langDzongkha \u2192 smTibetan\n 138: 0,\n // langJavaneseRom \u2192 smRoman\n 139: 0,\n // langSundaneseRom \u2192 smRoman\n 140: 0,\n // langGalician \u2192 smRoman\n 141: 0,\n // langAfrikaans \u2192 smRoman\n 142: 0,\n // langBreton \u2192 smRoman (modified)\n 143: 28,\n // langInuktitut \u2192 smEthiopic (modified)\n 144: 0,\n // langScottishGaelic \u2192 smRoman (modified)\n 145: 0,\n // langManxGaelic \u2192 smRoman (modified)\n 146: 0,\n // langIrishGaelicScript \u2192 smRoman (modified)\n 147: 0,\n // langTongan \u2192 smRoman\n 148: 6,\n // langGreekAncient \u2192 smRoman\n 149: 0,\n // langGreenlandic \u2192 smRoman\n 150: 0,\n // langAzerbaijanRoman \u2192 smRoman\n 151: 0\n // langNynorsk \u2192 smRoman\n };\n var windowsLanguages = {\n 1078: \"af\",\n 1052: \"sq\",\n 1156: \"gsw\",\n 1118: \"am\",\n 5121: \"ar-DZ\",\n 15361: \"ar-BH\",\n 3073: \"ar\",\n 2049: \"ar-IQ\",\n 11265: \"ar-JO\",\n 13313: \"ar-KW\",\n 12289: \"ar-LB\",\n 4097: \"ar-LY\",\n 6145: \"ary\",\n 8193: \"ar-OM\",\n 16385: \"ar-QA\",\n 1025: \"ar-SA\",\n 10241: \"ar-SY\",\n 7169: \"aeb\",\n 14337: \"ar-AE\",\n 9217: \"ar-YE\",\n 1067: \"hy\",\n 1101: \"as\",\n 2092: \"az-Cyrl\",\n 1068: \"az\",\n 1133: \"ba\",\n 1069: \"eu\",\n 1059: \"be\",\n 2117: \"bn\",\n 1093: \"bn-IN\",\n 8218: \"bs-Cyrl\",\n 5146: \"bs\",\n 1150: \"br\",\n 1026: \"bg\",\n 1027: \"ca\",\n 3076: \"zh-HK\",\n 5124: \"zh-MO\",\n 2052: \"zh\",\n 4100: \"zh-SG\",\n 1028: \"zh-TW\",\n 1155: \"co\",\n 1050: \"hr\",\n 4122: \"hr-BA\",\n 1029: \"cs\",\n 1030: \"da\",\n 1164: \"prs\",\n 1125: \"dv\",\n 2067: \"nl-BE\",\n 1043: \"nl\",\n 3081: \"en-AU\",\n 10249: \"en-BZ\",\n 4105: \"en-CA\",\n 9225: \"en-029\",\n 16393: \"en-IN\",\n 6153: \"en-IE\",\n 8201: \"en-JM\",\n 17417: \"en-MY\",\n 5129: \"en-NZ\",\n 13321: \"en-PH\",\n 18441: \"en-SG\",\n 7177: \"en-ZA\",\n 11273: \"en-TT\",\n 2057: \"en-GB\",\n 1033: \"en\",\n 12297: \"en-ZW\",\n 1061: \"et\",\n 1080: \"fo\",\n 1124: \"fil\",\n 1035: \"fi\",\n 2060: \"fr-BE\",\n 3084: \"fr-CA\",\n 1036: \"fr\",\n 5132: \"fr-LU\",\n 6156: \"fr-MC\",\n 4108: \"fr-CH\",\n 1122: \"fy\",\n 1110: \"gl\",\n 1079: \"ka\",\n 3079: \"de-AT\",\n 1031: \"de\",\n 5127: \"de-LI\",\n 4103: \"de-LU\",\n 2055: \"de-CH\",\n 1032: \"el\",\n 1135: \"kl\",\n 1095: \"gu\",\n 1128: \"ha\",\n 1037: \"he\",\n 1081: \"hi\",\n 1038: \"hu\",\n 1039: \"is\",\n 1136: \"ig\",\n 1057: \"id\",\n 1117: \"iu\",\n 2141: \"iu-Latn\",\n 2108: \"ga\",\n 1076: \"xh\",\n 1077: \"zu\",\n 1040: \"it\",\n 2064: \"it-CH\",\n 1041: \"ja\",\n 1099: \"kn\",\n 1087: \"kk\",\n 1107: \"km\",\n 1158: \"quc\",\n 1159: \"rw\",\n 1089: \"sw\",\n 1111: \"kok\",\n 1042: \"ko\",\n 1088: \"ky\",\n 1108: \"lo\",\n 1062: \"lv\",\n 1063: \"lt\",\n 2094: \"dsb\",\n 1134: \"lb\",\n 1071: \"mk\",\n 2110: \"ms-BN\",\n 1086: \"ms\",\n 1100: \"ml\",\n 1082: \"mt\",\n 1153: \"mi\",\n 1146: \"arn\",\n 1102: \"mr\",\n 1148: \"moh\",\n 1104: \"mn\",\n 2128: \"mn-CN\",\n 1121: \"ne\",\n 1044: \"nb\",\n 2068: \"nn\",\n 1154: \"oc\",\n 1096: \"or\",\n 1123: \"ps\",\n 1045: \"pl\",\n 1046: \"pt\",\n 2070: \"pt-PT\",\n 1094: \"pa\",\n 1131: \"qu-BO\",\n 2155: \"qu-EC\",\n 3179: \"qu\",\n 1048: \"ro\",\n 1047: \"rm\",\n 1049: \"ru\",\n 9275: \"smn\",\n 4155: \"smj-NO\",\n 5179: \"smj\",\n 3131: \"se-FI\",\n 1083: \"se\",\n 2107: \"se-SE\",\n 8251: \"sms\",\n 6203: \"sma-NO\",\n 7227: \"sms\",\n 1103: \"sa\",\n 7194: \"sr-Cyrl-BA\",\n 3098: \"sr\",\n 6170: \"sr-Latn-BA\",\n 2074: \"sr-Latn\",\n 1132: \"nso\",\n 1074: \"tn\",\n 1115: \"si\",\n 1051: \"sk\",\n 1060: \"sl\",\n 11274: \"es-AR\",\n 16394: \"es-BO\",\n 13322: \"es-CL\",\n 9226: \"es-CO\",\n 5130: \"es-CR\",\n 7178: \"es-DO\",\n 12298: \"es-EC\",\n 17418: \"es-SV\",\n 4106: \"es-GT\",\n 18442: \"es-HN\",\n 2058: \"es-MX\",\n 19466: \"es-NI\",\n 6154: \"es-PA\",\n 15370: \"es-PY\",\n 10250: \"es-PE\",\n 20490: \"es-PR\",\n // Microsoft has defined two different language codes for\n // \u201CSpanish with modern sorting\u201D and \u201CSpanish with traditional\n // sorting\u201D. This makes sense for collation APIs, and it would be\n // possible to express this in BCP 47 language tags via Unicode\n // extensions (eg., es-u-co-trad is Spanish with traditional\n // sorting). However, for storing names in fonts, the distinction\n // does not make sense, so we give \u201Ces\u201D in both cases.\n 3082: \"es\",\n 1034: \"es\",\n 21514: \"es-US\",\n 14346: \"es-UY\",\n 8202: \"es-VE\",\n 2077: \"sv-FI\",\n 1053: \"sv\",\n 1114: \"syr\",\n 1064: \"tg\",\n 2143: \"tzm\",\n 1097: \"ta\",\n 1092: \"tt\",\n 1098: \"te\",\n 1054: \"th\",\n 1105: \"bo\",\n 1055: \"tr\",\n 1090: \"tk\",\n 1152: \"ug\",\n 1058: \"uk\",\n 1070: \"hsb\",\n 1056: \"ur\",\n 2115: \"uz-Cyrl\",\n 1091: \"uz\",\n 1066: \"vi\",\n 1106: \"cy\",\n 1160: \"wo\",\n 1157: \"sah\",\n 1144: \"ii\",\n 1130: \"yo\"\n };\n function getLanguageCode(platformID, languageID, ltag) {\n switch (platformID) {\n case 0:\n if (languageID === 65535) {\n return \"und\";\n } else if (ltag) {\n return ltag[languageID];\n }\n break;\n case 1:\n return macLanguages[languageID];\n case 3:\n return windowsLanguages[languageID];\n }\n return void 0;\n }\n var utf16 = \"utf-16\";\n var macScriptEncodings = {\n 0: \"macintosh\",\n // smRoman\n 1: \"x-mac-japanese\",\n // smJapanese\n 2: \"x-mac-chinesetrad\",\n // smTradChinese\n 3: \"x-mac-korean\",\n // smKorean\n 6: \"x-mac-greek\",\n // smGreek\n 7: \"x-mac-cyrillic\",\n // smCyrillic\n 9: \"x-mac-devanagai\",\n // smDevanagari\n 10: \"x-mac-gurmukhi\",\n // smGurmukhi\n 11: \"x-mac-gujarati\",\n // smGujarati\n 12: \"x-mac-oriya\",\n // smOriya\n 13: \"x-mac-bengali\",\n // smBengali\n 14: \"x-mac-tamil\",\n // smTamil\n 15: \"x-mac-telugu\",\n // smTelugu\n 16: \"x-mac-kannada\",\n // smKannada\n 17: \"x-mac-malayalam\",\n // smMalayalam\n 18: \"x-mac-sinhalese\",\n // smSinhalese\n 19: \"x-mac-burmese\",\n // smBurmese\n 20: \"x-mac-khmer\",\n // smKhmer\n 21: \"x-mac-thai\",\n // smThai\n 22: \"x-mac-lao\",\n // smLao\n 23: \"x-mac-georgian\",\n // smGeorgian\n 24: \"x-mac-armenian\",\n // smArmenian\n 25: \"x-mac-chinesesimp\",\n // smSimpChinese\n 26: \"x-mac-tibetan\",\n // smTibetan\n 27: \"x-mac-mongolian\",\n // smMongolian\n 28: \"x-mac-ethiopic\",\n // smEthiopic\n 29: \"x-mac-ce\",\n // smCentralEuroRoman\n 30: \"x-mac-vietnamese\",\n // smVietnamese\n 31: \"x-mac-extarabic\"\n // smExtArabic\n };\n var macLanguageEncodings = {\n 15: \"x-mac-icelandic\",\n // langIcelandic\n 17: \"x-mac-turkish\",\n // langTurkish\n 18: \"x-mac-croatian\",\n // langCroatian\n 24: \"x-mac-ce\",\n // langLithuanian\n 25: \"x-mac-ce\",\n // langPolish\n 26: \"x-mac-ce\",\n // langHungarian\n 27: \"x-mac-ce\",\n // langEstonian\n 28: \"x-mac-ce\",\n // langLatvian\n 30: \"x-mac-icelandic\",\n // langFaroese\n 37: \"x-mac-romanian\",\n // langRomanian\n 38: \"x-mac-ce\",\n // langCzech\n 39: \"x-mac-ce\",\n // langSlovak\n 40: \"x-mac-ce\",\n // langSlovenian\n 143: \"x-mac-inuit\",\n // langInuktitut\n 146: \"x-mac-gaelic\"\n // langIrishGaelicScript\n };\n function getEncoding(platformID, encodingID, languageID) {\n switch (platformID) {\n case 0:\n return utf16;\n case 1:\n return macLanguageEncodings[languageID] || macScriptEncodings[encodingID];\n case 3:\n if (encodingID === 1 || encodingID === 10) {\n return utf16;\n }\n break;\n }\n return void 0;\n }\n var platforms = {\n 0: \"unicode\",\n 1: \"macintosh\",\n 2: \"reserved\",\n 3: \"windows\"\n };\n function getPlatform(platformID) {\n return platforms[platformID];\n }\n function parseNameTable(data, start, ltag) {\n const name = {};\n const p = new parse_default.Parser(data, start);\n const format = p.parseUShort();\n const count = p.parseUShort();\n const stringOffset = p.offset + p.parseUShort();\n for (let i = 0; i < count; i++) {\n const platformID = p.parseUShort();\n const encodingID = p.parseUShort();\n const languageID = p.parseUShort();\n const nameID = p.parseUShort();\n const property = nameTableNames[nameID] || nameID;\n const byteLength = p.parseUShort();\n const offset = p.parseUShort();\n const language = getLanguageCode(platformID, languageID, ltag);\n const encoding = getEncoding(platformID, encodingID, languageID);\n const platformName = getPlatform(platformID);\n if (encoding !== void 0 && language !== void 0 && platformName !== void 0) {\n let text;\n if (encoding === utf16) {\n text = decode.UTF16(data, stringOffset + offset, byteLength);\n } else {\n text = decode.MACSTRING(data, stringOffset + offset, byteLength, encoding);\n }\n if (text) {\n let platform = name[platformName];\n if (platform === void 0) {\n platform = name[platformName] = {};\n }\n let translations = platform[property];\n if (translations === void 0) {\n translations = platform[property] = {};\n }\n translations[language] = text;\n }\n }\n }\n if (format === 1) {\n p.parseUShort();\n }\n return name;\n }\n function reverseDict(dict) {\n const result = {};\n for (let key in dict) {\n result[dict[key]] = parseInt(key);\n }\n return result;\n }\n function makeNameRecord(platformID, encodingID, languageID, nameID, length, offset) {\n return new table_default.Record(\"NameRecord\", [\n { name: \"platformID\", type: \"USHORT\", value: platformID },\n { name: \"encodingID\", type: \"USHORT\", value: encodingID },\n { name: \"languageID\", type: \"USHORT\", value: languageID },\n { name: \"nameID\", type: \"USHORT\", value: nameID },\n { name: \"length\", type: \"USHORT\", value: length },\n { name: \"offset\", type: \"USHORT\", value: offset }\n ]);\n }\n function findSubArray(needle, haystack) {\n const needleLength = needle.length;\n const limit = haystack.length - needleLength + 1;\n loop:\n for (let pos = 0; pos < limit; pos++) {\n for (; pos < limit; pos++) {\n for (let k = 0; k < needleLength; k++) {\n if (haystack[pos + k] !== needle[k]) {\n continue loop;\n }\n }\n return pos;\n }\n }\n return -1;\n }\n function addStringToPool(s, pool) {\n let offset = findSubArray(s, pool);\n if (offset < 0) {\n offset = pool.length;\n let i = 0;\n const len = s.length;\n for (; i < len; ++i) {\n pool.push(s[i]);\n }\n }\n return offset;\n }\n function makeNameTable(names, ltag) {\n const platformNameIds = reverseDict(platforms);\n const macLanguageIds = reverseDict(macLanguages);\n const windowsLanguageIds = reverseDict(windowsLanguages);\n const nameRecords = [];\n const stringPool = [];\n for (let platform in names) {\n let nameID;\n const nameIDs = [];\n const namesWithNumericKeys = {};\n const nameTableIds = reverseDict(nameTableNames);\n const platformID = platformNameIds[platform];\n for (let key in names[platform]) {\n let id = nameTableIds[key];\n if (id === void 0) {\n id = key;\n }\n nameID = parseInt(id);\n if (isNaN(nameID)) {\n throw new Error('Name table entry \"' + key + '\" does not exist, see nameTableNames for complete list.');\n }\n namesWithNumericKeys[nameID] = names[platform][key];\n nameIDs.push(nameID);\n }\n for (let i = 0; i < nameIDs.length; i++) {\n nameID = nameIDs[i];\n const translations = namesWithNumericKeys[nameID];\n for (let lang in translations) {\n const text = translations[lang];\n if (platformID === 1 || platformID === 0) {\n let macLanguage = macLanguageIds[lang];\n let macScript = macLanguageToScript[macLanguage];\n const macEncoding = getEncoding(platformID, macScript, macLanguage);\n let macName = encode.MACSTRING(text, macEncoding);\n if (platformID === 0) {\n macLanguage = ltag.indexOf(lang);\n if (macLanguage < 0) {\n macLanguage = ltag.length;\n ltag.push(lang);\n }\n macScript = 4;\n macName = encode.UTF16(text);\n }\n if (macName !== void 0) {\n const macNameOffset = addStringToPool(macName, stringPool);\n nameRecords.push(makeNameRecord(\n platformID,\n macScript,\n macLanguage,\n nameID,\n macName.length,\n macNameOffset\n ));\n }\n }\n if (platformID === 3) {\n const winLanguage = windowsLanguageIds[lang];\n if (winLanguage !== void 0) {\n const winName = encode.UTF16(text);\n const winNameOffset = addStringToPool(winName, stringPool);\n nameRecords.push(makeNameRecord(\n 3,\n 1,\n winLanguage,\n nameID,\n winName.length,\n winNameOffset\n ));\n }\n }\n }\n }\n }\n nameRecords.sort(function(a, b) {\n return a.platformID - b.platformID || a.encodingID - b.encodingID || a.languageID - b.languageID || a.nameID - b.nameID;\n });\n const t = new table_default.Table(\"name\", [\n { name: \"format\", type: \"USHORT\", value: 0 },\n { name: \"count\", type: \"USHORT\", value: nameRecords.length },\n { name: \"stringOffset\", type: \"USHORT\", value: 6 + nameRecords.length * 12 }\n ]);\n for (let r = 0; r < nameRecords.length; r++) {\n t.fields.push({ name: \"record_\" + r, type: \"RECORD\", value: nameRecords[r] });\n }\n t.fields.push({ name: \"strings\", type: \"LITERAL\", value: stringPool });\n return t;\n }\n function getNameByID(names, nameID, allowedStandardIDs = []) {\n if (nameID < 256 && nameID in nameTableNames) {\n if (allowedStandardIDs.length && !allowedStandardIDs.includes(parseInt(nameID))) {\n return void 0;\n }\n nameID = nameTableNames[nameID];\n }\n for (let platform in names) {\n for (let nameKey in names[platform]) {\n if (nameKey === nameID || parseInt(nameKey) === nameID) {\n return names[platform][nameKey];\n }\n }\n }\n return void 0;\n }\n var name_default = { parse: parseNameTable, make: makeNameTable, getNameByID };\n\n // src/tables/cmap.mjs\n function parseCmapTableFormat0(cmap, p, platformID, encodingID) {\n cmap.length = p.parseUShort();\n cmap.language = p.parseUShort() - 1;\n const indexMap = p.parseByteList(cmap.length);\n const glyphIndexMap = Object.assign({}, indexMap);\n const encoding = getEncoding(platformID, encodingID, cmap.language);\n const decodingTable = eightBitMacEncodings[encoding];\n for (let i = 0; i < decodingTable.length; i++) {\n glyphIndexMap[decodingTable.charCodeAt(i)] = indexMap[128 + i];\n }\n cmap.glyphIndexMap = glyphIndexMap;\n }\n function parseCmapTableFormat12or13(cmap, p, format) {\n p.parseUShort();\n cmap.length = p.parseULong();\n cmap.language = p.parseULong();\n let groupCount;\n cmap.groupCount = groupCount = p.parseULong();\n cmap.glyphIndexMap = {};\n for (let i = 0; i < groupCount; i += 1) {\n const startCharCode = p.parseULong();\n const endCharCode = p.parseULong();\n let startGlyphId = p.parseULong();\n for (let c = startCharCode; c <= endCharCode; c += 1) {\n cmap.glyphIndexMap[c] = startGlyphId;\n if (format === 12) {\n startGlyphId++;\n }\n }\n }\n }\n function parseCmapTableFormat4(cmap, p, data, start, offset) {\n cmap.length = p.parseUShort();\n cmap.language = p.parseUShort();\n let segCount;\n cmap.segCount = segCount = p.parseUShort() >> 1;\n p.skip(\"uShort\", 3);\n cmap.glyphIndexMap = {};\n const endCountParser = new parse_default.Parser(data, start + offset + 14);\n const startCountParser = new parse_default.Parser(data, start + offset + 16 + segCount * 2);\n const idDeltaParser = new parse_default.Parser(data, start + offset + 16 + segCount * 4);\n const idRangeOffsetParser = new parse_default.Parser(data, start + offset + 16 + segCount * 6);\n let glyphIndexOffset = start + offset + 16 + segCount * 8;\n for (let i = 0; i < segCount - 1; i += 1) {\n let glyphIndex;\n const endCount = endCountParser.parseUShort();\n const startCount = startCountParser.parseUShort();\n const idDelta = idDeltaParser.parseShort();\n const idRangeOffset = idRangeOffsetParser.parseUShort();\n for (let c = startCount; c <= endCount; c += 1) {\n if (idRangeOffset !== 0) {\n glyphIndexOffset = idRangeOffsetParser.offset + idRangeOffsetParser.relativeOffset - 2;\n glyphIndexOffset += idRangeOffset;\n glyphIndexOffset += (c - startCount) * 2;\n glyphIndex = parse_default.getUShort(data, glyphIndexOffset);\n if (glyphIndex !== 0) {\n glyphIndex = glyphIndex + idDelta & 65535;\n }\n } else {\n glyphIndex = c + idDelta & 65535;\n }\n cmap.glyphIndexMap[c] = glyphIndex;\n }\n }\n }\n function parseCmapTableFormat14(cmap, p) {\n const varSelectorList = {};\n p.skip(\"uLong\");\n const numVarSelectorRecords = p.parseULong();\n for (let i = 0; i < numVarSelectorRecords; i += 1) {\n const varSelector = p.parseUInt24();\n const varSelectorRecord = {\n varSelector\n };\n const defaultUVSOffset = p.parseOffset32();\n const nonDefaultUVSOffset = p.parseOffset32();\n const currentOffset = p.relativeOffset;\n if (defaultUVSOffset) {\n p.relativeOffset = defaultUVSOffset;\n varSelectorRecord.defaultUVS = p.parseStruct({\n ranges: function() {\n return p.parseRecordList32({\n startUnicodeValue: p.parseUInt24,\n additionalCount: p.parseByte\n });\n }\n });\n }\n if (nonDefaultUVSOffset) {\n p.relativeOffset = nonDefaultUVSOffset;\n varSelectorRecord.nonDefaultUVS = p.parseStruct({\n uvsMappings: function() {\n const map = {};\n const list = p.parseRecordList32({\n unicodeValue: p.parseUInt24,\n glyphID: p.parseUShort\n });\n for (let i2 = 0; i2 < list.length; i2 += 1) {\n map[list[i2].unicodeValue] = list[i2];\n }\n return map;\n }\n });\n }\n varSelectorList[varSelector] = varSelectorRecord;\n p.relativeOffset = currentOffset;\n }\n cmap.varSelectorList = varSelectorList;\n }\n function parseCmapTable(data, start) {\n const cmap = {};\n cmap.version = parse_default.getUShort(data, start);\n check_default.argument(cmap.version === 0, \"cmap table version should be 0.\");\n cmap.numTables = parse_default.getUShort(data, start + 2);\n let format14Parser = null;\n let format14offset = -1;\n let offset = -1;\n let platformId = null;\n let encodingId = null;\n const platform0Encodings = [0, 1, 2, 3, 4, 6];\n const platform3Encodings = [0, 1, 10];\n for (let i = cmap.numTables - 1; i >= 0; i -= 1) {\n platformId = parse_default.getUShort(data, start + 4 + i * 8);\n encodingId = parse_default.getUShort(data, start + 4 + i * 8 + 2);\n if (platformId === 3 && platform3Encodings.includes(encodingId) || platformId === 0 && platform0Encodings.includes(encodingId) || platformId === 1 && encodingId === 0) {\n if (offset > 0) continue;\n offset = parse_default.getULong(data, start + 4 + i * 8 + 4);\n if (format14Parser) {\n break;\n }\n } else if (platformId === 0 && encodingId === 5) {\n format14offset = parse_default.getULong(data, start + 4 + i * 8 + 4);\n format14Parser = new parse_default.Parser(data, start + format14offset);\n if (format14Parser.parseUShort() !== 14) {\n format14offset = -1;\n format14Parser = null;\n } else if (offset > 0) {\n break;\n }\n }\n }\n if (offset === -1) {\n throw new Error(\"No valid cmap sub-tables found.\");\n }\n const p = new parse_default.Parser(data, start + offset);\n cmap.format = p.parseUShort();\n if (cmap.format === 0) {\n parseCmapTableFormat0(cmap, p, platformId, encodingId);\n } else if (cmap.format === 12 || cmap.format === 13) {\n parseCmapTableFormat12or13(cmap, p, cmap.format);\n } else if (cmap.format === 4) {\n parseCmapTableFormat4(cmap, p, data, start, offset);\n } else {\n throw new Error(\n \"Only format 0 (platformId 1, encodingId 0), 4, 12 and 14 cmap tables are supported (found format \" + cmap.format + \", platformId \" + platformId + \", encodingId \" + encodingId + \").\"\n );\n }\n if (format14Parser) {\n parseCmapTableFormat14(cmap, format14Parser);\n }\n return cmap;\n }\n function addSegment(t, code, glyphIndex) {\n t.segments.push({\n end: code,\n start: code,\n delta: -(code - glyphIndex),\n offset: 0,\n glyphIndex\n });\n }\n function addTerminatorSegment(t) {\n t.segments.push({\n end: 65535,\n start: 65535,\n delta: 1,\n offset: 0\n });\n }\n function mergeSegments(segments) {\n if (segments.length === 0) return segments;\n const merged = [segments[0]];\n for (let i = 1; i < segments.length; i++) {\n const prev = merged[merged.length - 1];\n const curr = segments[i];\n if (prev.end + 1 === curr.start && prev.delta === curr.delta && curr.end !== 65535) {\n prev.end = curr.end;\n } else {\n merged.push(curr);\n }\n }\n return merged;\n }\n function makeCmapTable(glyphs) {\n let isPlan0Only = true;\n let i;\n for (i = glyphs.length - 1; i > 0; i -= 1) {\n const g = glyphs.get(i);\n if (g.unicode > 65535) {\n isPlan0Only = false;\n break;\n }\n }\n let cmapTable = [\n { name: \"version\", type: \"USHORT\", value: 0 },\n { name: \"numTables\", type: \"USHORT\", value: isPlan0Only ? 1 : 2 },\n // CMAP 4 header\n { name: \"platformID\", type: \"USHORT\", value: 3 },\n { name: \"encodingID\", type: \"USHORT\", value: 1 },\n { name: \"offset\", type: \"ULONG\", value: isPlan0Only ? 12 : 12 + 8 }\n ];\n if (!isPlan0Only)\n cmapTable.push(...[\n // CMAP 12 header\n { name: \"cmap12PlatformID\", type: \"USHORT\", value: 3 },\n // We encode only for PlatformID = 3 (Windows) because it is supported everywhere\n { name: \"cmap12EncodingID\", type: \"USHORT\", value: 10 },\n { name: \"cmap12Offset\", type: \"ULONG\", value: 0 }\n ]);\n cmapTable.push(...[\n // CMAP 4 Subtable\n { name: \"format\", type: \"USHORT\", value: 4 },\n { name: \"cmap4Length\", type: \"USHORT\", value: 0 },\n { name: \"language\", type: \"USHORT\", value: 0 },\n { name: \"segCountX2\", type: \"USHORT\", value: 0 },\n { name: \"searchRange\", type: \"USHORT\", value: 0 },\n { name: \"entrySelector\", type: \"USHORT\", value: 0 },\n { name: \"rangeShift\", type: \"USHORT\", value: 0 }\n ]);\n const t = new table_default.Table(\"cmap\", cmapTable);\n t.segments = [];\n for (i = 0; i < glyphs.length; i += 1) {\n const glyph = glyphs.get(i);\n for (let j = 0; j < glyph.unicodes.length; j += 1) {\n addSegment(t, glyph.unicodes[j], i);\n }\n }\n t.segments.sort(function(a, b) {\n return a.start - b.start;\n });\n t.segments = mergeSegments(t.segments);\n addTerminatorSegment(t);\n const segCount = t.segments.length;\n let segCountToRemove = 0;\n let endCounts = [];\n let startCounts = [];\n let idDeltas = [];\n let idRangeOffsets = [];\n let glyphIds = [];\n let cmap12Groups = [];\n for (i = 0; i < segCount; i += 1) {\n const segment = t.segments[i];\n if (segment.end <= 65535 && segment.start <= 65535) {\n endCounts.push({ name: \"end_\" + i, type: \"USHORT\", value: segment.end });\n startCounts.push({ name: \"start_\" + i, type: \"USHORT\", value: segment.start });\n idDeltas.push({ name: \"idDelta_\" + i, type: \"SHORT\", value: segment.delta });\n idRangeOffsets.push({ name: \"idRangeOffset_\" + i, type: \"USHORT\", value: segment.offset });\n if (segment.glyphId !== void 0) {\n glyphIds.push({ name: \"glyph_\" + i, type: \"USHORT\", value: segment.glyphId });\n }\n } else {\n segCountToRemove += 1;\n }\n if (!isPlan0Only && segment.glyphIndex !== void 0) {\n cmap12Groups.push({ name: \"cmap12Start_\" + i, type: \"ULONG\", value: segment.start });\n cmap12Groups.push({ name: \"cmap12End_\" + i, type: \"ULONG\", value: segment.end });\n cmap12Groups.push({ name: \"cmap12Glyph_\" + i, type: \"ULONG\", value: segment.glyphIndex });\n }\n }\n t.segCountX2 = (segCount - segCountToRemove) * 2;\n t.searchRange = Math.pow(2, Math.floor(Math.log(segCount - segCountToRemove) / Math.log(2))) * 2;\n t.entrySelector = Math.log(t.searchRange / 2) / Math.log(2);\n t.rangeShift = t.segCountX2 - t.searchRange;\n for (let i2 = 0; i2 < endCounts.length; i2++) {\n t.fields.push(endCounts[i2]);\n }\n t.fields.push({ name: \"reservedPad\", type: \"USHORT\", value: 0 });\n for (let i2 = 0; i2 < startCounts.length; i2++) {\n t.fields.push(startCounts[i2]);\n }\n for (let i2 = 0; i2 < idDeltas.length; i2++) {\n t.fields.push(idDeltas[i2]);\n }\n for (let i2 = 0; i2 < idRangeOffsets.length; i2++) {\n t.fields.push(idRangeOffsets[i2]);\n }\n for (let i2 = 0; i2 < glyphIds.length; i2++) {\n t.fields.push(glyphIds[i2]);\n }\n t.cmap4Length = 14 + // Subtable header\n endCounts.length * 2 + 2 + // reservedPad\n startCounts.length * 2 + idDeltas.length * 2 + idRangeOffsets.length * 2 + glyphIds.length * 2;\n if (!isPlan0Only) {\n const cmap12Length = 16 + // Subtable header\n cmap12Groups.length * 4;\n t.cmap12Offset = 12 + 2 * 2 + 4 + t.cmap4Length;\n t.fields.push(...[\n { name: \"cmap12Format\", type: \"USHORT\", value: 12 },\n { name: \"cmap12Reserved\", type: \"USHORT\", value: 0 },\n { name: \"cmap12Length\", type: \"ULONG\", value: cmap12Length },\n { name: \"cmap12Language\", type: \"ULONG\", value: 0 },\n { name: \"cmap12nGroups\", type: \"ULONG\", value: cmap12Groups.length / 3 }\n ]);\n for (let i2 = 0; i2 < cmap12Groups.length; i2++) {\n t.fields.push(cmap12Groups[i2]);\n }\n }\n return t;\n }\n var cmap_default = { parse: parseCmapTable, make: makeCmapTable };\n\n // src/encoding.mjs\n var cffStandardStrings = [\n \".notdef\",\n \"space\",\n \"exclam\",\n \"quotedbl\",\n \"numbersign\",\n \"dollar\",\n \"percent\",\n \"ampersand\",\n \"quoteright\",\n \"parenleft\",\n \"parenright\",\n \"asterisk\",\n \"plus\",\n \"comma\",\n \"hyphen\",\n \"period\",\n \"slash\",\n \"zero\",\n \"one\",\n \"two\",\n \"three\",\n \"four\",\n \"five\",\n \"six\",\n \"seven\",\n \"eight\",\n \"nine\",\n \"colon\",\n \"semicolon\",\n \"less\",\n \"equal\",\n \"greater\",\n \"question\",\n \"at\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n \"G\",\n \"H\",\n \"I\",\n \"J\",\n \"K\",\n \"L\",\n \"M\",\n \"N\",\n \"O\",\n \"P\",\n \"Q\",\n \"R\",\n \"S\",\n \"T\",\n \"U\",\n \"V\",\n \"W\",\n \"X\",\n \"Y\",\n \"Z\",\n \"bracketleft\",\n \"backslash\",\n \"bracketright\",\n \"asciicircum\",\n \"underscore\",\n \"quoteleft\",\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\",\n \"f\",\n \"g\",\n \"h\",\n \"i\",\n \"j\",\n \"k\",\n \"l\",\n \"m\",\n \"n\",\n \"o\",\n \"p\",\n \"q\",\n \"r\",\n \"s\",\n \"t\",\n \"u\",\n \"v\",\n \"w\",\n \"x\",\n \"y\",\n \"z\",\n \"braceleft\",\n \"bar\",\n \"braceright\",\n \"asciitilde\",\n \"exclamdown\",\n \"cent\",\n \"sterling\",\n \"fraction\",\n \"yen\",\n \"florin\",\n \"section\",\n \"currency\",\n \"quotesingle\",\n \"quotedblleft\",\n \"guillemotleft\",\n \"guilsinglleft\",\n \"guilsinglright\",\n \"fi\",\n \"fl\",\n \"endash\",\n \"dagger\",\n \"daggerdbl\",\n \"periodcentered\",\n \"paragraph\",\n \"bullet\",\n \"quotesinglbase\",\n \"quotedblbase\",\n \"quotedblright\",\n \"guillemotright\",\n \"ellipsis\",\n \"perthousand\",\n \"questiondown\",\n \"grave\",\n \"acute\",\n \"circumflex\",\n \"tilde\",\n \"macron\",\n \"breve\",\n \"dotaccent\",\n \"dieresis\",\n \"ring\",\n \"cedilla\",\n \"hungarumlaut\",\n \"ogonek\",\n \"caron\",\n \"emdash\",\n \"AE\",\n \"ordfeminine\",\n \"Lslash\",\n \"Oslash\",\n \"OE\",\n \"ordmasculine\",\n \"ae\",\n \"dotlessi\",\n \"lslash\",\n \"oslash\",\n \"oe\",\n \"germandbls\",\n \"onesuperior\",\n \"logicalnot\",\n \"mu\",\n \"trademark\",\n \"Eth\",\n \"onehalf\",\n \"plusminus\",\n \"Thorn\",\n \"onequarter\",\n \"divide\",\n \"brokenbar\",\n \"degree\",\n \"thorn\",\n \"threequarters\",\n \"twosuperior\",\n \"registered\",\n \"minus\",\n \"eth\",\n \"multiply\",\n \"threesuperior\",\n \"copyright\",\n \"Aacute\",\n \"Acircumflex\",\n \"Adieresis\",\n \"Agrave\",\n \"Aring\",\n \"Atilde\",\n \"Ccedilla\",\n \"Eacute\",\n \"Ecircumflex\",\n \"Edieresis\",\n \"Egrave\",\n \"Iacute\",\n \"Icircumflex\",\n \"Idieresis\",\n \"Igrave\",\n \"Ntilde\",\n \"Oacute\",\n \"Ocircumflex\",\n \"Odieresis\",\n \"Ograve\",\n \"Otilde\",\n \"Scaron\",\n \"Uacute\",\n \"Ucircumflex\",\n \"Udieresis\",\n \"Ugrave\",\n \"Yacute\",\n \"Ydieresis\",\n \"Zcaron\",\n \"aacute\",\n \"acircumflex\",\n \"adieresis\",\n \"agrave\",\n \"aring\",\n \"atilde\",\n \"ccedilla\",\n \"eacute\",\n \"ecircumflex\",\n \"edieresis\",\n \"egrave\",\n \"iacute\",\n \"icircumflex\",\n \"idieresis\",\n \"igrave\",\n \"ntilde\",\n \"oacute\",\n \"ocircumflex\",\n \"odieresis\",\n \"ograve\",\n \"otilde\",\n \"scaron\",\n \"uacute\",\n \"ucircumflex\",\n \"udieresis\",\n \"ugrave\",\n \"yacute\",\n \"ydieresis\",\n \"zcaron\",\n \"exclamsmall\",\n \"Hungarumlautsmall\",\n \"dollaroldstyle\",\n \"dollarsuperior\",\n \"ampersandsmall\",\n \"Acutesmall\",\n \"parenleftsuperior\",\n \"parenrightsuperior\",\n \"266 ff\",\n \"onedotenleader\",\n \"zerooldstyle\",\n \"oneoldstyle\",\n \"twooldstyle\",\n \"threeoldstyle\",\n \"fouroldstyle\",\n \"fiveoldstyle\",\n \"sixoldstyle\",\n \"sevenoldstyle\",\n \"eightoldstyle\",\n \"nineoldstyle\",\n \"commasuperior\",\n \"threequartersemdash\",\n \"periodsuperior\",\n \"questionsmall\",\n \"asuperior\",\n \"bsuperior\",\n \"centsuperior\",\n \"dsuperior\",\n \"esuperior\",\n \"isuperior\",\n \"lsuperior\",\n \"msuperior\",\n \"nsuperior\",\n \"osuperior\",\n \"rsuperior\",\n \"ssuperior\",\n \"tsuperior\",\n \"ff\",\n \"ffi\",\n \"ffl\",\n \"parenleftinferior\",\n \"parenrightinferior\",\n \"Circumflexsmall\",\n \"hyphensuperior\",\n \"Gravesmall\",\n \"Asmall\",\n \"Bsmall\",\n \"Csmall\",\n \"Dsmall\",\n \"Esmall\",\n \"Fsmall\",\n \"Gsmall\",\n \"Hsmall\",\n \"Ismall\",\n \"Jsmall\",\n \"Ksmall\",\n \"Lsmall\",\n \"Msmall\",\n \"Nsmall\",\n \"Osmall\",\n \"Psmall\",\n \"Qsmall\",\n \"Rsmall\",\n \"Ssmall\",\n \"Tsmall\",\n \"Usmall\",\n \"Vsmall\",\n \"Wsmall\",\n \"Xsmall\",\n \"Ysmall\",\n \"Zsmall\",\n \"colonmonetary\",\n \"onefitted\",\n \"rupiah\",\n \"Tildesmall\",\n \"exclamdownsmall\",\n \"centoldstyle\",\n \"Lslashsmall\",\n \"Scaronsmall\",\n \"Zcaronsmall\",\n \"Dieresissmall\",\n \"Brevesmall\",\n \"Caronsmall\",\n \"Dotaccentsmall\",\n \"Macronsmall\",\n \"figuredash\",\n \"hypheninferior\",\n \"Ogoneksmall\",\n \"Ringsmall\",\n \"Cedillasmall\",\n \"questiondownsmall\",\n \"oneeighth\",\n \"threeeighths\",\n \"fiveeighths\",\n \"seveneighths\",\n \"onethird\",\n \"twothirds\",\n \"zerosuperior\",\n \"foursuperior\",\n \"fivesuperior\",\n \"sixsuperior\",\n \"sevensuperior\",\n \"eightsuperior\",\n \"ninesuperior\",\n \"zeroinferior\",\n \"oneinferior\",\n \"twoinferior\",\n \"threeinferior\",\n \"fourinferior\",\n \"fiveinferior\",\n \"sixinferior\",\n \"seveninferior\",\n \"eightinferior\",\n \"nineinferior\",\n \"centinferior\",\n \"dollarinferior\",\n \"periodinferior\",\n \"commainferior\",\n \"Agravesmall\",\n \"Aacutesmall\",\n \"Acircumflexsmall\",\n \"Atildesmall\",\n \"Adieresissmall\",\n \"Aringsmall\",\n \"AEsmall\",\n \"Ccedillasmall\",\n \"Egravesmall\",\n \"Eacutesmall\",\n \"Ecircumflexsmall\",\n \"Edieresissmall\",\n \"Igravesmall\",\n \"Iacutesmall\",\n \"Icircumflexsmall\",\n \"Idieresissmall\",\n \"Ethsmall\",\n \"Ntildesmall\",\n \"Ogravesmall\",\n \"Oacutesmall\",\n \"Ocircumflexsmall\",\n \"Otildesmall\",\n \"Odieresissmall\",\n \"OEsmall\",\n \"Oslashsmall\",\n \"Ugravesmall\",\n \"Uacutesmall\",\n \"Ucircumflexsmall\",\n \"Udieresissmall\",\n \"Yacutesmall\",\n \"Thornsmall\",\n \"Ydieresissmall\",\n \"001.000\",\n \"001.001\",\n \"001.002\",\n \"001.003\",\n \"Black\",\n \"Bold\",\n \"Book\",\n \"Light\",\n \"Medium\",\n \"Regular\",\n \"Roman\",\n \"Semibold\"\n ];\n var cffISOAdobeStrings = [\n \".notdef\",\n \"space\",\n \"exclam\",\n \"quotedbl\",\n \"numbersign\",\n \"dollar\",\n \"percent\",\n \"ampersand\",\n \"quoteright\",\n \"parenleft\",\n \"parenright\",\n \"asterisk\",\n \"plus\",\n \"comma\",\n \"hyphen\",\n \"period\",\n \"slash\",\n \"zero\",\n \"one\",\n \"two\",\n \"three\",\n \"four\",\n \"five\",\n \"six\",\n \"seven\",\n \"eight\",\n \"nine\",\n \"colon\",\n \"semicolon\",\n \"less\",\n \"equal\",\n \"greater\",\n \"question\",\n \"at\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n \"G\",\n \"H\",\n \"I\",\n \"J\",\n \"K\",\n \"L\",\n \"M\",\n \"N\",\n \"O\",\n \"P\",\n \"Q\",\n \"R\",\n \"S\",\n \"T\",\n \"U\",\n \"V\",\n \"W\",\n \"X\",\n \"Y\",\n \"Z\",\n \"bracketleft\",\n \"backslash\",\n \"bracketright\",\n \"asciicircum\",\n \"underscore\",\n \"quoteleft\",\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\",\n \"f\",\n \"g\",\n \"h\",\n \"i\",\n \"j\",\n \"k\",\n \"l\",\n \"m\",\n \"n\",\n \"o\",\n \"p\",\n \"q\",\n \"r\",\n \"s\",\n \"t\",\n \"u\",\n \"v\",\n \"w\",\n \"x\",\n \"y\",\n \"z\",\n \"braceleft\",\n \"bar\",\n \"braceright\",\n \"asciitilde\",\n \"exclamdown\",\n \"cent\",\n \"sterling\",\n \"fraction\",\n \"yen\",\n \"florin\",\n \"section\",\n \"currency\",\n \"quotesingle\",\n \"quotedblleft\",\n \"guillemotleft\",\n \"guilsinglleft\",\n \"guilsinglright\",\n \"fi\",\n \"fl\",\n \"endash\",\n \"dagger\",\n \"daggerdbl\",\n \"periodcentered\",\n \"paragraph\",\n \"bullet\",\n \"quotesinglbase\",\n \"quotedblbase\",\n \"quotedblright\",\n \"guillemotright\",\n \"ellipsis\",\n \"perthousand\",\n \"questiondown\",\n \"grave\",\n \"acute\",\n \"circumflex\",\n \"tilde\",\n \"macron\",\n \"breve\",\n \"dotaccent\",\n \"dieresis\",\n \"ring\",\n \"cedilla\",\n \"hungarumlaut\",\n \"ogonek\",\n \"caron\",\n \"emdash\",\n \"AE\",\n \"ordfeminine\",\n \"Lslash\",\n \"Oslash\",\n \"OE\",\n \"ordmasculine\",\n \"ae\",\n \"dotlessi\",\n \"lslash\",\n \"oslash\",\n \"oe\",\n \"germandbls\",\n \"onesuperior\",\n \"logicalnot\",\n \"mu\",\n \"trademark\",\n \"Eth\",\n \"onehalf\",\n \"plusminus\",\n \"Thorn\",\n \"onequarter\",\n \"divide\",\n \"brokenbar\",\n \"degree\",\n \"thorn\",\n \"threequarters\",\n \"twosuperior\",\n \"registered\",\n \"minus\",\n \"eth\",\n \"multiply\",\n \"threesuperior\",\n \"copyright\",\n \"Aacute\",\n \"Acircumflex\",\n \"Adieresis\",\n \"Agrave\",\n \"Aring\",\n \"Atilde\",\n \"Ccedilla\",\n \"Eacute\",\n \"Ecircumflex\",\n \"Edieresis\",\n \"Egrave\",\n \"Iacute\",\n \"Icircumflex\",\n \"Idieresis\",\n \"Igrave\",\n \"Ntilde\",\n \"Oacute\",\n \"Ocircumflex\",\n \"Odieresis\",\n \"Ograve\",\n \"Otilde\",\n \"Scaron\",\n \"Uacute\",\n \"Ucircumflex\",\n \"Udieresis\",\n \"Ugrave\",\n \"Yacute\",\n \"Ydieresis\",\n \"Zcaron\",\n \"aacute\",\n \"acircumflex\",\n \"adieresis\",\n \"agrave\",\n \"aring\",\n \"atilde\",\n \"ccedilla\",\n \"eacute\",\n \"ecircumflex\",\n \"edieresis\",\n \"egrave\",\n \"iacute\",\n \"icircumflex\",\n \"idieresis\",\n \"igrave\",\n \"ntilde\",\n \"oacute\",\n \"ocircumflex\",\n \"odieresis\",\n \"ograve\",\n \"otilde\",\n \"scaron\",\n \"uacute\",\n \"ucircumflex\",\n \"udieresis\",\n \"ugrave\",\n \"yacute\",\n \"ydieresis\",\n \"zcaron\"\n ];\n var cffIExpertStrings = [\n \".notdef\",\n \"space\",\n \"exclamsmall\",\n \"Hungarumlautsmall\",\n \"dollaroldstyle\",\n \"dollarsuperior\",\n \"ampersandsmall\",\n \"Acutesmall\",\n \"parenleftsuperior\",\n \"parenrightsuperior\",\n \"twodotenleader\",\n \"onedotenleader\",\n \"comma\",\n \"hyphen\",\n \"period\",\n \"fraction\",\n \"zerooldstyle\",\n \"oneoldstyle\",\n \"twooldstyle\",\n \"threeoldstyle\",\n \"fouroldstyle\",\n \"fiveoldstyle\",\n \"sixoldstyle\",\n \"sevenoldstyle\",\n \"eightoldstyle\",\n \"nineoldstyle\",\n \"colon\",\n \"semicolon\",\n \"commasuperior\",\n \"threequartersemdash\",\n \"periodsuperior\",\n \"questionsmall\",\n \"asuperior\",\n \"bsuperior\",\n \"centsuperior\",\n \"dsuperior\",\n \"esuperior\",\n \"isuperior\",\n \"lsuperior\",\n \"msuperior\",\n \"nsuperior\",\n \"osuperior\",\n \"rsuperior\",\n \"ssuperior\",\n \"tsuperior\",\n \"ff\",\n \"fi\",\n \"fl\",\n \"ffi\",\n \"ffl\",\n \"parenleftinferior\",\n \"parenrightinferior\",\n \"Circumflexsmall\",\n \"hyphensuperior\",\n \"Gravesmall\",\n \"Asmall\",\n \"Bsmall\",\n \"Csmall\",\n \"Dsmall\",\n \"Esmall\",\n \"Fsmall\",\n \"Gsmall\",\n \"Hsmall\",\n \"Ismall\",\n \"Jsmall\",\n \"Ksmall\",\n \"Lsmall\",\n \"Msmall\",\n \"Nsmall\",\n \"Osmall\",\n \"Psmall\",\n \"Qsmall\",\n \"Rsmall\",\n \"Ssmall\",\n \"Tsmall\",\n \"Usmall\",\n \"Vsmall\",\n \"Wsmall\",\n \"Xsmall\",\n \"Ysmall\",\n \"Zsmall\",\n \"colonmonetary\",\n \"onefitted\",\n \"rupiah\",\n \"Tildesmall\",\n \"exclamdownsmall\",\n \"centoldstyle\",\n \"Lslashsmall\",\n \"Scaronsmall\",\n \"Zcaronsmall\",\n \"Dieresissmall\",\n \"Brevesmall\",\n \"Caronsmall\",\n \"Dotaccentsmall\",\n \"Macronsmall\",\n \"figuredash\",\n \"hypheninferior\",\n \"Ogoneksmall\",\n \"Ringsmall\",\n \"Cedillasmall\",\n \"onequarter\",\n \"onehalf\",\n \"threequarters\",\n \"questiondownsmall\",\n \"oneeighth\",\n \"threeeighths\",\n \"fiveeighths\",\n \"seveneighths\",\n \"onethird\",\n \"twothirds\",\n \"zerosuperior\",\n \"onesuperior\",\n \"twosuperior\",\n \"threesuperior\",\n \"foursuperior\",\n \"fivesuperior\",\n \"sixsuperior\",\n \"sevensuperior\",\n \"eightsuperior\",\n \"ninesuperior\",\n \"zeroinferior\",\n \"oneinferior\",\n \"twoinferior\",\n \"threeinferior\",\n \"fourinferior\",\n \"fiveinferior\",\n \"sixinferior\",\n \"seveninferior\",\n \"eightinferior\",\n \"nineinferior\",\n \"centinferior\",\n \"dollarinferior\",\n \"periodinferior\",\n \"commainferior\",\n \"Agravesmall\",\n \"Aacutesmall\",\n \"Acircumflexsmall\",\n \"Atildesmall\",\n \"Adieresissmall\",\n \"Aringsmall\",\n \"AEsmall\",\n \"Ccedillasmall\",\n \"Egravesmall\",\n \"Eacutesmall\",\n \"Ecircumflexsmall\",\n \"Edieresissmall\",\n \"Igravesmall\",\n \"Iacutesmall\",\n \"Icircumflexsmall\",\n \"Idieresissmall\",\n \"Ethsmall\",\n \"Ntildesmall\",\n \"Ogravesmall\",\n \"Oacutesmall\",\n \"Ocircumflexsmall\",\n \"Otildesmall\",\n \"Odieresissmall\",\n \"OEsmall\",\n \"Oslashsmall\",\n \"Ugravesmall\",\n \"Uacutesmall\",\n \"Ucircumflexsmall\",\n \"Udieresissmall\",\n \"Yacutesmall\",\n \"Thornsmall\",\n \"Ydieresissmall\"\n ];\n var cffExpertSubsetStrings = [\n \".notdef\",\n \"space\",\n \"dollaroldstyle\",\n \"dollarsuperior\",\n \"parenleftsuperior\",\n \"parenrightsuperior\",\n \"twodotenleader\",\n \"onedotenleader\",\n \"comma\",\n \"hyphen\",\n \"period\",\n \"fraction\",\n \"zerooldstyle\",\n \"oneoldstyle\",\n \"twooldstyle\",\n \"threeoldstyle\",\n \"fouroldstyle\",\n \"fiveoldstyle\",\n \"sixoldstyle\",\n \"sevenoldstyle\",\n \"eightoldstyle\",\n \"nineoldstyle\",\n \"colon\",\n \"semicolon\",\n \"commasuperior\",\n \"threequartersemdash\",\n \"periodsuperior\",\n \"asuperior\",\n \"bsuperior\",\n \"centsuperior\",\n \"dsuperior\",\n \"esuperior\",\n \"isuperior\",\n \"lsuperior\",\n \"msuperior\",\n \"nsuperior\",\n \"osuperior\",\n \"rsuperior\",\n \"ssuperior\",\n \"tsuperior\",\n \"ff\",\n \"fi\",\n \"fl\",\n \"ffi\",\n \"ffl\",\n \"parenleftinferior\",\n \"parenrightinferior\",\n \"hyphensuperior\",\n \"colonmonetary\",\n \"onefitted\",\n \"rupiah\",\n \"centoldstyle\",\n \"figuredash\",\n \"hypheninferior\",\n \"onequarter\",\n \"onehalf\",\n \"threequarters\",\n \"oneeighth\",\n \"threeeighths\",\n \"fiveeighths\",\n \"seveneighths\",\n \"onethird\",\n \"twothirds\",\n \"zerosuperior\",\n \"onesuperior\",\n \"twosuperior\",\n \"threesuperior\",\n \"foursuperior\",\n \"fivesuperior\",\n \"sixsuperior\",\n \"sevensuperior\",\n \"eightsuperior\",\n \"ninesuperior\",\n \"zeroinferior\",\n \"oneinferior\",\n \"twoinferior\",\n \"threeinferior\",\n \"fourinferior\",\n \"fiveinferior\",\n \"sixinferior\",\n \"seveninferior\",\n \"eightinferior\",\n \"nineinferior\",\n \"centinferior\",\n \"dollarinferior\",\n \"periodinferior\",\n \"commainferior\"\n ];\n var cffStandardEncoding = [\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"space\",\n \"exclam\",\n \"quotedbl\",\n \"numbersign\",\n \"dollar\",\n \"percent\",\n \"ampersand\",\n \"quoteright\",\n \"parenleft\",\n \"parenright\",\n \"asterisk\",\n \"plus\",\n \"comma\",\n \"hyphen\",\n \"period\",\n \"slash\",\n \"zero\",\n \"one\",\n \"two\",\n \"three\",\n \"four\",\n \"five\",\n \"six\",\n \"seven\",\n \"eight\",\n \"nine\",\n \"colon\",\n \"semicolon\",\n \"less\",\n \"equal\",\n \"greater\",\n \"question\",\n \"at\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n \"G\",\n \"H\",\n \"I\",\n \"J\",\n \"K\",\n \"L\",\n \"M\",\n \"N\",\n \"O\",\n \"P\",\n \"Q\",\n \"R\",\n \"S\",\n \"T\",\n \"U\",\n \"V\",\n \"W\",\n \"X\",\n \"Y\",\n \"Z\",\n \"bracketleft\",\n \"backslash\",\n \"bracketright\",\n \"asciicircum\",\n \"underscore\",\n \"quoteleft\",\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\",\n \"f\",\n \"g\",\n \"h\",\n \"i\",\n \"j\",\n \"k\",\n \"l\",\n \"m\",\n \"n\",\n \"o\",\n \"p\",\n \"q\",\n \"r\",\n \"s\",\n \"t\",\n \"u\",\n \"v\",\n \"w\",\n \"x\",\n \"y\",\n \"z\",\n \"braceleft\",\n \"bar\",\n \"braceright\",\n \"asciitilde\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"exclamdown\",\n \"cent\",\n \"sterling\",\n \"fraction\",\n \"yen\",\n \"florin\",\n \"section\",\n \"currency\",\n \"quotesingle\",\n \"quotedblleft\",\n \"guillemotleft\",\n \"guilsinglleft\",\n \"guilsinglright\",\n \"fi\",\n \"fl\",\n \"\",\n \"endash\",\n \"dagger\",\n \"daggerdbl\",\n \"periodcentered\",\n \"\",\n \"paragraph\",\n \"bullet\",\n \"quotesinglbase\",\n \"quotedblbase\",\n \"quotedblright\",\n \"guillemotright\",\n \"ellipsis\",\n \"perthousand\",\n \"\",\n \"questiondown\",\n \"\",\n \"grave\",\n \"acute\",\n \"circumflex\",\n \"tilde\",\n \"macron\",\n \"breve\",\n \"dotaccent\",\n \"dieresis\",\n \"\",\n \"ring\",\n \"cedilla\",\n \"\",\n \"hungarumlaut\",\n \"ogonek\",\n \"caron\",\n \"emdash\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"AE\",\n \"\",\n \"ordfeminine\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"Lslash\",\n \"Oslash\",\n \"OE\",\n \"ordmasculine\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"ae\",\n \"\",\n \"\",\n \"\",\n \"dotlessi\",\n \"\",\n \"\",\n \"lslash\",\n \"oslash\",\n \"oe\",\n \"germandbls\"\n ];\n var cffExpertEncoding = [\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"space\",\n \"exclamsmall\",\n \"Hungarumlautsmall\",\n \"\",\n \"dollaroldstyle\",\n \"dollarsuperior\",\n \"ampersandsmall\",\n \"Acutesmall\",\n \"parenleftsuperior\",\n \"parenrightsuperior\",\n \"twodotenleader\",\n \"onedotenleader\",\n \"comma\",\n \"hyphen\",\n \"period\",\n \"fraction\",\n \"zerooldstyle\",\n \"oneoldstyle\",\n \"twooldstyle\",\n \"threeoldstyle\",\n \"fouroldstyle\",\n \"fiveoldstyle\",\n \"sixoldstyle\",\n \"sevenoldstyle\",\n \"eightoldstyle\",\n \"nineoldstyle\",\n \"colon\",\n \"semicolon\",\n \"commasuperior\",\n \"threequartersemdash\",\n \"periodsuperior\",\n \"questionsmall\",\n \"\",\n \"asuperior\",\n \"bsuperior\",\n \"centsuperior\",\n \"dsuperior\",\n \"esuperior\",\n \"\",\n \"\",\n \"isuperior\",\n \"\",\n \"\",\n \"lsuperior\",\n \"msuperior\",\n \"nsuperior\",\n \"osuperior\",\n \"\",\n \"\",\n \"rsuperior\",\n \"ssuperior\",\n \"tsuperior\",\n \"\",\n \"ff\",\n \"fi\",\n \"fl\",\n \"ffi\",\n \"ffl\",\n \"parenleftinferior\",\n \"\",\n \"parenrightinferior\",\n \"Circumflexsmall\",\n \"hyphensuperior\",\n \"Gravesmall\",\n \"Asmall\",\n \"Bsmall\",\n \"Csmall\",\n \"Dsmall\",\n \"Esmall\",\n \"Fsmall\",\n \"Gsmall\",\n \"Hsmall\",\n \"Ismall\",\n \"Jsmall\",\n \"Ksmall\",\n \"Lsmall\",\n \"Msmall\",\n \"Nsmall\",\n \"Osmall\",\n \"Psmall\",\n \"Qsmall\",\n \"Rsmall\",\n \"Ssmall\",\n \"Tsmall\",\n \"Usmall\",\n \"Vsmall\",\n \"Wsmall\",\n \"Xsmall\",\n \"Ysmall\",\n \"Zsmall\",\n \"colonmonetary\",\n \"onefitted\",\n \"rupiah\",\n \"Tildesmall\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"exclamdownsmall\",\n \"centoldstyle\",\n \"Lslashsmall\",\n \"\",\n \"\",\n \"Scaronsmall\",\n \"Zcaronsmall\",\n \"Dieresissmall\",\n \"Brevesmall\",\n \"Caronsmall\",\n \"\",\n \"Dotaccentsmall\",\n \"\",\n \"\",\n \"Macronsmall\",\n \"\",\n \"\",\n \"figuredash\",\n \"hypheninferior\",\n \"\",\n \"\",\n \"Ogoneksmall\",\n \"Ringsmall\",\n \"Cedillasmall\",\n \"\",\n \"\",\n \"\",\n \"onequarter\",\n \"onehalf\",\n \"threequarters\",\n \"questiondownsmall\",\n \"oneeighth\",\n \"threeeighths\",\n \"fiveeighths\",\n \"seveneighths\",\n \"onethird\",\n \"twothirds\",\n \"\",\n \"\",\n \"zerosuperior\",\n \"onesuperior\",\n \"twosuperior\",\n \"threesuperior\",\n \"foursuperior\",\n \"fivesuperior\",\n \"sixsuperior\",\n \"sevensuperior\",\n \"eightsuperior\",\n \"ninesuperior\",\n \"zeroinferior\",\n \"oneinferior\",\n \"twoinferior\",\n \"threeinferior\",\n \"fourinferior\",\n \"fiveinferior\",\n \"sixinferior\",\n \"seveninferior\",\n \"eightinferior\",\n \"nineinferior\",\n \"centinferior\",\n \"dollarinferior\",\n \"periodinferior\",\n \"commainferior\",\n \"Agravesmall\",\n \"Aacutesmall\",\n \"Acircumflexsmall\",\n \"Atildesmall\",\n \"Adieresissmall\",\n \"Aringsmall\",\n \"AEsmall\",\n \"Ccedillasmall\",\n \"Egravesmall\",\n \"Eacutesmall\",\n \"Ecircumflexsmall\",\n \"Edieresissmall\",\n \"Igravesmall\",\n \"Iacutesmall\",\n \"Icircumflexsmall\",\n \"Idieresissmall\",\n \"Ethsmall\",\n \"Ntildesmall\",\n \"Ogravesmall\",\n \"Oacutesmall\",\n \"Ocircumflexsmall\",\n \"Otildesmall\",\n \"Odieresissmall\",\n \"OEsmall\",\n \"Oslashsmall\",\n \"Ugravesmall\",\n \"Uacutesmall\",\n \"Ucircumflexsmall\",\n \"Udieresissmall\",\n \"Yacutesmall\",\n \"Thornsmall\",\n \"Ydieresissmall\"\n ];\n var standardNames = [\n \".notdef\",\n \".null\",\n \"nonmarkingreturn\",\n \"space\",\n \"exclam\",\n \"quotedbl\",\n \"numbersign\",\n \"dollar\",\n \"percent\",\n \"ampersand\",\n \"quotesingle\",\n \"parenleft\",\n \"parenright\",\n \"asterisk\",\n \"plus\",\n \"comma\",\n \"hyphen\",\n \"period\",\n \"slash\",\n \"zero\",\n \"one\",\n \"two\",\n \"three\",\n \"four\",\n \"five\",\n \"six\",\n \"seven\",\n \"eight\",\n \"nine\",\n \"colon\",\n \"semicolon\",\n \"less\",\n \"equal\",\n \"greater\",\n \"question\",\n \"at\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n \"G\",\n \"H\",\n \"I\",\n \"J\",\n \"K\",\n \"L\",\n \"M\",\n \"N\",\n \"O\",\n \"P\",\n \"Q\",\n \"R\",\n \"S\",\n \"T\",\n \"U\",\n \"V\",\n \"W\",\n \"X\",\n \"Y\",\n \"Z\",\n \"bracketleft\",\n \"backslash\",\n \"bracketright\",\n \"asciicircum\",\n \"underscore\",\n \"grave\",\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\",\n \"f\",\n \"g\",\n \"h\",\n \"i\",\n \"j\",\n \"k\",\n \"l\",\n \"m\",\n \"n\",\n \"o\",\n \"p\",\n \"q\",\n \"r\",\n \"s\",\n \"t\",\n \"u\",\n \"v\",\n \"w\",\n \"x\",\n \"y\",\n \"z\",\n \"braceleft\",\n \"bar\",\n \"braceright\",\n \"asciitilde\",\n \"Adieresis\",\n \"Aring\",\n \"Ccedilla\",\n \"Eacute\",\n \"Ntilde\",\n \"Odieresis\",\n \"Udieresis\",\n \"aacute\",\n \"agrave\",\n \"acircumflex\",\n \"adieresis\",\n \"atilde\",\n \"aring\",\n \"ccedilla\",\n \"eacute\",\n \"egrave\",\n \"ecircumflex\",\n \"edieresis\",\n \"iacute\",\n \"igrave\",\n \"icircumflex\",\n \"idieresis\",\n \"ntilde\",\n \"oacute\",\n \"ograve\",\n \"ocircumflex\",\n \"odieresis\",\n \"otilde\",\n \"uacute\",\n \"ugrave\",\n \"ucircumflex\",\n \"udieresis\",\n \"dagger\",\n \"degree\",\n \"cent\",\n \"sterling\",\n \"section\",\n \"bullet\",\n \"paragraph\",\n \"germandbls\",\n \"registered\",\n \"copyright\",\n \"trademark\",\n \"acute\",\n \"dieresis\",\n \"notequal\",\n \"AE\",\n \"Oslash\",\n \"infinity\",\n \"plusminus\",\n \"lessequal\",\n \"greaterequal\",\n \"yen\",\n \"mu\",\n \"partialdiff\",\n \"summation\",\n \"product\",\n \"pi\",\n \"integral\",\n \"ordfeminine\",\n \"ordmasculine\",\n \"Omega\",\n \"ae\",\n \"oslash\",\n \"questiondown\",\n \"exclamdown\",\n \"logicalnot\",\n \"radical\",\n \"florin\",\n \"approxequal\",\n \"Delta\",\n \"guillemotleft\",\n \"guillemotright\",\n \"ellipsis\",\n \"nonbreakingspace\",\n \"Agrave\",\n \"Atilde\",\n \"Otilde\",\n \"OE\",\n \"oe\",\n \"endash\",\n \"emdash\",\n \"quotedblleft\",\n \"quotedblright\",\n \"quoteleft\",\n \"quoteright\",\n \"divide\",\n \"lozenge\",\n \"ydieresis\",\n \"Ydieresis\",\n \"fraction\",\n \"currency\",\n \"guilsinglleft\",\n \"guilsinglright\",\n \"fi\",\n \"fl\",\n \"daggerdbl\",\n \"periodcentered\",\n \"quotesinglbase\",\n \"quotedblbase\",\n \"perthousand\",\n \"Acircumflex\",\n \"Ecircumflex\",\n \"Aacute\",\n \"Edieresis\",\n \"Egrave\",\n \"Iacute\",\n \"Icircumflex\",\n \"Idieresis\",\n \"Igrave\",\n \"Oacute\",\n \"Ocircumflex\",\n \"apple\",\n \"Ograve\",\n \"Uacute\",\n \"Ucircumflex\",\n \"Ugrave\",\n \"dotlessi\",\n \"circumflex\",\n \"tilde\",\n \"macron\",\n \"breve\",\n \"dotaccent\",\n \"ring\",\n \"cedilla\",\n \"hungarumlaut\",\n \"ogonek\",\n \"caron\",\n \"Lslash\",\n \"lslash\",\n \"Scaron\",\n \"scaron\",\n \"Zcaron\",\n \"zcaron\",\n \"brokenbar\",\n \"Eth\",\n \"eth\",\n \"Yacute\",\n \"yacute\",\n \"Thorn\",\n \"thorn\",\n \"minus\",\n \"multiply\",\n \"onesuperior\",\n \"twosuperior\",\n \"threesuperior\",\n \"onehalf\",\n \"onequarter\",\n \"threequarters\",\n \"franc\",\n \"Gbreve\",\n \"gbreve\",\n \"Idotaccent\",\n \"Scedilla\",\n \"scedilla\",\n \"Cacute\",\n \"cacute\",\n \"Ccaron\",\n \"ccaron\",\n \"dcroat\"\n ];\n function DefaultEncoding(font) {\n this.font = font;\n }\n DefaultEncoding.prototype.charToGlyphIndex = function(c) {\n const code = c.codePointAt(0);\n const glyphs = this.font.glyphs;\n if (glyphs) {\n for (let i = 0; i < glyphs.length; i += 1) {\n const glyph = glyphs.get(i);\n for (let j = 0; j < glyph.unicodes.length; j += 1) {\n if (glyph.unicodes[j] === code) {\n return i;\n }\n }\n }\n }\n return null;\n };\n function CmapEncoding(cmap) {\n this.cmap = cmap;\n }\n CmapEncoding.prototype.charToGlyphIndex = function(c) {\n return this.cmap.glyphIndexMap[c.codePointAt(0)] || 0;\n };\n function CffEncoding(encoding, charset) {\n this.encoding = encoding;\n this.charset = charset;\n }\n CffEncoding.prototype.charToGlyphIndex = function(s) {\n const code = s.codePointAt(0);\n const charName = this.encoding[code];\n return this.charset.indexOf(charName);\n };\n function GlyphNames(post) {\n switch (post.version) {\n case 1:\n this.names = standardNames.slice();\n break;\n case 2:\n this.names = new Array(post.numberOfGlyphs);\n for (let i = 0; i < post.numberOfGlyphs; i++) {\n if (post.glyphNameIndex[i] < standardNames.length) {\n this.names[i] = standardNames[post.glyphNameIndex[i]];\n } else {\n this.names[i] = post.names[post.glyphNameIndex[i] - standardNames.length];\n }\n }\n break;\n case 2.5:\n this.names = new Array(post.numberOfGlyphs);\n for (let i = 0; i < post.numberOfGlyphs; i++) {\n this.names[i] = standardNames[i + post.glyphNameIndex[i]];\n }\n break;\n case 3:\n this.names = [];\n break;\n default:\n this.names = [];\n break;\n }\n }\n GlyphNames.prototype.nameToGlyphIndex = function(name) {\n return this.names.indexOf(name);\n };\n GlyphNames.prototype.glyphIndexToName = function(gid) {\n return this.names[gid];\n };\n function addGlyphNamesAll(font) {\n let glyph;\n const glyphIndexMap = font.tables.cmap.glyphIndexMap;\n const charCodes = Object.keys(glyphIndexMap);\n for (let i = 0; i < charCodes.length; i += 1) {\n const c = charCodes[i];\n const glyphIndex = glyphIndexMap[c];\n glyph = font.glyphs.get(glyphIndex);\n glyph.addUnicode(parseInt(c));\n }\n for (let i = 0; i < font.glyphs.length; i += 1) {\n glyph = font.glyphs.get(i);\n if (font.cffEncoding) {\n glyph.name = font.cffEncoding.charset[i];\n } else if (font.glyphNames.names) {\n glyph.name = font.glyphNames.glyphIndexToName(i);\n }\n }\n }\n function addGlyphNamesToUnicodeMap(font) {\n font._IndexToUnicodeMap = {};\n const glyphIndexMap = font.tables.cmap.glyphIndexMap;\n const charCodes = Object.keys(glyphIndexMap);\n for (let i = 0; i < charCodes.length; i += 1) {\n const c = charCodes[i];\n let glyphIndex = glyphIndexMap[c];\n if (font._IndexToUnicodeMap[glyphIndex] === void 0) {\n font._IndexToUnicodeMap[glyphIndex] = {\n unicodes: [parseInt(c)]\n };\n } else {\n font._IndexToUnicodeMap[glyphIndex].unicodes.push(parseInt(c));\n }\n }\n }\n function addGlyphNames(font, opt) {\n if (opt.lowMemory) {\n addGlyphNamesToUnicodeMap(font);\n } else {\n addGlyphNamesAll(font);\n }\n }\n\n // src/draw.mjs\n function line(ctx, x1, y1, x2, y2) {\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.stroke();\n }\n var draw_default = { line };\n\n // src/tables/cpal.mjs\n function parseCpalTable(data, start) {\n const p = new Parser(data, start);\n const version = p.parseShort();\n if (version !== 0) {\n console.warn(\"Only CPALv0 is currently fully supported.\");\n }\n const numPaletteEntries = p.parseShort();\n const numPalettes = p.parseShort();\n const numColorRecords = p.parseShort();\n const colorRecordsArrayOffset = p.parseOffset32();\n const colorRecordIndices = p.parseUShortList(numPalettes);\n p.relativeOffset = colorRecordsArrayOffset;\n const colorRecords = p.parseULongList(numColorRecords);\n p.relativeOffset = colorRecordsArrayOffset;\n return {\n version,\n numPaletteEntries,\n colorRecords,\n colorRecordIndices\n };\n }\n function makeCpalTable({ version = 0, numPaletteEntries = 0, colorRecords = [], colorRecordIndices = [0] }) {\n check_default.argument(version === 0, \"Only CPALv0 are supported.\");\n check_default.argument(colorRecords.length, \"No colorRecords given.\");\n check_default.argument(colorRecordIndices.length, \"No colorRecordIndices given.\");\n if (colorRecordIndices.length > 1) {\n check_default.argument(numPaletteEntries, \"Can't infer numPaletteEntries on multiple colorRecordIndices\");\n }\n return new table_default.Table(\"CPAL\", [\n { name: \"version\", type: \"USHORT\", value: version },\n { name: \"numPaletteEntries\", type: \"USHORT\", value: numPaletteEntries || colorRecords.length },\n { name: \"numPalettes\", type: \"USHORT\", value: colorRecordIndices.length },\n { name: \"numColorRecords\", type: \"USHORT\", value: colorRecords.length },\n { name: \"colorRecordsArrayOffset\", type: \"ULONG\", value: 12 + 2 * colorRecordIndices.length },\n ...colorRecordIndices.map((palette, i) => ({ name: \"colorRecordIndices_\" + i, type: \"USHORT\", value: palette })),\n ...colorRecords.map((color, i) => ({ name: \"colorRecords_\" + i, type: \"ULONG\", value: color }))\n ]);\n }\n function parseCPALColor(bgra) {\n var b = (bgra & 4278190080) >> 24;\n var g = (bgra & 16711680) >> 16;\n var r = (bgra & 65280) >> 8;\n var a = bgra & 255;\n b = b + 256 & 255;\n g = g + 256 & 255;\n r = r + 256 & 255;\n a = (a + 256 & 255) / 255;\n return { b, g, r, a };\n }\n function getPaletteColor(font, index, palette = 0, colorFormat = \"hexa\") {\n if (index == 65535) {\n return \"currentColor\";\n }\n const cpalTable = font && font.tables && font.tables.cpal;\n if (!cpalTable) return \"currentColor\";\n if (palette > cpalTable.colorRecordIndices.length - 1) {\n throw new Error(`Palette index out of range (colorRecordIndices.length: ${cpalTable.colorRecordIndices.length}, index: ${index})`);\n }\n if (index > cpalTable.numPaletteEntries) {\n throw new Error(`Color index out of range (numPaletteEntries: ${cpalTable.numPaletteEntries}, index: ${index})`);\n }\n const lookupIndex = cpalTable.colorRecordIndices[palette] + index;\n if (lookupIndex > cpalTable.colorRecords) {\n throw new Error(`Color index out of range (colorRecords.length: ${cpalTable.colorRecords.length}, lookupIndex: ${lookupIndex})`);\n }\n const color = parseCPALColor(cpalTable.colorRecords[lookupIndex]);\n if (colorFormat === \"bgra\") {\n return color;\n }\n return formatColor(color, colorFormat);\n }\n function toHex(d) {\n return (\"0\" + parseInt(d).toString(16)).slice(-2);\n }\n function rgbToHSL(bgra) {\n const r = bgra.r / 255;\n const g = bgra.g / 255;\n const b = bgra.b / 255;\n const max = Math.max(r, g, b), min = Math.min(r, g, b);\n let h, s, l = (max + min) / 2;\n if (max === min) {\n h = s = 0;\n } else {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n h /= 6;\n }\n return {\n h: h * 360,\n s: s * 100,\n l: l * 100\n };\n }\n function hslToRGB(hsla) {\n let { h, s, l, a } = hsla;\n h = h % 360;\n s /= 100;\n l /= 100;\n const c = (1 - Math.abs(2 * l - 1)) * s;\n const x = c * (1 - Math.abs(h / 60 % 2 - 1));\n const m = l - c / 2;\n let r = 0, g = 0, b = 0;\n if (0 <= h && h < 60) {\n r = c;\n g = x;\n b = 0;\n } else if (60 <= h && h < 120) {\n r = x;\n g = c;\n b = 0;\n } else if (120 <= h && h < 180) {\n r = 0;\n g = c;\n b = x;\n } else if (180 <= h && h < 240) {\n r = 0;\n g = x;\n b = c;\n } else if (240 <= h && h < 300) {\n r = x;\n g = 0;\n b = c;\n } else if (300 <= h && h <= 360) {\n r = c;\n g = 0;\n b = x;\n }\n return {\n r: Math.round((r + m) * 255),\n g: Math.round((g + m) * 255),\n b: Math.round((b + m) * 255),\n a\n };\n }\n function bgraToRaw(color) {\n return parseInt(`0x${toHex(color.b)}${toHex(color.g)}${toHex(color.r)}${toHex(color.a * 255)}`, 16);\n }\n function parseColor(color, targetFormat = \"hexa\") {\n const returnRaw = targetFormat == \"raw\" || targetFormat == \"cpal\";\n const isRaw = Number.isInteger(color);\n let validFormat = true;\n if (isRaw && returnRaw || color === \"currentColor\") {\n return color;\n } else if (typeof color === \"object\") {\n if (targetFormat == \"bgra\") {\n return color;\n }\n if (returnRaw) {\n return bgraToRaw(color);\n }\n } else if (!isRaw && /^#([a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i.test(color.trim())) {\n color = color.trim().substring(1);\n switch (color.length) {\n case 3:\n color = {\n r: parseInt(color[0].repeat(2), 16),\n g: parseInt(color[1].repeat(2), 16),\n b: parseInt(color[2].repeat(2), 16),\n a: 1\n };\n break;\n case 4:\n color = {\n r: parseInt(color[0].repeat(2), 16),\n g: parseInt(color[1].repeat(2), 16),\n b: parseInt(color[2].repeat(2), 16),\n a: parseInt(color[3].repeat(2), 16) / 255\n };\n break;\n case 6:\n color = {\n r: parseInt(color[0] + color[1], 16),\n g: parseInt(color[2] + color[3], 16),\n b: parseInt(color[4] + color[5], 16),\n a: 1\n };\n break;\n case 8:\n color = {\n r: parseInt(color[0] + color[1], 16),\n g: parseInt(color[2] + color[3], 16),\n b: parseInt(color[4] + color[5], 16),\n a: parseInt(color[6] + color[7], 16) / 255\n };\n break;\n }\n if (targetFormat == \"bgra\") {\n return color;\n }\n } else if (typeof document !== \"undefined\" && /^[a-z]+$/i.test(color)) {\n const ctx = document.createElement(\"canvas\").getContext(\"2d\");\n ctx.fillStyle = color;\n const detectedColor = formatColor(ctx.fillStyle, \"hexa\");\n if (detectedColor === \"#000000ff\" && color.toLowerCase() !== \"black\") {\n validFormat = false;\n } else {\n color = detectedColor;\n }\n } else {\n color = color.trim();\n const rgbaRegex = /rgba?\\(\\s*(?:(\\d*\\.\\d+)(%?)|(\\d+)(%?))\\s*(?:,|\\s*)\\s*(?:(\\d*\\.\\d+)(%?)|(\\d+)(%?))\\s*(?:,|\\s*)\\s*(?:(\\d*\\.\\d+)(%?)|(\\d+)(%?))\\s*(?:(?:,|\\s|\\/)\\s*(?:(0*(?:\\.\\d+)?()|0*1(?:\\.0+)?())|(?:\\.\\d+)|(\\d+)(%)|(\\d*\\.\\d+)(%)))?\\s*\\)/;\n if (rgbaRegex.test(color)) {\n const matches = color.match(rgbaRegex).filter((i) => typeof i !== \"undefined\");\n color = {\n r: Math.round(parseFloat(matches[1]) / (matches[2] ? 100 / 255 : 1)),\n g: Math.round(parseFloat(matches[3]) / (matches[4] ? 100 / 255 : 1)),\n b: Math.round(parseFloat(matches[5]) / (matches[6] ? 100 / 255 : 1)),\n a: !matches[7] ? 1 : parseFloat(matches[7]) / (matches[8] ? 100 : 1)\n };\n } else {\n const hslaRegex = /hsla?\\(\\s*(?:(\\d*\\.\\d+|\\d+)(deg|turn|))\\s*(?:,|\\s*)\\s*(?:(\\d*\\.\\d+)%?|(\\d+)%?)\\s*(?:,|\\s*)\\s*(?:(\\d*\\.\\d+)%?|(\\d+)%?)\\s*(?:(?:,|\\s|\\/)\\s*(?:(0*(?:\\.\\d+)?()|0*1(?:\\.0+)?())|(?:\\.\\d+)|(\\d+)(%)|(\\d*\\.\\d+)(%)))?\\s*\\)/;\n if (hslaRegex.test(color)) {\n const matches = color.match(hslaRegex).filter((i) => typeof i !== \"undefined\");\n color = hslToRGB({\n h: parseFloat(matches[1]) * (matches[2] === \"turn\" ? 360 : 1),\n s: parseFloat(matches[3]),\n l: parseFloat(matches[4]),\n a: !matches[5] ? 1 : parseFloat(matches[5]) / (matches[6] ? 100 : 1)\n });\n } else {\n validFormat = false;\n }\n }\n }\n if (!validFormat) {\n throw new Error(`Invalid color format: ${color}`);\n }\n return formatColor(color, targetFormat);\n }\n function formatColor(bgra, format = \"hexa\") {\n if (bgra === \"currentColor\") return bgra;\n if (Number.isInteger(bgra)) {\n if (format == \"raw\" || format == \"cpal\") {\n return bgra;\n }\n bgra = parseCPALColor(bgra);\n } else if (typeof bgra !== \"object\") {\n bgra = parseColor(bgra, \"bgra\");\n }\n let hsl = [\"hsl\", \"hsla\"].includes(format) ? rgbToHSL(bgra) : null;\n switch (format) {\n case \"rgba\":\n return `rgba(${bgra.r}, ${bgra.g}, ${bgra.b}, ${parseFloat(bgra.a.toFixed(3))})`;\n case \"rgb\":\n return `rgb(${bgra.r}, ${bgra.g}, ${bgra.b})`;\n case \"hex\":\n case \"hex6\":\n case \"hex-6\":\n return `#${toHex(bgra.r)}${toHex(bgra.g)}${toHex(bgra.b)}`;\n case \"hexa\":\n case \"hex8\":\n case \"hex-8\":\n return `#${toHex(bgra.r)}${toHex(bgra.g)}${toHex(bgra.b)}${toHex(bgra.a * 255)}`;\n case \"hsl\":\n return `hsl(${hsl.h.toFixed(2)}, ${hsl.s.toFixed(2)}%, ${hsl.l.toFixed(2)}%)`;\n case \"hsla\":\n return `hsla(${hsl.h.toFixed(2)}, ${hsl.s.toFixed(2)}%, ${hsl.l.toFixed(2)}%, ${parseFloat(bgra.a.toFixed(3))})`;\n case \"bgra\":\n return bgra;\n case \"raw\":\n case \"cpal\":\n return bgraToRaw(bgra);\n default:\n throw new Error(\"Unknown color format: \" + format);\n }\n }\n var cpal_default = { parse: parseCpalTable, make: makeCpalTable, getPaletteColor, parseColor, formatColor };\n\n // src/glyph.mjs\n function getPathDefinition(glyph, path) {\n let _path = path || new path_default();\n return {\n configurable: true,\n get: function() {\n if (typeof _path === \"function\") {\n _path = _path();\n }\n return _path;\n },\n set: function(p) {\n _path = p;\n }\n };\n }\n function Glyph(options) {\n this.bindConstructorValues(options);\n }\n Glyph.prototype.bindConstructorValues = function(options) {\n this.index = options.index || 0;\n if (options.name === \".notdef\") {\n options.unicode = void 0;\n } else if (options.name === \".null\") {\n options.unicode = 0;\n }\n if (options.unicode === 0 && options.name !== \".null\") {\n throw new Error('The unicode value \"0\" is reserved for the glyph name \".null\" and cannot be used by any other glyph.');\n }\n this.name = options.name || null;\n this.unicode = options.unicode;\n this.unicodes = options.unicodes || (options.unicode !== void 0 ? [options.unicode] : []);\n if (\"xMin\" in options) {\n this.xMin = options.xMin;\n }\n if (\"yMin\" in options) {\n this.yMin = options.yMin;\n }\n if (\"xMax\" in options) {\n this.xMax = options.xMax;\n }\n if (\"yMax\" in options) {\n this.yMax = options.yMax;\n }\n if (\"advanceWidth\" in options) {\n this.advanceWidth = options.advanceWidth;\n }\n if (\"leftSideBearing\" in options) {\n this.leftSideBearing = options.leftSideBearing;\n }\n if (\"points\" in options) {\n this.points = options.points;\n }\n Object.defineProperty(this, \"path\", getPathDefinition(this, options.path));\n };\n Glyph.prototype.addUnicode = function(unicode) {\n if (this.unicodes.length === 0) {\n this.unicode = unicode;\n }\n this.unicodes.push(unicode);\n };\n Glyph.prototype.getBoundingBox = function() {\n return this.path.getBoundingBox();\n };\n Glyph.prototype.getPath = function(x, y, fontSize, options, font) {\n x = x !== void 0 ? x : 0;\n y = y !== void 0 ? y : 0;\n fontSize = fontSize !== void 0 ? fontSize : 72;\n options = Object.assign({}, font && font.defaultRenderOptions, options);\n let commands;\n let hPoints;\n let xScale = options.xScale;\n let yScale = options.yScale;\n const scale = 1 / (this.path.unitsPerEm || 1e3) * fontSize;\n let useGlyph = this;\n if (font && font.variation) {\n useGlyph = font.variation.getTransform(this, options.variation);\n commands = useGlyph.path.commands;\n }\n if (options.hinting && font && font.hinting) {\n hPoints = useGlyph.path && font.hinting.exec(useGlyph, fontSize, options);\n }\n if (hPoints) {\n commands = font.hinting.getCommands(hPoints);\n x = Math.round(x);\n y = Math.round(y);\n xScale = yScale = 1;\n } else {\n commands = useGlyph.path.commands;\n if (xScale === void 0) xScale = scale;\n if (yScale === void 0) yScale = scale;\n }\n const p = new path_default();\n if (options.drawSVG) {\n const svgImage = this.getSvgImage(font);\n if (svgImage) {\n const layer = new path_default();\n layer._image = {\n image: svgImage.image,\n x: x + svgImage.leftSideBearing * scale,\n y: y - svgImage.baseline * scale,\n width: svgImage.image.width * scale,\n height: svgImage.image.height * scale\n };\n p._layers = [layer];\n return p;\n }\n }\n if (options.drawLayers) {\n const layers = this.getLayers(font);\n if (layers && layers.length) {\n p._layers = [];\n for (let i = 0; i < layers.length; i += 1) {\n const layer = layers[i];\n let color = getPaletteColor(font, layer.paletteIndex, options.usePalette);\n if (color === \"currentColor\") {\n color = options.fill || \"black\";\n } else {\n color = formatColor(color, options.colorFormat || \"rgba\");\n }\n options = Object.assign({}, options, { fill: color });\n p._layers.push(this.getPath.call(layer.glyph, x, y, fontSize, options, font));\n }\n return p;\n }\n }\n p.fill = options.fill || this.path.fill;\n p.stroke = this.path.stroke;\n p.strokeWidth = this.path.strokeWidth * scale;\n for (let i = 0; i < commands.length; i += 1) {\n const cmd = commands[i];\n if (cmd.type === \"M\") {\n p.moveTo(x + cmd.x * xScale, y + -cmd.y * yScale);\n } else if (cmd.type === \"L\") {\n p.lineTo(x + cmd.x * xScale, y + -cmd.y * yScale);\n } else if (cmd.type === \"Q\") {\n p.quadraticCurveTo(\n x + cmd.x1 * xScale,\n y + -cmd.y1 * yScale,\n x + cmd.x * xScale,\n y + -cmd.y * yScale\n );\n } else if (cmd.type === \"C\") {\n p.curveTo(\n x + cmd.x1 * xScale,\n y + -cmd.y1 * yScale,\n x + cmd.x2 * xScale,\n y + -cmd.y2 * yScale,\n x + cmd.x * xScale,\n y + -cmd.y * yScale\n );\n } else if (cmd.type === \"Z\" && p.stroke && p.strokeWidth) {\n p.closePath();\n }\n }\n return p;\n };\n Glyph.prototype.getLayers = function(font) {\n if (!font) {\n throw new Error(\"The font object is required to read the colr/cpal tables in order to get the layers.\");\n }\n return font.layers.get(this.index);\n };\n Glyph.prototype.getSvgImage = function(font) {\n if (!font) {\n throw new Error(\"The font object is required to read the svg table in order to get the image.\");\n }\n return font.svgImages.get(this.index);\n };\n Glyph.prototype.getContours = function(transformedPoints = null) {\n if (this.points === void 0 && !transformedPoints) {\n return [];\n }\n const contours = [];\n let currentContour = [];\n let points = transformedPoints ? transformedPoints : this.points;\n for (let i = 0; i < points.length; i += 1) {\n const pt = points[i];\n currentContour.push(pt);\n if (pt.lastPointOfContour) {\n contours.push(currentContour);\n currentContour = [];\n }\n }\n check_default.argument(currentContour.length === 0, \"There are still points left in the current contour.\");\n return contours;\n };\n Glyph.prototype.getMetrics = function() {\n const commands = this.path.commands;\n const xCoords = [];\n const yCoords = [];\n for (let i = 0; i < commands.length; i += 1) {\n const cmd = commands[i];\n if (cmd.type !== \"Z\") {\n xCoords.push(cmd.x);\n yCoords.push(cmd.y);\n }\n if (cmd.type === \"Q\" || cmd.type === \"C\") {\n xCoords.push(cmd.x1);\n yCoords.push(cmd.y1);\n }\n if (cmd.type === \"C\") {\n xCoords.push(cmd.x2);\n yCoords.push(cmd.y2);\n }\n }\n const metrics = {\n xMin: Math.min.apply(null, xCoords),\n yMin: Math.min.apply(null, yCoords),\n xMax: Math.max.apply(null, xCoords),\n yMax: Math.max.apply(null, yCoords),\n leftSideBearing: this.leftSideBearing\n };\n if (!isFinite(metrics.xMin)) {\n metrics.xMin = 0;\n }\n if (!isFinite(metrics.xMax)) {\n metrics.xMax = this.advanceWidth;\n }\n if (!isFinite(metrics.yMin)) {\n metrics.yMin = 0;\n }\n if (!isFinite(metrics.yMax)) {\n metrics.yMax = 0;\n }\n metrics.rightSideBearing = this.advanceWidth - metrics.leftSideBearing - (metrics.xMax - metrics.xMin);\n return metrics;\n };\n Glyph.prototype.draw = function(ctx, x, y, fontSize, options, font) {\n options = Object.assign({}, font && font.defaultRenderOptions, options);\n const path = this.getPath(x, y, fontSize, options, font);\n path.draw(ctx);\n };\n Glyph.prototype.drawPoints = function(ctx, x, y, fontSize, options, font) {\n options = Object.assign({}, font && font.defaultRenderOptions, options);\n if (options.drawLayers) {\n const layers = this.getLayers(font);\n if (layers && layers.length) {\n for (let l = 0; l < layers.length; l += 1) {\n if (layers[l].glyph.index !== this.index) {\n this.drawPoints.call(layers[l].glyph, ctx, x, y, fontSize);\n }\n }\n return;\n }\n }\n function drawCircles(l, x2, y2, scale2) {\n ctx.beginPath();\n for (let j = 0; j < l.length; j += 1) {\n ctx.moveTo(x2 + l[j].x * scale2, y2 + l[j].y * scale2);\n ctx.arc(x2 + l[j].x * scale2, y2 + l[j].y * scale2, 2, 0, Math.PI * 2, false);\n }\n ctx.fill();\n }\n x = x !== void 0 ? x : 0;\n y = y !== void 0 ? y : 0;\n fontSize = fontSize !== void 0 ? fontSize : 24;\n const scale = 1 / this.path.unitsPerEm * fontSize;\n const blueCircles = [];\n const redCircles = [];\n const path = this.path;\n let commands = path.commands;\n if (font && font.variation) {\n commands = font.variation.getTransform(this, options.variation).path.commands;\n }\n for (let i = 0; i < commands.length; i += 1) {\n const cmd = commands[i];\n if (cmd.x !== void 0) {\n blueCircles.push({ x: cmd.x, y: -cmd.y });\n }\n if (cmd.x1 !== void 0) {\n redCircles.push({ x: cmd.x1, y: -cmd.y1 });\n }\n if (cmd.x2 !== void 0) {\n redCircles.push({ x: cmd.x2, y: -cmd.y2 });\n }\n }\n ctx.fillStyle = \"blue\";\n drawCircles(blueCircles, x, y, scale);\n ctx.fillStyle = \"red\";\n drawCircles(redCircles, x, y, scale);\n };\n Glyph.prototype.drawMetrics = function(ctx, x, y, fontSize) {\n let scale;\n x = x !== void 0 ? x : 0;\n y = y !== void 0 ? y : 0;\n fontSize = fontSize !== void 0 ? fontSize : 24;\n scale = 1 / this.path.unitsPerEm * fontSize;\n ctx.lineWidth = 1;\n ctx.strokeStyle = \"black\";\n draw_default.line(ctx, x, -1e4, x, 1e4);\n draw_default.line(ctx, -1e4, y, 1e4, y);\n const xMin = this.xMin || 0;\n let yMin = this.yMin || 0;\n const xMax = this.xMax || 0;\n let yMax = this.yMax || 0;\n const advanceWidth = this.advanceWidth || 0;\n ctx.strokeStyle = \"blue\";\n draw_default.line(ctx, x + xMin * scale, -1e4, x + xMin * scale, 1e4);\n draw_default.line(ctx, x + xMax * scale, -1e4, x + xMax * scale, 1e4);\n draw_default.line(ctx, -1e4, y + -yMin * scale, 1e4, y + -yMin * scale);\n draw_default.line(ctx, -1e4, y + -yMax * scale, 1e4, y + -yMax * scale);\n ctx.strokeStyle = \"green\";\n draw_default.line(ctx, x + advanceWidth * scale, -1e4, x + advanceWidth * scale, 1e4);\n };\n Glyph.prototype.toPathData = function(options, font) {\n options = Object.assign({}, { variation: font && font.defaultRenderOptions.variation }, options);\n let useGlyph = this;\n if (font && font.variation) {\n useGlyph = font.variation.getTransform(this, options.variation);\n }\n let usePath = useGlyph.points && options.pointsTransform ? options.pointsTransform(useGlyph.points) : useGlyph.path;\n if (options.pathTransform) {\n usePath = options.pathTransform(usePath);\n }\n return usePath.toPathData(options);\n };\n Glyph.prototype.fromSVG = function(pathData, options = {}) {\n return this.path.fromSVG(pathData, options);\n };\n Glyph.prototype.toSVG = function(options, font) {\n const pathData = this.toPathData.apply(this, [options, font]);\n return this.path.toSVG(options, pathData);\n };\n Glyph.prototype.toDOMElement = function(options, font) {\n options = Object.assign({}, { variation: font && font.defaultRenderOptions.variation }, options);\n let usePath = this.path;\n if (font && font.variation) {\n usePath = font.variation.getTransform(this, options.variation).path;\n }\n return usePath.toDOMElement(options);\n };\n var glyph_default = Glyph;\n\n // src/glyphset.mjs\n function defineDependentProperty(glyph, externalName, internalName) {\n Object.defineProperty(glyph, externalName, {\n get: function() {\n typeof glyph[internalName] === \"undefined\" && glyph.path;\n return glyph[internalName];\n },\n set: function(newValue) {\n glyph[internalName] = newValue;\n },\n enumerable: true,\n configurable: true\n });\n }\n function GlyphSet(font, glyphs) {\n this.font = font;\n this.glyphs = {};\n if (Array.isArray(glyphs)) {\n for (let i = 0; i < glyphs.length; i++) {\n const glyph = glyphs[i];\n glyph.path.unitsPerEm = font.unitsPerEm;\n this.glyphs[i] = glyph;\n }\n }\n this.length = glyphs && glyphs.length || 0;\n }\n if (typeof Symbol !== \"undefined\" && Symbol.iterator) {\n GlyphSet.prototype[Symbol.iterator] = function() {\n let n = -1;\n return {\n next: function() {\n n++;\n const done = n >= this.length - 1;\n return { value: this.get(n), done };\n }.bind(this)\n };\n };\n }\n GlyphSet.prototype.get = function(index) {\n if (this.font._push && this.glyphs[index] === void 0) {\n this.font._push(index);\n if (typeof this.glyphs[index] === \"function\") {\n this.glyphs[index] = this.glyphs[index]();\n }\n let glyph = this.glyphs[index];\n let unicodeObj = this.font._IndexToUnicodeMap[index];\n if (unicodeObj) {\n for (let j = 0; j < unicodeObj.unicodes.length; j++)\n glyph.addUnicode(unicodeObj.unicodes[j]);\n }\n if (this.font.cffEncoding) {\n glyph.name = this.font.cffEncoding.charset[index];\n } else if (this.font.glyphNames.names) {\n glyph.name = this.font.glyphNames.glyphIndexToName(index);\n }\n this.glyphs[index].advanceWidth = this.font._hmtxTableData[index].advanceWidth;\n this.glyphs[index].leftSideBearing = this.font._hmtxTableData[index].leftSideBearing;\n } else {\n if (typeof this.glyphs[index] === \"function\") {\n this.glyphs[index] = this.glyphs[index]();\n }\n }\n return this.glyphs[index];\n };\n GlyphSet.prototype.push = function(index, loader) {\n this.glyphs[index] = loader;\n this.length++;\n };\n function glyphLoader(font, index) {\n return new glyph_default({ index, font });\n }\n function ttfGlyphLoader(font, index, parseGlyph2, data, position, buildPath2) {\n return function() {\n const glyph = new glyph_default({ index, font });\n glyph.path = function() {\n parseGlyph2(glyph, data, position);\n const path = buildPath2(font.glyphs, glyph);\n path.unitsPerEm = font.unitsPerEm;\n return path;\n };\n defineDependentProperty(glyph, \"numberOfContours\", \"_numberOfContours\");\n defineDependentProperty(glyph, \"xMin\", \"_xMin\");\n defineDependentProperty(glyph, \"xMax\", \"_xMax\");\n defineDependentProperty(glyph, \"yMin\", \"_yMin\");\n defineDependentProperty(glyph, \"yMax\", \"_yMax\");\n defineDependentProperty(glyph, \"points\", \"_points\");\n return glyph;\n };\n }\n function cffGlyphLoader(font, index, parseCFFCharstring2, charstring, version) {\n return function() {\n const glyph = new glyph_default({ index, font });\n glyph.path = function() {\n const path = parseCFFCharstring2(font, glyph, charstring, version);\n path.unitsPerEm = font.unitsPerEm;\n return path;\n };\n return glyph;\n };\n }\n var glyphset_default = { GlyphSet, glyphLoader, ttfGlyphLoader, cffGlyphLoader };\n\n // src/tables/cff.mjs\n function equals(a, b) {\n if (a === b) {\n return true;\n } else if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i += 1) {\n if (!equals(a[i], b[i])) {\n return false;\n }\n }\n return true;\n } else {\n return false;\n }\n }\n var MAX_CALL_DEPTH = 10;\n function calcCFFSubroutineBias(subrs) {\n let bias;\n if (subrs.length < 1240) {\n bias = 107;\n } else if (subrs.length < 33900) {\n bias = 1131;\n } else {\n bias = 32768;\n }\n return bias;\n }\n function parseCFFIndex(data, start, conversionFn, version) {\n const offsets = [];\n const objects = [];\n const count = version > 1 ? parse_default.getULong(data, start) : parse_default.getCard16(data, start);\n const countLength = version > 1 ? 4 : 2;\n let objectOffset;\n let endOffset;\n if (count !== 0) {\n const offsetSize = parse_default.getByte(data, start + countLength);\n objectOffset = start + (count + 1) * offsetSize + countLength;\n let pos = start + countLength + 1;\n for (let i = 0; i < count + 1; i += 1) {\n offsets.push(parse_default.getOffset(data, pos, offsetSize));\n pos += offsetSize;\n }\n endOffset = objectOffset + offsets[count];\n } else {\n endOffset = start + countLength;\n }\n for (let i = 0; i < offsets.length - 1; i += 1) {\n let value = parse_default.getBytes(data, objectOffset + offsets[i], objectOffset + offsets[i + 1]);\n if (conversionFn) {\n value = conversionFn(value, data, start, version);\n }\n objects.push(value);\n }\n return { objects, startOffset: start, endOffset };\n }\n function parseCFFIndexLowMemory(data, start, version) {\n const offsets = [];\n const count = version > 1 ? parse_default.getULong(data, start) : parse_default.getCard16(data, start);\n const countLength = version > 1 ? 4 : 2;\n let objectOffset;\n let endOffset;\n if (count !== 0) {\n const offsetSize = parse_default.getByte(data, start + countLength);\n objectOffset = start + (count + 1) * offsetSize + countLength;\n let pos = start + countLength + 1;\n for (let i = 0; i < count + 1; i += 1) {\n offsets.push(parse_default.getOffset(data, pos, offsetSize));\n pos += offsetSize;\n }\n endOffset = objectOffset + offsets[count];\n } else {\n endOffset = start + countLength;\n }\n return { offsets, startOffset: start, endOffset };\n }\n function getCffIndexObject(i, offsets, data, start, conversionFn, version) {\n const count = version > 1 ? parse_default.getULong(data, start) : parse_default.getCard16(data, start);\n const countLength = version > 1 ? 4 : 2;\n let objectOffset = 0;\n if (count !== 0) {\n const offsetSize = parse_default.getByte(data, start + countLength);\n objectOffset = start + (count + 1) * offsetSize + countLength;\n }\n let value = parse_default.getBytes(data, objectOffset + offsets[i], objectOffset + offsets[i + 1]);\n if (conversionFn) {\n value = conversionFn(value);\n }\n return value;\n }\n function parseFloatOperand(parser) {\n let s = \"\";\n const eof = 15;\n const lookup = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \".\", \"E\", \"E-\", null, \"-\"];\n for (; ; ) {\n const b = parser.parseByte();\n const n1 = b >> 4;\n const n2 = b & 15;\n if (n1 === eof) {\n break;\n }\n s += lookup[n1];\n if (n2 === eof) {\n break;\n }\n s += lookup[n2];\n }\n return parseFloat(s);\n }\n function parseOperand(parser, b0) {\n let b1;\n let b2;\n let b3;\n let b4;\n if (b0 === 28) {\n b1 = parser.parseByte();\n b2 = parser.parseByte();\n return b1 << 8 | b2;\n }\n if (b0 === 29) {\n b1 = parser.parseByte();\n b2 = parser.parseByte();\n b3 = parser.parseByte();\n b4 = parser.parseByte();\n return b1 << 24 | b2 << 16 | b3 << 8 | b4;\n }\n if (b0 === 30) {\n return parseFloatOperand(parser);\n }\n if (b0 >= 32 && b0 <= 246) {\n return b0 - 139;\n }\n if (b0 >= 247 && b0 <= 250) {\n b1 = parser.parseByte();\n return (b0 - 247) * 256 + b1 + 108;\n }\n if (b0 >= 251 && b0 <= 254) {\n b1 = parser.parseByte();\n return -(b0 - 251) * 256 - b1 - 108;\n }\n throw new Error(\"Invalid b0 \" + b0);\n }\n function entriesToObject(entries) {\n const o = {};\n for (let i = 0; i < entries.length; i += 1) {\n const key = entries[i][0];\n const values = entries[i][1];\n let value;\n if (values.length === 1) {\n value = values[0];\n } else {\n value = values;\n }\n if (Object.prototype.hasOwnProperty.call(o, key) && !isNaN(o[key])) {\n throw new Error(\"Object \" + o + \" already has key \" + key);\n }\n o[key] = value;\n }\n return o;\n }\n function parseCFFDict(data, start, size, version) {\n start = start !== void 0 ? start : 0;\n const parser = new parse_default.Parser(data, start);\n const entries = [];\n let operands = [];\n size = size !== void 0 ? size : data.byteLength;\n let operandsStart = version < 2 ? 22 : 28;\n while (parser.relativeOffset < size) {\n let op = parser.parseByte();\n if (op < operandsStart) {\n if (op === 12) {\n op = 1200 + parser.parseByte();\n }\n if (version > 1 && op === 23) {\n parseBlend(operands);\n continue;\n }\n entries.push([op, operands]);\n operands = [];\n } else {\n operands.push(parseOperand(parser, op, version));\n }\n }\n return entriesToObject(entries);\n }\n function getCFFString(strings, index) {\n if (index <= 390) {\n index = cffStandardStrings[index];\n } else if (strings) {\n index = strings[index - 391];\n } else {\n index = void 0;\n }\n return index;\n }\n function interpretDict(dict, meta, strings) {\n const newDict = {};\n let value;\n for (let i = 0; i < meta.length; i += 1) {\n const m = meta[i];\n if (Array.isArray(m.type)) {\n const values = [];\n values.length = m.type.length;\n for (let j = 0; j < m.type.length; j++) {\n value = dict[m.op] !== void 0 ? dict[m.op][j] : void 0;\n if (value === void 0) {\n value = m.value !== void 0 && m.value[j] !== void 0 ? m.value[j] : null;\n }\n if (m.type[j] === \"SID\") {\n value = getCFFString(strings, value);\n }\n values[j] = value;\n }\n newDict[m.name] = values;\n } else {\n value = dict[m.op];\n if (value === void 0) {\n value = m.value !== void 0 ? m.value : null;\n }\n if (m.type === \"SID\") {\n value = getCFFString(strings, value);\n }\n newDict[m.name] = value;\n }\n }\n return newDict;\n }\n function parseCFFHeader(data, start) {\n const header = {};\n header.formatMajor = parse_default.getCard8(data, start);\n header.formatMinor = parse_default.getCard8(data, start + 1);\n if (header.formatMajor > 2) {\n throw new Error(`Unsupported CFF table version ${header.formatMajor}.${header.formatMinor}`);\n }\n header.size = parse_default.getCard8(data, start + 2);\n if (header.formatMajor < 2) {\n header.offsetSize = parse_default.getCard8(data, start + 3);\n header.startOffset = start;\n header.endOffset = start + 4;\n } else {\n header.topDictLength = parse_default.getCard16(data, start + 3);\n header.endOffset = start + 8;\n }\n return header;\n }\n var TOP_DICT_META = [\n { name: \"version\", op: 0, type: \"SID\" },\n { name: \"notice\", op: 1, type: \"SID\" },\n { name: \"copyright\", op: 1200, type: \"SID\" },\n { name: \"fullName\", op: 2, type: \"SID\" },\n { name: \"familyName\", op: 3, type: \"SID\" },\n { name: \"weight\", op: 4, type: \"SID\" },\n { name: \"isFixedPitch\", op: 1201, type: \"number\", value: 0 },\n { name: \"italicAngle\", op: 1202, type: \"number\", value: 0 },\n { name: \"underlinePosition\", op: 1203, type: \"number\", value: -100 },\n { name: \"underlineThickness\", op: 1204, type: \"number\", value: 50 },\n { name: \"paintType\", op: 1205, type: \"number\", value: 0 },\n { name: \"charstringType\", op: 1206, type: \"number\", value: 2 },\n {\n name: \"fontMatrix\",\n op: 1207,\n type: [\"real\", \"real\", \"real\", \"real\", \"real\", \"real\"],\n value: [1e-3, 0, 0, 1e-3, 0, 0]\n },\n { name: \"uniqueId\", op: 13, type: \"number\" },\n { name: \"fontBBox\", op: 5, type: [\"number\", \"number\", \"number\", \"number\"], value: [0, 0, 0, 0] },\n { name: \"strokeWidth\", op: 1208, type: \"number\", value: 0 },\n { name: \"xuid\", op: 14, type: [], value: null },\n { name: \"charset\", op: 15, type: \"offset\", value: 0 },\n { name: \"encoding\", op: 16, type: \"offset\", value: 0 },\n { name: \"charStrings\", op: 17, type: \"offset\", value: 0 },\n { name: \"private\", op: 18, type: [\"number\", \"offset\"], value: [0, 0] },\n { name: \"ros\", op: 1230, type: [\"SID\", \"SID\", \"number\"] },\n { name: \"cidFontVersion\", op: 1231, type: \"number\", value: 0 },\n { name: \"cidFontRevision\", op: 1232, type: \"number\", value: 0 },\n { name: \"cidFontType\", op: 1233, type: \"number\", value: 0 },\n { name: \"cidCount\", op: 1234, type: \"number\", value: 8720 },\n { name: \"uidBase\", op: 1235, type: \"number\" },\n { name: \"fdArray\", op: 1236, type: \"offset\" },\n { name: \"fdSelect\", op: 1237, type: \"offset\" },\n { name: \"fontName\", op: 1238, type: \"SID\" }\n ];\n var TOP_DICT_META_CFF2 = [\n {\n name: \"fontMatrix\",\n op: 1207,\n type: [\"real\", \"real\", \"real\", \"real\", \"real\", \"real\"],\n value: [1e-3, 0, 0, 1e-3, 0, 0]\n },\n { name: \"charStrings\", op: 17, type: \"offset\" },\n { name: \"fdArray\", op: 1236, type: \"offset\" },\n { name: \"fdSelect\", op: 1237, type: \"offset\" },\n { name: \"vstore\", op: 24, type: \"offset\" }\n ];\n var PRIVATE_DICT_META = [\n { name: \"subrs\", op: 19, type: \"offset\", value: 0 },\n { name: \"defaultWidthX\", op: 20, type: \"number\", value: 0 },\n { name: \"nominalWidthX\", op: 21, type: \"number\", value: 0 }\n ];\n var PRIVATE_DICT_META_CFF2 = [\n { name: \"blueValues\", op: 6, type: \"delta\" },\n { name: \"otherBlues\", op: 7, type: \"delta\" },\n { name: \"familyBlues\", op: 7, type: \"delta\" },\n { name: \"familyBlues\", op: 8, type: \"delta\" },\n { name: \"familyOtherBlues\", op: 9, type: \"delta\" },\n { name: \"blueScale\", op: 1209, type: \"number\", value: 0.039625 },\n { name: \"blueShift\", op: 1210, type: \"number\", value: 7 },\n { name: \"blueFuzz\", op: 1211, type: \"number\", value: 1 },\n { name: \"stdHW\", op: 10, type: \"number\" },\n { name: \"stdVW\", op: 11, type: \"number\" },\n { name: \"stemSnapH\", op: 1212, type: \"number\" },\n { name: \"stemSnapV\", op: 1213, type: \"number\" },\n { name: \"languageGroup\", op: 1217, type: \"number\", value: 0 },\n { name: \"expansionFactor\", op: 1218, type: \"number\", value: 0.06 },\n { name: \"vsindex\", op: 22, type: \"number\", value: 0 },\n { name: \"subrs\", op: 19, type: \"offset\" }\n ];\n var FONT_DICT_META = [\n { name: \"private\", op: 18, type: [\"number\", \"offset\"], value: [0, 0] }\n ];\n function parseCFFTopDict(data, start, strings, version) {\n const dict = parseCFFDict(data, start, data.byteLength, version);\n return interpretDict(dict, version > 1 ? TOP_DICT_META_CFF2 : TOP_DICT_META, strings);\n }\n function parseCFFPrivateDict(data, start, size, strings, version) {\n const dict = parseCFFDict(data, start, size, version);\n return interpretDict(dict, version > 1 ? PRIVATE_DICT_META_CFF2 : PRIVATE_DICT_META, strings);\n }\n function parseFontDict(data, start, version) {\n const dict = parseCFFDict(data, start, void 0, version);\n return interpretDict(dict, FONT_DICT_META);\n }\n function gatherCFF2FontDicts(data, start, fdArray) {\n const fontDictArray = [];\n for (let i = 0; i < fdArray.length; i++) {\n const fontDictData = new DataView(new Uint8Array(fdArray[i]).buffer);\n const fontDict = parseFontDict(fontDictData, 0, 2);\n const privateSize = fontDict.private[0];\n const privateOffset = fontDict.private[1];\n if (privateSize !== 0 && privateOffset !== 0) {\n const privateDict = parseCFFPrivateDict(data, privateOffset + start, privateSize, [], 2);\n if (privateDict.subrs) {\n const subrOffset = privateOffset + privateDict.subrs;\n const subrIndex = parseCFFIndex(data, subrOffset + start, void 0, 2);\n fontDict._subrs = subrIndex.objects;\n fontDict._subrsBias = calcCFFSubroutineBias(fontDict._subrs);\n }\n fontDict._privateDict = privateDict;\n }\n fontDictArray.push(fontDict);\n }\n return fontDictArray;\n }\n function gatherCFFTopDicts(data, start, cffIndex, strings, version) {\n const topDictArray = [];\n for (let iTopDict = 0; iTopDict < cffIndex.length; iTopDict += 1) {\n const topDictData = new DataView(new Uint8Array(cffIndex[iTopDict]).buffer);\n const topDict = parseCFFTopDict(topDictData, 0, strings, version);\n topDict._subrs = [];\n topDict._subrsBias = 0;\n topDict._defaultWidthX = 0;\n topDict._nominalWidthX = 0;\n const privateSize = version < 2 ? topDict.private[0] : 0;\n const privateOffset = version < 2 ? topDict.private[1] : 0;\n if (privateSize !== 0 && privateOffset !== 0) {\n const privateDict = parseCFFPrivateDict(data, privateOffset + start, privateSize, strings, version);\n topDict._defaultWidthX = privateDict.defaultWidthX;\n topDict._nominalWidthX = privateDict.nominalWidthX;\n if (privateDict.subrs !== 0) {\n const subrOffset = privateOffset + privateDict.subrs;\n const subrIndex = parseCFFIndex(data, subrOffset + start, void 0, version);\n topDict._subrs = subrIndex.objects;\n topDict._subrsBias = calcCFFSubroutineBias(topDict._subrs);\n }\n topDict._privateDict = privateDict;\n }\n topDictArray.push(topDict);\n }\n return topDictArray;\n }\n function parseCFFCharset(data, start, nGlyphs, strings, isCIDFont) {\n let sid;\n let count;\n const parser = new parse_default.Parser(data, start);\n nGlyphs -= 1;\n const charset = [\".notdef\"];\n const format = parser.parseCard8();\n if (format === 0) {\n for (let i = 0; i < nGlyphs; i += 1) {\n sid = parser.parseSID();\n if (isCIDFont) {\n charset.push(sid);\n } else {\n charset.push(getCFFString(strings, sid) || sid);\n }\n }\n } else if (format === 1) {\n while (charset.length <= nGlyphs) {\n sid = parser.parseSID();\n count = parser.parseCard8();\n for (let i = 0; i <= count; i += 1) {\n if (isCIDFont) {\n charset.push(\"cid\" + (\"00000\" + sid).slice(-5));\n } else {\n charset.push(getCFFString(strings, sid) || sid);\n }\n sid += 1;\n }\n }\n } else if (format === 2) {\n while (charset.length <= nGlyphs) {\n sid = parser.parseSID();\n count = parser.parseCard16();\n for (let i = 0; i <= count; i += 1) {\n if (isCIDFont) {\n charset.push(\"cid\" + (\"00000\" + sid).slice(-5));\n } else {\n charset.push(getCFFString(strings, sid) || sid);\n }\n sid += 1;\n }\n }\n } else {\n throw new Error(\"Unknown charset format \" + format);\n }\n return charset;\n }\n function parseCFFEncoding(data, start) {\n let code;\n const encoding = {};\n const parser = new parse_default.Parser(data, start);\n const format = parser.parseCard8();\n if (format === 0) {\n const nCodes = parser.parseCard8();\n for (let i = 0; i < nCodes; i += 1) {\n code = parser.parseCard8();\n encoding[code] = i;\n }\n } else if (format === 1) {\n const nRanges = parser.parseCard8();\n code = 1;\n for (let i = 0; i < nRanges; i += 1) {\n const first = parser.parseCard8();\n const nLeft = parser.parseCard8();\n for (let j = first; j <= first + nLeft; j += 1) {\n encoding[j] = code;\n code += 1;\n }\n }\n } else {\n throw new Error(\"Unknown encoding format \" + format);\n }\n return encoding;\n }\n function parseBlend(operands) {\n let numberOfBlends = operands.pop();\n while (operands.length > numberOfBlends) {\n operands.pop();\n }\n }\n function applyPaintType(font, path) {\n const paintType = font.tables.cff && font.tables.cff.topDict && font.tables.cff.topDict.paintType || 0;\n if (paintType === 2) {\n path.fill = null;\n path.stroke = \"black\";\n path.strokeWidth = font.tables.cff.topDict.strokeWidth || 0;\n }\n return paintType;\n }\n function parseCFFCharstring(font, glyph, code, version, coords) {\n let c1x;\n let c1y;\n let c2x;\n let c2y;\n const p = new path_default();\n const stack = [];\n let nStems = 0;\n let haveWidth = false;\n let open = false;\n let x = 0;\n let y = 0;\n let subrs;\n let subrsBias;\n let defaultWidthX;\n let nominalWidthX;\n let vsindex = 0;\n let vstore = [];\n let blendVector;\n let callDepth = 0;\n const cffTable = font.tables.cff2 || font.tables.cff;\n defaultWidthX = cffTable.topDict._defaultWidthX;\n nominalWidthX = cffTable.topDict._nominalWidthX;\n coords = coords || font.variation && font.variation.get();\n if (!glyph.getBlendPath) {\n glyph.getBlendPath = function(variationCoords) {\n return parseCFFCharstring(font, glyph, code, version, variationCoords);\n };\n }\n if (font.isCIDFont || version > 1) {\n const fdIndex = cffTable.topDict._fdSelect ? cffTable.topDict._fdSelect[glyph.index] : 0;\n const fdDict = cffTable.topDict._fdArray[fdIndex];\n subrs = fdDict._subrs;\n subrsBias = fdDict._subrsBias;\n if (version > 1) {\n vstore = cffTable.topDict._vstore.itemVariationStore;\n vsindex = fdDict._privateDict.vsindex;\n } else {\n defaultWidthX = fdDict._defaultWidthX;\n nominalWidthX = fdDict._nominalWidthX;\n }\n } else {\n subrs = cffTable.topDict._subrs;\n subrsBias = cffTable.topDict._subrsBias;\n }\n const paintType = applyPaintType(font, p);\n let width = defaultWidthX;\n function newContour(x2, y2) {\n if (open && paintType !== 2) {\n p.closePath();\n }\n p.moveTo(x2, y2);\n open = true;\n }\n function parseStems() {\n let hasWidthArg;\n hasWidthArg = (stack.length & 1) !== 0;\n if (hasWidthArg && !haveWidth) {\n width = stack.shift() + nominalWidthX;\n }\n nStems += stack.length >> 1;\n stack.length = 0;\n haveWidth = true;\n }\n function parse(code2) {\n let b1;\n let b2;\n let b3;\n let b4;\n let codeIndex;\n let subrCode;\n let jpx;\n let jpy;\n let c3x;\n let c3y;\n let c4x;\n let c4y;\n let i = 0;\n while (i < code2.length) {\n let v = code2[i];\n i += 1;\n switch (v) {\n case 1:\n parseStems();\n break;\n case 3:\n parseStems();\n break;\n case 4:\n if (stack.length > 1 && !haveWidth) {\n width = stack.shift() + nominalWidthX;\n haveWidth = true;\n }\n y += stack.pop();\n newContour(x, y);\n break;\n case 5:\n while (stack.length > 0) {\n x += stack.shift();\n y += stack.shift();\n p.lineTo(x, y);\n }\n break;\n case 6:\n while (stack.length > 0) {\n x += stack.shift();\n p.lineTo(x, y);\n if (stack.length === 0) {\n break;\n }\n y += stack.shift();\n p.lineTo(x, y);\n }\n break;\n case 7:\n while (stack.length > 0) {\n y += stack.shift();\n p.lineTo(x, y);\n if (stack.length === 0) {\n break;\n }\n x += stack.shift();\n p.lineTo(x, y);\n }\n break;\n case 8:\n while (stack.length > 0) {\n c1x = x + stack.shift();\n c1y = y + stack.shift();\n c2x = c1x + stack.shift();\n c2y = c1y + stack.shift();\n x = c2x + stack.shift();\n y = c2y + stack.shift();\n p.curveTo(c1x, c1y, c2x, c2y, x, y);\n }\n break;\n case 10:\n codeIndex = stack.pop() + subrsBias;\n subrCode = subrs[codeIndex];\n if (subrCode) {\n if (callDepth >= MAX_CALL_DEPTH) {\n console.warn(\"CFF charstring subroutine call depth exceeded, skipping callsubr\");\n break;\n }\n callDepth++;\n parse(subrCode);\n callDepth--;\n }\n break;\n case 11:\n if (version > 1) {\n console.error(\"CFF CharString operator return (11) is not supported in CFF2\");\n break;\n }\n return;\n case 12:\n v = code2[i];\n i += 1;\n switch (v) {\n case 35:\n c1x = x + stack.shift();\n c1y = y + stack.shift();\n c2x = c1x + stack.shift();\n c2y = c1y + stack.shift();\n jpx = c2x + stack.shift();\n jpy = c2y + stack.shift();\n c3x = jpx + stack.shift();\n c3y = jpy + stack.shift();\n c4x = c3x + stack.shift();\n c4y = c3y + stack.shift();\n x = c4x + stack.shift();\n y = c4y + stack.shift();\n stack.shift();\n p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy);\n p.curveTo(c3x, c3y, c4x, c4y, x, y);\n break;\n case 34:\n c1x = x + stack.shift();\n c1y = y;\n c2x = c1x + stack.shift();\n c2y = c1y + stack.shift();\n jpx = c2x + stack.shift();\n jpy = c2y;\n c3x = jpx + stack.shift();\n c3y = c2y;\n c4x = c3x + stack.shift();\n c4y = y;\n x = c4x + stack.shift();\n p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy);\n p.curveTo(c3x, c3y, c4x, c4y, x, y);\n break;\n case 36:\n c1x = x + stack.shift();\n c1y = y + stack.shift();\n c2x = c1x + stack.shift();\n c2y = c1y + stack.shift();\n jpx = c2x + stack.shift();\n jpy = c2y;\n c3x = jpx + stack.shift();\n c3y = c2y;\n c4x = c3x + stack.shift();\n c4y = c3y + stack.shift();\n x = c4x + stack.shift();\n p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy);\n p.curveTo(c3x, c3y, c4x, c4y, x, y);\n break;\n case 37:\n c1x = x + stack.shift();\n c1y = y + stack.shift();\n c2x = c1x + stack.shift();\n c2y = c1y + stack.shift();\n jpx = c2x + stack.shift();\n jpy = c2y + stack.shift();\n c3x = jpx + stack.shift();\n c3y = jpy + stack.shift();\n c4x = c3x + stack.shift();\n c4y = c3y + stack.shift();\n if (Math.abs(c4x - x) > Math.abs(c4y - y)) {\n x = c4x + stack.shift();\n } else {\n y = c4y + stack.shift();\n }\n p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy);\n p.curveTo(c3x, c3y, c4x, c4y, x, y);\n break;\n default:\n console.log(\"Glyph \" + glyph.index + \": unknown operator 1200\" + v);\n stack.length = 0;\n }\n break;\n case 14:\n if (version > 1) {\n console.error(\"CFF CharString operator endchar (14) is not supported in CFF2\");\n break;\n }\n if (stack.length >= 4) {\n const acharName = cffStandardEncoding[stack.pop()];\n const bcharName = cffStandardEncoding[stack.pop()];\n const ady = stack.pop();\n const adx = stack.pop();\n if (acharName && bcharName) {\n glyph.isComposite = true;\n glyph.components = [];\n const acharGlyphIndex = font.cffEncoding.charset.indexOf(acharName);\n const bcharGlyphIndex = font.cffEncoding.charset.indexOf(bcharName);\n glyph.components.push({\n glyphIndex: bcharGlyphIndex,\n dx: 0,\n dy: 0\n });\n glyph.components.push({\n glyphIndex: acharGlyphIndex,\n dx: adx,\n dy: ady\n });\n p.extend(font.glyphs.get(bcharGlyphIndex).path);\n const acharGlyph = font.glyphs.get(acharGlyphIndex);\n const shiftedCommands = JSON.parse(JSON.stringify(acharGlyph.path.commands));\n for (let i2 = 0; i2 < shiftedCommands.length; i2 += 1) {\n const cmd = shiftedCommands[i2];\n if (cmd.type !== \"Z\") {\n cmd.x += adx;\n cmd.y += ady;\n }\n if (cmd.type === \"Q\" || cmd.type === \"C\") {\n cmd.x1 += adx;\n cmd.y1 += ady;\n }\n if (cmd.type === \"C\") {\n cmd.x2 += adx;\n cmd.y2 += ady;\n }\n }\n p.extend(shiftedCommands);\n }\n } else if (stack.length > 0 && !haveWidth) {\n width = stack.shift() + nominalWidthX;\n haveWidth = true;\n }\n if (open && paintType !== 2) {\n p.closePath();\n open = false;\n }\n break;\n case 15:\n if (version < 2) {\n console.error(\"CFF2 CharString operator vsindex (15) is not supported in CFF\");\n break;\n }\n vsindex = stack.pop();\n break;\n case 16:\n if (version < 2) {\n console.error(\"CFF2 CharString operator blend (16) is not supported in CFF\");\n break;\n }\n if (!blendVector) {\n blendVector = font.variation && coords && font.variation.process.getBlendVector(vstore, vsindex, coords);\n }\n var n = stack.pop();\n var axisCount = blendVector ? blendVector.length : vstore.itemVariationSubtables[vsindex].regionIndexes.length;\n var deltaSetCount = n * axisCount;\n var delta = stack.length - deltaSetCount;\n var deltaSetIndex = delta - n;\n if (blendVector) {\n for (let i2 = 0; i2 < n; i2++) {\n var sum = stack[deltaSetIndex + i2];\n for (let j = 0; j < axisCount; j++) {\n sum += blendVector[j] * stack[delta++];\n }\n stack[deltaSetIndex + i2] = sum;\n }\n }\n while (deltaSetCount--) {\n stack.pop();\n }\n break;\n case 18:\n parseStems();\n break;\n case 19:\n // hintmask\n case 20:\n parseStems();\n i += nStems + 7 >> 3;\n break;\n case 21:\n if (stack.length > 2 && !haveWidth) {\n width = stack.shift() + nominalWidthX;\n haveWidth = true;\n }\n y += stack.pop();\n x += stack.pop();\n newContour(x, y);\n break;\n case 22:\n if (stack.length > 1 && !haveWidth) {\n width = stack.shift() + nominalWidthX;\n haveWidth = true;\n }\n x += stack.pop();\n newContour(x, y);\n break;\n case 23:\n parseStems();\n break;\n case 24:\n while (stack.length > 2) {\n c1x = x + stack.shift();\n c1y = y + stack.shift();\n c2x = c1x + stack.shift();\n c2y = c1y + stack.shift();\n x = c2x + stack.shift();\n y = c2y + stack.shift();\n p.curveTo(c1x, c1y, c2x, c2y, x, y);\n }\n x += stack.shift();\n y += stack.shift();\n p.lineTo(x, y);\n break;\n case 25:\n while (stack.length > 6) {\n x += stack.shift();\n y += stack.shift();\n p.lineTo(x, y);\n }\n c1x = x + stack.shift();\n c1y = y + stack.shift();\n c2x = c1x + stack.shift();\n c2y = c1y + stack.shift();\n x = c2x + stack.shift();\n y = c2y + stack.shift();\n p.curveTo(c1x, c1y, c2x, c2y, x, y);\n break;\n case 26:\n if (stack.length & 1) {\n x += stack.shift();\n }\n while (stack.length > 0) {\n c1x = x;\n c1y = y + stack.shift();\n c2x = c1x + stack.shift();\n c2y = c1y + stack.shift();\n x = c2x;\n y = c2y + stack.shift();\n p.curveTo(c1x, c1y, c2x, c2y, x, y);\n }\n break;\n case 27:\n if (stack.length & 1) {\n y += stack.shift();\n }\n while (stack.length > 0) {\n c1x = x + stack.shift();\n c1y = y;\n c2x = c1x + stack.shift();\n c2y = c1y + stack.shift();\n x = c2x + stack.shift();\n y = c2y;\n p.curveTo(c1x, c1y, c2x, c2y, x, y);\n }\n break;\n case 28:\n b1 = code2[i];\n b2 = code2[i + 1];\n stack.push((b1 << 24 | b2 << 16) >> 16);\n i += 2;\n break;\n case 29:\n codeIndex = stack.pop() + font.gsubrsBias;\n subrCode = font.gsubrs[codeIndex];\n if (subrCode) {\n if (callDepth >= MAX_CALL_DEPTH) {\n console.warn(\"CFF charstring subroutine call depth exceeded, skipping callgsubr\");\n break;\n }\n callDepth++;\n parse(subrCode);\n callDepth--;\n }\n break;\n case 30:\n while (stack.length > 0) {\n c1x = x;\n c1y = y + stack.shift();\n c2x = c1x + stack.shift();\n c2y = c1y + stack.shift();\n x = c2x + stack.shift();\n y = c2y + (stack.length === 1 ? stack.shift() : 0);\n p.curveTo(c1x, c1y, c2x, c2y, x, y);\n if (stack.length === 0) {\n break;\n }\n c1x = x + stack.shift();\n c1y = y;\n c2x = c1x + stack.shift();\n c2y = c1y + stack.shift();\n y = c2y + stack.shift();\n x = c2x + (stack.length === 1 ? stack.shift() : 0);\n p.curveTo(c1x, c1y, c2x, c2y, x, y);\n }\n break;\n case 31:\n while (stack.length > 0) {\n c1x = x + stack.shift();\n c1y = y;\n c2x = c1x + stack.shift();\n c2y = c1y + stack.shift();\n y = c2y + stack.shift();\n x = c2x + (stack.length === 1 ? stack.shift() : 0);\n p.curveTo(c1x, c1y, c2x, c2y, x, y);\n if (stack.length === 0) {\n break;\n }\n c1x = x;\n c1y = y + stack.shift();\n c2x = c1x + stack.shift();\n c2y = c1y + stack.shift();\n x = c2x + stack.shift();\n y = c2y + (stack.length === 1 ? stack.shift() : 0);\n p.curveTo(c1x, c1y, c2x, c2y, x, y);\n }\n break;\n default:\n if (v < 32) {\n console.log(\"Glyph \" + glyph.index + \": unknown operator \" + v);\n } else if (v < 247) {\n stack.push(v - 139);\n } else if (v < 251) {\n b1 = code2[i];\n i += 1;\n stack.push((v - 247) * 256 + b1 + 108);\n } else if (v < 255) {\n b1 = code2[i];\n i += 1;\n stack.push(-(v - 251) * 256 - b1 - 108);\n } else {\n b1 = code2[i];\n b2 = code2[i + 1];\n b3 = code2[i + 2];\n b4 = code2[i + 3];\n i += 4;\n stack.push((b1 << 24 | b2 << 16 | b3 << 8 | b4) / 65536);\n }\n }\n }\n }\n parse(code);\n if (font.variation && coords) {\n p.commands = p.commands.map((c) => {\n const keys = Object.keys(c);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (key === \"type\") continue;\n c[key] = Math.round(c[key]);\n }\n return c;\n });\n }\n if (haveWidth) {\n glyph.advanceWidth = width;\n }\n return p;\n }\n function parseCFFFDSelect(data, start, nGlyphs, fdArrayCount, version) {\n const fdSelect = [];\n let fdIndex;\n const parser = new parse_default.Parser(data, start);\n const format = parser.parseCard8();\n if (format === 0) {\n for (let iGid = 0; iGid < nGlyphs; iGid++) {\n fdIndex = parser.parseCard8();\n if (fdIndex >= fdArrayCount) {\n throw new Error(\"CFF table CID Font FDSelect has bad FD index value \" + fdIndex + \" (FD count \" + fdArrayCount + \")\");\n }\n fdSelect.push(fdIndex);\n }\n } else if (format === 3 || version > 1 && format === 4) {\n const nRanges = format === 4 ? parser.parseULong() : parser.parseCard16();\n let first = format === 4 ? parser.parseULong() : parser.parseCard16();\n if (first !== 0) {\n throw new Error(`CFF Table CID Font FDSelect format ${format} range has bad initial GID ${first}`);\n }\n let next;\n for (let iRange = 0; iRange < nRanges; iRange++) {\n fdIndex = format === 4 ? parser.parseUShort() : parser.parseCard8();\n next = format === 4 ? parser.parseULong() : parser.parseCard16();\n if (fdIndex >= fdArrayCount) {\n throw new Error(\"CFF table CID Font FDSelect has bad FD index value \" + fdIndex + \" (FD count \" + fdArrayCount + \")\");\n }\n if (next > nGlyphs) {\n throw new Error(`CFF Table CID Font FDSelect format ${version} range has bad GID ${next}`);\n }\n for (; first < next; first++) {\n fdSelect.push(fdIndex);\n }\n first = next;\n }\n if (next !== nGlyphs) {\n throw new Error(\"CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID \" + next);\n }\n } else {\n throw new Error(\"CFF Table CID Font FDSelect table has unsupported format \" + format);\n }\n return fdSelect;\n }\n function parseCFFTable(data, start, font, opt) {\n let resultTable;\n const header = parseCFFHeader(data, start);\n if (header.formatMajor === 2) {\n resultTable = font.tables.cff2 = {};\n } else {\n resultTable = font.tables.cff = {};\n }\n const nameIndex = header.formatMajor > 1 ? null : parseCFFIndex(data, header.endOffset, parse_default.bytesToString);\n const topDictIndex = header.formatMajor > 1 ? null : parseCFFIndex(data, nameIndex.endOffset);\n const stringIndex = header.formatMajor > 1 ? null : parseCFFIndex(data, topDictIndex.endOffset, parse_default.bytesToString);\n const globalSubrIndex = parseCFFIndex(data, header.formatMajor > 1 ? start + header.size + header.topDictLength : stringIndex.endOffset, void 0, header.formatMajor);\n font.gsubrs = globalSubrIndex.objects;\n font.gsubrsBias = calcCFFSubroutineBias(font.gsubrs);\n let topDict;\n if (header.formatMajor > 1) {\n const topDictOffset = start + header.size;\n const topDictData = parse_default.getBytes(data, topDictOffset, topDictOffset + header.topDictLength);\n topDict = gatherCFFTopDicts(data, 0, [topDictData], void 0, header.formatMajor)[0];\n } else {\n const topDictArray = gatherCFFTopDicts(data, start, topDictIndex.objects, stringIndex.objects, header.formatMajor);\n if (topDictArray.length !== 1) {\n throw new Error(\"CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = \" + topDictArray.length);\n }\n topDict = topDictArray[0];\n }\n resultTable.topDict = topDict;\n if (topDict._privateDict) {\n font.defaultWidthX = topDict._privateDict.defaultWidthX;\n font.nominalWidthX = topDict._privateDict.nominalWidthX;\n }\n if (header.formatMajor < 2 && topDict.ros[0] !== void 0 && topDict.ros[1] !== void 0) {\n font.isCIDFont = true;\n }\n if (header.formatMajor > 1) {\n let fdArrayIndexOffset = topDict.fdArray;\n let fdSelectOffset = topDict.fdSelect;\n if (!fdArrayIndexOffset) {\n throw new Error(\"This is a CFF2 font, but FDArray information is missing\");\n }\n const fdArrayIndex = parseCFFIndex(data, start + fdArrayIndexOffset, null, header.formatMajor);\n const fdArray = gatherCFF2FontDicts(data, start, fdArrayIndex.objects);\n topDict._fdArray = fdArray;\n if (fdSelectOffset) {\n topDict._fdSelect = parseCFFFDSelect(data, start + fdSelectOffset, font.numGlyphs, fdArray.length, header.formatMajor);\n }\n } else if (font.isCIDFont) {\n let fdArrayOffset = topDict.fdArray;\n let fdSelectOffset = topDict.fdSelect;\n if (fdArrayOffset === 0 || fdSelectOffset === 0) {\n throw new Error(\"Font is marked as a CID font, but FDArray and/or FDSelect information is missing\");\n }\n fdArrayOffset += start;\n const fdArrayIndex = parseCFFIndex(data, fdArrayOffset);\n const fdArray = gatherCFFTopDicts(data, start, fdArrayIndex.objects, stringIndex.objects, header.formatMajor);\n topDict._fdArray = fdArray;\n fdSelectOffset += start;\n topDict._fdSelect = parseCFFFDSelect(data, fdSelectOffset, font.numGlyphs, fdArray.length, header.formatMajor);\n }\n if (header.formatMajor < 2) {\n const privateDictOffset = start + topDict.private[1];\n const privateDict = parseCFFPrivateDict(data, privateDictOffset, topDict.private[0], stringIndex.objects, header.formatMajor);\n font.defaultWidthX = privateDict.defaultWidthX;\n font.nominalWidthX = privateDict.nominalWidthX;\n if (privateDict.subrs !== 0) {\n const subrOffset = privateDictOffset + privateDict.subrs;\n const subrIndex = parseCFFIndex(data, subrOffset);\n font.subrs = subrIndex.objects;\n font.subrsBias = calcCFFSubroutineBias(font.subrs);\n } else {\n font.subrs = [];\n font.subrsBias = 0;\n }\n }\n let charStringsIndex;\n if (opt.lowMemory) {\n charStringsIndex = parseCFFIndexLowMemory(data, start + topDict.charStrings, header.formatMajor);\n font.nGlyphs = charStringsIndex.offsets.length - (header.formatMajor > 1 ? 1 : 0);\n } else {\n charStringsIndex = parseCFFIndex(data, start + topDict.charStrings, null, header.formatMajor);\n font.nGlyphs = charStringsIndex.objects.length;\n }\n if (header.formatMajor > 1 && font.tables.maxp && font.nGlyphs !== font.tables.maxp.numGlyphs) {\n console.error(`Glyph count in the CFF2 table (${font.nGlyphs}) must correspond to the glyph count in the maxp table (${font.tables.maxp.numGlyphs})`);\n }\n if (header.formatMajor < 2) {\n let charset = [];\n let encoding = [];\n if (topDict.charset === 0) {\n charset = cffISOAdobeStrings;\n } else if (topDict.charset === 1) {\n charset = cffIExpertStrings;\n } else if (topDict.charset === 2) {\n charset = cffExpertSubsetStrings;\n } else {\n charset = parseCFFCharset(data, start + topDict.charset, font.nGlyphs, stringIndex.objects, font.isCIDFont);\n }\n if (topDict.encoding === 0) {\n encoding = cffStandardEncoding;\n } else if (topDict.encoding === 1) {\n encoding = cffExpertEncoding;\n } else {\n encoding = parseCFFEncoding(data, start + topDict.encoding);\n }\n font.cffEncoding = new CffEncoding(encoding, charset);\n font.encoding = font.encoding || font.cffEncoding;\n }\n font.glyphs = new glyphset_default.GlyphSet(font);\n if (opt.lowMemory) {\n font._push = function(i) {\n const charString = getCffIndexObject(i, charStringsIndex.offsets, data, start + topDict.charStrings, void 0, header.formatMajor);\n font.glyphs.push(i, glyphset_default.cffGlyphLoader(font, i, parseCFFCharstring, charString, header.formatMajor));\n };\n } else {\n for (let i = 0; i < font.nGlyphs; i += 1) {\n const charString = charStringsIndex.objects[i];\n font.glyphs.push(i, glyphset_default.cffGlyphLoader(font, i, parseCFFCharstring, charString, header.formatMajor));\n }\n }\n if (topDict.vstore) {\n const p = new parse_default.Parser(data, start + topDict.vstore);\n topDict._vstore = p.parseVariationStore();\n }\n }\n function encodeString(s, strings) {\n let sid;\n let i = cffStandardStrings.indexOf(s);\n if (i >= 0) {\n sid = i;\n }\n i = strings.indexOf(s);\n if (i >= 0) {\n sid = i + cffStandardStrings.length;\n } else {\n sid = cffStandardStrings.length + strings.length;\n strings.push(s);\n }\n return sid;\n }\n function makeHeader() {\n return new table_default.Record(\"Header\", [\n { name: \"major\", type: \"Card8\", value: 1 },\n { name: \"minor\", type: \"Card8\", value: 0 },\n { name: \"hdrSize\", type: \"Card8\", value: 4 },\n { name: \"major\", type: \"Card8\", value: 1 }\n ]);\n }\n function makeNameIndex(fontNames) {\n const t = new table_default.Record(\"Name INDEX\", [\n { name: \"names\", type: \"INDEX\", value: [] }\n ]);\n t.names = [];\n for (let i = 0; i < fontNames.length; i += 1) {\n t.names.push({ name: \"name_\" + i, type: \"NAME\", value: fontNames[i] });\n }\n return t;\n }\n function makeDict(meta, attrs, strings) {\n const m = {};\n for (let i = 0; i < meta.length; i += 1) {\n const entry = meta[i];\n let value = attrs[entry.name];\n if (value !== void 0 && !equals(value, entry.value)) {\n if (entry.type === \"SID\") {\n value = encodeString(value, strings);\n }\n m[entry.op] = { name: entry.name, type: entry.type, value };\n }\n }\n return m;\n }\n function makeTopDict(attrs, strings, version) {\n const t = new table_default.Record(\"Top DICT\", [\n { name: \"dict\", type: \"DICT\", value: {} }\n ]);\n t.dict = makeDict(version > 1 ? TOP_DICT_META_CFF2 : TOP_DICT_META, attrs, strings);\n return t;\n }\n function makeTopDictIndex(topDict) {\n const t = new table_default.Record(\"Top DICT INDEX\", [\n { name: \"topDicts\", type: \"INDEX\", value: [] }\n ]);\n t.topDicts = [{ name: \"topDict_0\", type: \"TABLE\", value: topDict }];\n return t;\n }\n function makeStringIndex(strings) {\n const t = new table_default.Record(\"String INDEX\", [\n { name: \"strings\", type: \"INDEX\", value: [] }\n ]);\n t.strings = [];\n for (let i = 0; i < strings.length; i += 1) {\n t.strings.push({ name: \"string_\" + i, type: \"STRING\", value: strings[i] });\n }\n return t;\n }\n function makeGlobalSubrIndex() {\n return new table_default.Record(\"Global Subr INDEX\", [\n { name: \"subrs\", type: \"INDEX\", value: [] }\n ]);\n }\n function makeCharsets(glyphNames, strings) {\n const t = new table_default.Record(\"Charsets\", [\n { name: \"format\", type: \"Card8\", value: 0 }\n ]);\n for (let i = 0; i < glyphNames.length; i += 1) {\n const glyphName = glyphNames[i];\n const glyphSID = encodeString(glyphName, strings);\n t.fields.push({ name: \"glyph_\" + i, type: \"SID\", value: glyphSID });\n }\n return t;\n }\n function glyphToOps(glyph, version) {\n const ops = [];\n const path = glyph.path;\n if (version < 2) {\n ops.push({ name: \"width\", type: \"NUMBER\", value: glyph.advanceWidth });\n }\n let x = 0;\n let y = 0;\n for (let i = 0; i < path.commands.length; i += 1) {\n let dx;\n let dy;\n let cmd = path.commands[i];\n if (cmd.type === \"Q\") {\n const _13 = 1 / 3;\n const _23 = 2 / 3;\n cmd = {\n type: \"C\",\n x: cmd.x,\n y: cmd.y,\n x1: Math.round(_13 * x + _23 * cmd.x1),\n y1: Math.round(_13 * y + _23 * cmd.y1),\n x2: Math.round(_13 * cmd.x + _23 * cmd.x1),\n y2: Math.round(_13 * cmd.y + _23 * cmd.y1)\n };\n }\n if (cmd.type === \"M\") {\n dx = Math.round(cmd.x - x);\n dy = Math.round(cmd.y - y);\n ops.push({ name: \"dx\", type: \"NUMBER\", value: dx });\n ops.push({ name: \"dy\", type: \"NUMBER\", value: dy });\n ops.push({ name: \"rmoveto\", type: \"OP\", value: 21 });\n x = Math.round(cmd.x);\n y = Math.round(cmd.y);\n } else if (cmd.type === \"L\") {\n dx = Math.round(cmd.x - x);\n dy = Math.round(cmd.y - y);\n ops.push({ name: \"dx\", type: \"NUMBER\", value: dx });\n ops.push({ name: \"dy\", type: \"NUMBER\", value: dy });\n ops.push({ name: \"rlineto\", type: \"OP\", value: 5 });\n x = Math.round(cmd.x);\n y = Math.round(cmd.y);\n } else if (cmd.type === \"C\") {\n const dx1 = Math.round(cmd.x1 - x);\n const dy1 = Math.round(cmd.y1 - y);\n const dx2 = Math.round(cmd.x2 - cmd.x1);\n const dy2 = Math.round(cmd.y2 - cmd.y1);\n dx = Math.round(cmd.x - cmd.x2);\n dy = Math.round(cmd.y - cmd.y2);\n ops.push({ name: \"dx1\", type: \"NUMBER\", value: dx1 });\n ops.push({ name: \"dy1\", type: \"NUMBER\", value: dy1 });\n ops.push({ name: \"dx2\", type: \"NUMBER\", value: dx2 });\n ops.push({ name: \"dy2\", type: \"NUMBER\", value: dy2 });\n ops.push({ name: \"dx\", type: \"NUMBER\", value: dx });\n ops.push({ name: \"dy\", type: \"NUMBER\", value: dy });\n ops.push({ name: \"rrcurveto\", type: \"OP\", value: 8 });\n x = Math.round(cmd.x);\n y = Math.round(cmd.y);\n }\n }\n if (version < 2) {\n ops.push({ name: \"endchar\", type: \"OP\", value: 14 });\n }\n return ops;\n }\n function makeCharStringsIndex(glyphs, version) {\n const t = new table_default.Record(\"CharStrings INDEX\", [\n { name: \"charStrings\", type: \"INDEX\", value: [] }\n ]);\n for (let i = 0; i < glyphs.length; i += 1) {\n const glyph = glyphs.get(i);\n const ops = glyphToOps(glyph, version);\n t.charStrings.push({ name: glyph.name, type: \"CHARSTRING\", value: ops });\n }\n return t;\n }\n function makePrivateDict(attrs, strings, version) {\n const t = new table_default.Record(\"Private DICT\", [\n { name: \"dict\", type: \"DICT\", value: {} }\n ]);\n t.dict = makeDict(version > 1 ? PRIVATE_DICT_META_CFF2 : PRIVATE_DICT_META, attrs, strings);\n return t;\n }\n function makeCFFTable(glyphs, options) {\n const cffVersion = 1;\n const t = new table_default.Table(\"CFF \", [\n { name: \"header\", type: \"RECORD\" },\n { name: \"nameIndex\", type: \"RECORD\" },\n { name: \"topDictIndex\", type: \"RECORD\" },\n { name: \"stringIndex\", type: \"RECORD\" },\n { name: \"globalSubrIndex\", type: \"RECORD\" },\n { name: \"charsets\", type: \"RECORD\" },\n { name: \"charStringsIndex\", type: \"RECORD\" },\n { name: \"privateDict\", type: \"RECORD\" }\n ]);\n const fontScale = 1 / options.unitsPerEm;\n const attrs = {\n version: options.version,\n fullName: options.fullName,\n familyName: options.familyName,\n weight: options.weightName,\n fontBBox: options.fontBBox || [0, 0, 0, 0],\n fontMatrix: [fontScale, 0, 0, fontScale, 0, 0],\n charset: 999,\n encoding: 0,\n charStrings: 999,\n private: [0, 999]\n };\n const topDictOptions = options && options.topDict || {};\n if (cffVersion < 2 && topDictOptions.paintType) {\n attrs.paintType = topDictOptions.paintType;\n attrs.strokeWidth = topDictOptions.strokeWidth || 0;\n }\n const privateAttrs = {};\n const glyphNames = [];\n let glyph;\n for (let i = 1; i < glyphs.length; i += 1) {\n glyph = glyphs.get(i);\n glyphNames.push(glyph.name);\n }\n const strings = [];\n t.header = makeHeader();\n t.nameIndex = makeNameIndex([options.postScriptName]);\n let topDict = makeTopDict(attrs, strings);\n t.topDictIndex = makeTopDictIndex(topDict);\n t.globalSubrIndex = makeGlobalSubrIndex();\n t.charsets = makeCharsets(glyphNames, strings);\n t.charStringsIndex = makeCharStringsIndex(glyphs, cffVersion);\n t.privateDict = makePrivateDict(privateAttrs, strings);\n t.stringIndex = makeStringIndex(strings);\n const startOffset = t.header.sizeOf() + t.nameIndex.sizeOf() + t.topDictIndex.sizeOf() + t.stringIndex.sizeOf() + t.globalSubrIndex.sizeOf();\n attrs.charset = startOffset;\n attrs.encoding = 0;\n attrs.charStrings = attrs.charset + t.charsets.sizeOf();\n attrs.private[1] = attrs.charStrings + t.charStringsIndex.sizeOf();\n topDict = makeTopDict(attrs, strings);\n t.topDictIndex = makeTopDictIndex(topDict);\n return t;\n }\n var cff_default = { parse: parseCFFTable, make: makeCFFTable };\n\n // src/tables/head.mjs\n function parseHeadTable(data, start) {\n const head = {};\n const p = new parse_default.Parser(data, start);\n head.version = p.parseVersion();\n head.fontRevision = Math.round(p.parseFixed() * 1e3) / 1e3;\n head.checkSumAdjustment = p.parseULong();\n head.magicNumber = p.parseULong();\n check_default.argument(head.magicNumber === 1594834165, \"Font header has wrong magic number.\");\n head.flags = p.parseUShort();\n head.unitsPerEm = p.parseUShort();\n head.created = p.parseLongDateTime();\n head.modified = p.parseLongDateTime();\n head.xMin = p.parseShort();\n head.yMin = p.parseShort();\n head.xMax = p.parseShort();\n head.yMax = p.parseShort();\n head.macStyle = p.parseUShort();\n head.lowestRecPPEM = p.parseUShort();\n head.fontDirectionHint = p.parseShort();\n head.indexToLocFormat = p.parseShort();\n head.glyphDataFormat = p.parseShort();\n return head;\n }\n function makeHeadTable(options) {\n const timestamp = Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3) + 2082844800;\n let createdTimestamp = timestamp;\n let macStyle = options.macStyle || 0;\n if (options.createdTimestamp) {\n createdTimestamp = options.createdTimestamp + 2082844800;\n }\n return new table_default.Table(\"head\", [\n { name: \"version\", type: \"FIXED\", value: 65536 },\n { name: \"fontRevision\", type: \"FIXED\", value: 65536 },\n { name: \"checkSumAdjustment\", type: \"ULONG\", value: 0 },\n { name: \"magicNumber\", type: \"ULONG\", value: 1594834165 },\n { name: \"flags\", type: \"USHORT\", value: 0 },\n { name: \"unitsPerEm\", type: \"USHORT\", value: 1e3 },\n { name: \"created\", type: \"LONGDATETIME\", value: createdTimestamp },\n { name: \"modified\", type: \"LONGDATETIME\", value: timestamp },\n { name: \"xMin\", type: \"SHORT\", value: 0 },\n { name: \"yMin\", type: \"SHORT\", value: 0 },\n { name: \"xMax\", type: \"SHORT\", value: 0 },\n { name: \"yMax\", type: \"SHORT\", value: 0 },\n { name: \"macStyle\", type: \"USHORT\", value: macStyle },\n { name: \"lowestRecPPEM\", type: \"USHORT\", value: 0 },\n { name: \"fontDirectionHint\", type: \"SHORT\", value: 2 },\n { name: \"indexToLocFormat\", type: \"SHORT\", value: 0 },\n { name: \"glyphDataFormat\", type: \"SHORT\", value: 0 }\n ], options);\n }\n var head_default = { parse: parseHeadTable, make: makeHeadTable };\n\n // src/tables/hhea.mjs\n function parseHheaTable(data, start) {\n const hhea = {};\n const p = new parse_default.Parser(data, start);\n hhea.version = p.parseVersion();\n hhea.ascender = p.parseShort();\n hhea.descender = p.parseShort();\n hhea.lineGap = p.parseShort();\n hhea.advanceWidthMax = p.parseUShort();\n hhea.minLeftSideBearing = p.parseShort();\n hhea.minRightSideBearing = p.parseShort();\n hhea.xMaxExtent = p.parseShort();\n hhea.caretSlopeRise = p.parseShort();\n hhea.caretSlopeRun = p.parseShort();\n hhea.caretOffset = p.parseShort();\n p.relativeOffset += 8;\n hhea.metricDataFormat = p.parseShort();\n hhea.numberOfHMetrics = p.parseUShort();\n return hhea;\n }\n function makeHheaTable(options) {\n return new table_default.Table(\"hhea\", [\n { name: \"version\", type: \"FIXED\", value: 65536 },\n { name: \"ascender\", type: \"FWORD\", value: 0 },\n { name: \"descender\", type: \"FWORD\", value: 0 },\n { name: \"lineGap\", type: \"FWORD\", value: 0 },\n { name: \"advanceWidthMax\", type: \"UFWORD\", value: 0 },\n { name: \"minLeftSideBearing\", type: \"FWORD\", value: 0 },\n { name: \"minRightSideBearing\", type: \"FWORD\", value: 0 },\n { name: \"xMaxExtent\", type: \"FWORD\", value: 0 },\n { name: \"caretSlopeRise\", type: \"SHORT\", value: 1 },\n { name: \"caretSlopeRun\", type: \"SHORT\", value: 0 },\n { name: \"caretOffset\", type: \"SHORT\", value: 0 },\n { name: \"reserved1\", type: \"SHORT\", value: 0 },\n { name: \"reserved2\", type: \"SHORT\", value: 0 },\n { name: \"reserved3\", type: \"SHORT\", value: 0 },\n { name: \"reserved4\", type: \"SHORT\", value: 0 },\n { name: \"metricDataFormat\", type: \"SHORT\", value: 0 },\n { name: \"numberOfHMetrics\", type: \"USHORT\", value: 0 }\n ], options);\n }\n var hhea_default = { parse: parseHheaTable, make: makeHheaTable };\n\n // src/tables/hmtx.mjs\n function parseHmtxTableAll(data, start, numMetrics, numGlyphs, glyphs) {\n let advanceWidth;\n let leftSideBearing;\n const p = new parse_default.Parser(data, start);\n for (let i = 0; i < numGlyphs; i += 1) {\n if (i < numMetrics) {\n advanceWidth = p.parseUShort();\n leftSideBearing = p.parseShort();\n }\n const glyph = glyphs.get(i);\n glyph.advanceWidth = advanceWidth;\n glyph.leftSideBearing = leftSideBearing;\n }\n }\n function parseHmtxTableOnLowMemory(font, data, start, numMetrics, numGlyphs) {\n font._hmtxTableData = {};\n let advanceWidth;\n let leftSideBearing;\n const p = new parse_default.Parser(data, start);\n for (let i = 0; i < numGlyphs; i += 1) {\n if (i < numMetrics) {\n advanceWidth = p.parseUShort();\n leftSideBearing = p.parseShort();\n }\n font._hmtxTableData[i] = {\n advanceWidth,\n leftSideBearing\n };\n }\n }\n function parseHmtxTable(font, data, start, numMetrics, numGlyphs, glyphs, opt) {\n if (opt.lowMemory)\n parseHmtxTableOnLowMemory(font, data, start, numMetrics, numGlyphs);\n else\n parseHmtxTableAll(data, start, numMetrics, numGlyphs, glyphs);\n }\n function makeHmtxTable(glyphs) {\n const t = new table_default.Table(\"hmtx\", []);\n for (let i = 0; i < glyphs.length; i += 1) {\n const glyph = glyphs.get(i);\n const advanceWidth = glyph.advanceWidth || 0;\n const leftSideBearing = glyph.leftSideBearing || 0;\n t.fields.push({ name: \"advanceWidth_\" + i, type: \"USHORT\", value: advanceWidth });\n t.fields.push({ name: \"leftSideBearing_\" + i, type: \"SHORT\", value: leftSideBearing });\n }\n return t;\n }\n var hmtx_default = { parse: parseHmtxTable, make: makeHmtxTable };\n\n // src/tables/ltag.mjs\n function makeLtagTable(tags) {\n const result = new table_default.Table(\"ltag\", [\n { name: \"version\", type: \"ULONG\", value: 1 },\n { name: \"flags\", type: \"ULONG\", value: 0 },\n { name: \"numTags\", type: \"ULONG\", value: tags.length }\n ]);\n let stringPool = \"\";\n const stringPoolOffset = 12 + tags.length * 4;\n for (let i = 0; i < tags.length; ++i) {\n let pos = stringPool.indexOf(tags[i]);\n if (pos < 0) {\n pos = stringPool.length;\n stringPool += tags[i];\n }\n result.fields.push({ name: \"offset \" + i, type: \"USHORT\", value: stringPoolOffset + pos });\n result.fields.push({ name: \"length \" + i, type: \"USHORT\", value: tags[i].length });\n }\n result.fields.push({ name: \"stringPool\", type: \"CHARARRAY\", value: stringPool });\n return result;\n }\n function parseLtagTable(data, start) {\n const p = new parse_default.Parser(data, start);\n const tableVersion = p.parseULong();\n check_default.argument(tableVersion === 1, \"Unsupported ltag table version.\");\n p.skip(\"uLong\", 1);\n const numTags = p.parseULong();\n const tags = [];\n for (let i = 0; i < numTags; i++) {\n let tag = \"\";\n const offset = start + p.parseUShort();\n const length = p.parseUShort();\n for (let j = offset; j < offset + length; ++j) {\n tag += String.fromCharCode(data.getInt8(j));\n }\n tags.push(tag);\n }\n return tags;\n }\n var ltag_default = { make: makeLtagTable, parse: parseLtagTable };\n\n // src/tables/maxp.mjs\n function parseMaxpTable(data, start) {\n const maxp = {};\n const p = new parse_default.Parser(data, start);\n maxp.version = p.parseVersion();\n maxp.numGlyphs = p.parseUShort();\n if (maxp.version === 1) {\n maxp.maxPoints = p.parseUShort();\n maxp.maxContours = p.parseUShort();\n maxp.maxCompositePoints = p.parseUShort();\n maxp.maxCompositeContours = p.parseUShort();\n maxp.maxZones = p.parseUShort();\n maxp.maxTwilightPoints = p.parseUShort();\n maxp.maxStorage = p.parseUShort();\n maxp.maxFunctionDefs = p.parseUShort();\n maxp.maxInstructionDefs = p.parseUShort();\n maxp.maxStackElements = p.parseUShort();\n maxp.maxSizeOfInstructions = p.parseUShort();\n maxp.maxComponentElements = p.parseUShort();\n maxp.maxComponentDepth = p.parseUShort();\n }\n return maxp;\n }\n function makeMaxpTable(numGlyphs) {\n return new table_default.Table(\"maxp\", [\n { name: \"version\", type: \"FIXED\", value: 20480 },\n { name: \"numGlyphs\", type: \"USHORT\", value: numGlyphs }\n ]);\n }\n var maxp_default = { parse: parseMaxpTable, make: makeMaxpTable };\n\n // src/tables/os2.mjs\n var unicodeRanges = [\n { begin: 0, end: 127 },\n // Basic Latin\n { begin: 128, end: 255 },\n // Latin-1 Supplement\n { begin: 256, end: 383 },\n // Latin Extended-A\n { begin: 384, end: 591 },\n // Latin Extended-B\n { begin: 592, end: 687 },\n // IPA Extensions\n { begin: 688, end: 767 },\n // Spacing Modifier Letters\n { begin: 768, end: 879 },\n // Combining Diacritical Marks\n { begin: 880, end: 1023 },\n // Greek and Coptic\n { begin: 11392, end: 11519 },\n // Coptic\n { begin: 1024, end: 1279 },\n // Cyrillic\n { begin: 1328, end: 1423 },\n // Armenian\n { begin: 1424, end: 1535 },\n // Hebrew\n { begin: 42240, end: 42559 },\n // Vai\n { begin: 1536, end: 1791 },\n // Arabic\n { begin: 1984, end: 2047 },\n // NKo\n { begin: 2304, end: 2431 },\n // Devanagari\n { begin: 2432, end: 2559 },\n // Bengali\n { begin: 2560, end: 2687 },\n // Gurmukhi\n { begin: 2688, end: 2815 },\n // Gujarati\n { begin: 2816, end: 2943 },\n // Oriya\n { begin: 2944, end: 3071 },\n // Tamil\n { begin: 3072, end: 3199 },\n // Telugu\n { begin: 3200, end: 3327 },\n // Kannada\n { begin: 3328, end: 3455 },\n // Malayalam\n { begin: 3584, end: 3711 },\n // Thai\n { begin: 3712, end: 3839 },\n // Lao\n { begin: 4256, end: 4351 },\n // Georgian\n { begin: 6912, end: 7039 },\n // Balinese\n { begin: 4352, end: 4607 },\n // Hangul Jamo\n { begin: 7680, end: 7935 },\n // Latin Extended Additional\n { begin: 7936, end: 8191 },\n // Greek Extended\n { begin: 8192, end: 8303 },\n // General Punctuation\n { begin: 8304, end: 8351 },\n // Superscripts And Subscripts\n { begin: 8352, end: 8399 },\n // Currency Symbol\n { begin: 8400, end: 8447 },\n // Combining Diacritical Marks For Symbols\n { begin: 8448, end: 8527 },\n // Letterlike Symbols\n { begin: 8528, end: 8591 },\n // Number Forms\n { begin: 8592, end: 8703 },\n // Arrows\n { begin: 8704, end: 8959 },\n // Mathematical Operators\n { begin: 8960, end: 9215 },\n // Miscellaneous Technical\n { begin: 9216, end: 9279 },\n // Control Pictures\n { begin: 9280, end: 9311 },\n // Optical Character Recognition\n { begin: 9312, end: 9471 },\n // Enclosed Alphanumerics\n { begin: 9472, end: 9599 },\n // Box Drawing\n { begin: 9600, end: 9631 },\n // Block Elements\n { begin: 9632, end: 9727 },\n // Geometric Shapes\n { begin: 9728, end: 9983 },\n // Miscellaneous Symbols\n { begin: 9984, end: 10175 },\n // Dingbats\n { begin: 12288, end: 12351 },\n // CJK Symbols And Punctuation\n { begin: 12352, end: 12447 },\n // Hiragana\n { begin: 12448, end: 12543 },\n // Katakana\n { begin: 12544, end: 12591 },\n // Bopomofo\n { begin: 12592, end: 12687 },\n // Hangul Compatibility Jamo\n { begin: 43072, end: 43135 },\n // Phags-pa\n { begin: 12800, end: 13055 },\n // Enclosed CJK Letters And Months\n { begin: 13056, end: 13311 },\n // CJK Compatibility\n { begin: 44032, end: 55215 },\n // Hangul Syllables\n { begin: 55296, end: 57343 },\n // Non-Plane 0 *\n { begin: 67840, end: 67871 },\n // Phoenicia\n { begin: 19968, end: 40959 },\n // CJK Unified Ideographs\n { begin: 57344, end: 63743 },\n // Private Use Area (plane 0)\n { begin: 12736, end: 12783 },\n // CJK Strokes\n { begin: 64256, end: 64335 },\n // Alphabetic Presentation Forms\n { begin: 64336, end: 65023 },\n // Arabic Presentation Forms-A\n { begin: 65056, end: 65071 },\n // Combining Half Marks\n { begin: 65040, end: 65055 },\n // Vertical Forms\n { begin: 65104, end: 65135 },\n // Small Form Variants\n { begin: 65136, end: 65279 },\n // Arabic Presentation Forms-B\n { begin: 65280, end: 65519 },\n // Halfwidth And Fullwidth Forms\n { begin: 65520, end: 65535 },\n // Specials\n { begin: 3840, end: 4095 },\n // Tibetan\n { begin: 1792, end: 1871 },\n // Syriac\n { begin: 1920, end: 1983 },\n // Thaana\n { begin: 3456, end: 3583 },\n // Sinhala\n { begin: 4096, end: 4255 },\n // Myanmar\n { begin: 4608, end: 4991 },\n // Ethiopic\n { begin: 5024, end: 5119 },\n // Cherokee\n { begin: 5120, end: 5759 },\n // Unified Canadian Aboriginal Syllabics\n { begin: 5760, end: 5791 },\n // Ogham\n { begin: 5792, end: 5887 },\n // Runic\n { begin: 6016, end: 6143 },\n // Khmer\n { begin: 6144, end: 6319 },\n // Mongolian\n { begin: 10240, end: 10495 },\n // Braille Patterns\n { begin: 40960, end: 42127 },\n // Yi Syllables\n { begin: 5888, end: 5919 },\n // Tagalog\n { begin: 66304, end: 66351 },\n // Old Italic\n { begin: 66352, end: 66383 },\n // Gothic\n { begin: 66560, end: 66639 },\n // Deseret\n { begin: 118784, end: 119039 },\n // Byzantine Musical Symbols\n { begin: 119808, end: 120831 },\n // Mathematical Alphanumeric Symbols\n { begin: 1044480, end: 1048573 },\n // Private Use (plane 15)\n { begin: 65024, end: 65039 },\n // Variation Selectors\n { begin: 917504, end: 917631 },\n // Tags\n { begin: 6400, end: 6479 },\n // Limbu\n { begin: 6480, end: 6527 },\n // Tai Le\n { begin: 6528, end: 6623 },\n // New Tai Lue\n { begin: 6656, end: 6687 },\n // Buginese\n { begin: 11264, end: 11359 },\n // Glagolitic\n { begin: 11568, end: 11647 },\n // Tifinagh\n { begin: 19904, end: 19967 },\n // Yijing Hexagram Symbols\n { begin: 43008, end: 43055 },\n // Syloti Nagri\n { begin: 65536, end: 65663 },\n // Linear B Syllabary\n { begin: 65856, end: 65935 },\n // Ancient Greek Numbers\n { begin: 66432, end: 66463 },\n // Ugaritic\n { begin: 66464, end: 66527 },\n // Old Persian\n { begin: 66640, end: 66687 },\n // Shavian\n { begin: 66688, end: 66735 },\n // Osmanya\n { begin: 67584, end: 67647 },\n // Cypriot Syllabary\n { begin: 68096, end: 68191 },\n // Kharoshthi\n { begin: 119552, end: 119647 },\n // Tai Xuan Jing Symbols\n { begin: 73728, end: 74751 },\n // Cuneiform\n { begin: 119648, end: 119679 },\n // Counting Rod Numerals\n { begin: 7040, end: 7103 },\n // Sundanese\n { begin: 7168, end: 7247 },\n // Lepcha\n { begin: 7248, end: 7295 },\n // Ol Chiki\n { begin: 43136, end: 43231 },\n // Saurashtra\n { begin: 43264, end: 43311 },\n // Kayah Li\n { begin: 43312, end: 43359 },\n // Rejang\n { begin: 43520, end: 43615 },\n // Cham\n { begin: 65936, end: 65999 },\n // Ancient Symbols\n { begin: 66e3, end: 66047 },\n // Phaistos Disc\n { begin: 66208, end: 66271 },\n // Carian\n { begin: 127024, end: 127135 }\n // Domino Tiles\n ];\n function getUnicodeRange(unicode) {\n for (let i = 0; i < unicodeRanges.length; i += 1) {\n const range = unicodeRanges[i];\n if (unicode >= range.begin && unicode < range.end) {\n return i;\n }\n }\n return -1;\n }\n function parseOS2Table(data, start) {\n const os2 = {};\n const p = new parse_default.Parser(data, start);\n os2.version = p.parseUShort();\n os2.xAvgCharWidth = p.parseShort();\n os2.usWeightClass = p.parseUShort();\n os2.usWidthClass = p.parseUShort();\n os2.fsType = p.parseUShort();\n os2.ySubscriptXSize = p.parseShort();\n os2.ySubscriptYSize = p.parseShort();\n os2.ySubscriptXOffset = p.parseShort();\n os2.ySubscriptYOffset = p.parseShort();\n os2.ySuperscriptXSize = p.parseShort();\n os2.ySuperscriptYSize = p.parseShort();\n os2.ySuperscriptXOffset = p.parseShort();\n os2.ySuperscriptYOffset = p.parseShort();\n os2.yStrikeoutSize = p.parseShort();\n os2.yStrikeoutPosition = p.parseShort();\n os2.sFamilyClass = p.parseShort();\n os2.panose = [];\n for (let i = 0; i < 10; i++) {\n os2.panose[i] = p.parseByte();\n }\n os2.ulUnicodeRange1 = p.parseULong();\n os2.ulUnicodeRange2 = p.parseULong();\n os2.ulUnicodeRange3 = p.parseULong();\n os2.ulUnicodeRange4 = p.parseULong();\n os2.achVendID = String.fromCharCode(p.parseByte(), p.parseByte(), p.parseByte(), p.parseByte());\n os2.fsSelection = p.parseUShort();\n os2.usFirstCharIndex = p.parseUShort();\n os2.usLastCharIndex = p.parseUShort();\n os2.sTypoAscender = p.parseShort();\n os2.sTypoDescender = p.parseShort();\n os2.sTypoLineGap = p.parseShort();\n os2.usWinAscent = p.parseUShort();\n os2.usWinDescent = p.parseUShort();\n if (os2.version >= 1) {\n os2.ulCodePageRange1 = p.parseULong();\n os2.ulCodePageRange2 = p.parseULong();\n }\n if (os2.version >= 2) {\n os2.sxHeight = p.parseShort();\n os2.sCapHeight = p.parseShort();\n os2.usDefaultChar = p.parseUShort();\n os2.usBreakChar = p.parseUShort();\n os2.usMaxContent = p.parseUShort();\n }\n return os2;\n }\n function makeOS2Table(options) {\n return new table_default.Table(\"OS/2\", [\n { name: \"version\", type: \"USHORT\", value: 3 },\n { name: \"xAvgCharWidth\", type: \"SHORT\", value: 0 },\n { name: \"usWeightClass\", type: \"USHORT\", value: 0 },\n { name: \"usWidthClass\", type: \"USHORT\", value: 0 },\n { name: \"fsType\", type: \"USHORT\", value: 0 },\n { name: \"ySubscriptXSize\", type: \"SHORT\", value: 650 },\n { name: \"ySubscriptYSize\", type: \"SHORT\", value: 699 },\n { name: \"ySubscriptXOffset\", type: \"SHORT\", value: 0 },\n { name: \"ySubscriptYOffset\", type: \"SHORT\", value: 140 },\n { name: \"ySuperscriptXSize\", type: \"SHORT\", value: 650 },\n { name: \"ySuperscriptYSize\", type: \"SHORT\", value: 699 },\n { name: \"ySuperscriptXOffset\", type: \"SHORT\", value: 0 },\n { name: \"ySuperscriptYOffset\", type: \"SHORT\", value: 479 },\n { name: \"yStrikeoutSize\", type: \"SHORT\", value: 49 },\n { name: \"yStrikeoutPosition\", type: \"SHORT\", value: 258 },\n { name: \"sFamilyClass\", type: \"SHORT\", value: 0 },\n { name: \"bFamilyType\", type: \"BYTE\", value: 0 },\n { name: \"bSerifStyle\", type: \"BYTE\", value: 0 },\n { name: \"bWeight\", type: \"BYTE\", value: 0 },\n { name: \"bProportion\", type: \"BYTE\", value: 0 },\n { name: \"bContrast\", type: \"BYTE\", value: 0 },\n { name: \"bStrokeVariation\", type: \"BYTE\", value: 0 },\n { name: \"bArmStyle\", type: \"BYTE\", value: 0 },\n { name: \"bLetterform\", type: \"BYTE\", value: 0 },\n { name: \"bMidline\", type: \"BYTE\", value: 0 },\n { name: \"bXHeight\", type: \"BYTE\", value: 0 },\n { name: \"ulUnicodeRange1\", type: \"ULONG\", value: 0 },\n { name: \"ulUnicodeRange2\", type: \"ULONG\", value: 0 },\n { name: \"ulUnicodeRange3\", type: \"ULONG\", value: 0 },\n { name: \"ulUnicodeRange4\", type: \"ULONG\", value: 0 },\n { name: \"achVendID\", type: \"CHARARRAY\", value: \"XXXX\" },\n { name: \"fsSelection\", type: \"USHORT\", value: 0 },\n { name: \"usFirstCharIndex\", type: \"USHORT\", value: 0 },\n { name: \"usLastCharIndex\", type: \"USHORT\", value: 0 },\n { name: \"sTypoAscender\", type: \"SHORT\", value: 0 },\n { name: \"sTypoDescender\", type: \"SHORT\", value: 0 },\n { name: \"sTypoLineGap\", type: \"SHORT\", value: 0 },\n { name: \"usWinAscent\", type: \"USHORT\", value: 0 },\n { name: \"usWinDescent\", type: \"USHORT\", value: 0 },\n { name: \"ulCodePageRange1\", type: \"ULONG\", value: 0 },\n { name: \"ulCodePageRange2\", type: \"ULONG\", value: 0 },\n { name: \"sxHeight\", type: \"SHORT\", value: 0 },\n { name: \"sCapHeight\", type: \"SHORT\", value: 0 },\n { name: \"usDefaultChar\", type: \"USHORT\", value: 0 },\n { name: \"usBreakChar\", type: \"USHORT\", value: 0 },\n { name: \"usMaxContext\", type: \"USHORT\", value: 0 }\n ], options);\n }\n var os2_default = { parse: parseOS2Table, make: makeOS2Table, unicodeRanges, getUnicodeRange };\n\n // src/tables/post.mjs\n function parsePostTable(data, start) {\n const post = {};\n const p = new parse_default.Parser(data, start);\n post.version = p.parseVersion();\n post.italicAngle = p.parseFixed();\n post.underlinePosition = p.parseShort();\n post.underlineThickness = p.parseShort();\n post.isFixedPitch = p.parseULong();\n post.minMemType42 = p.parseULong();\n post.maxMemType42 = p.parseULong();\n post.minMemType1 = p.parseULong();\n post.maxMemType1 = p.parseULong();\n switch (post.version) {\n case 1:\n post.names = standardNames.slice();\n break;\n case 2:\n post.numberOfGlyphs = p.parseUShort();\n post.glyphNameIndex = new Array(post.numberOfGlyphs);\n for (let i = 0; i < post.numberOfGlyphs; i++) {\n post.glyphNameIndex[i] = p.parseUShort();\n }\n post.names = [];\n for (let i = 0; i < post.numberOfGlyphs; i++) {\n if (post.glyphNameIndex[i] >= standardNames.length) {\n const nameLength = p.parseChar();\n post.names.push(p.parseString(nameLength));\n }\n }\n break;\n case 2.5:\n post.numberOfGlyphs = p.parseUShort();\n post.offset = new Array(post.numberOfGlyphs);\n for (let i = 0; i < post.numberOfGlyphs; i++) {\n post.offset[i] = p.parseChar();\n }\n break;\n }\n return post;\n }\n function makePostTable(font) {\n const {\n italicAngle = Math.round((font.italicAngle || 0) * 65536),\n underlinePosition = 0,\n underlineThickness = 0,\n isFixedPitch = 0,\n minMemType42 = 0,\n maxMemType42 = 0,\n minMemType1 = 0,\n maxMemType1 = 0\n } = font.tables.post || {};\n return new table_default.Table(\"post\", [\n { name: \"version\", type: \"FIXED\", value: 196608 },\n { name: \"italicAngle\", type: \"FIXED\", value: italicAngle },\n { name: \"underlinePosition\", type: \"FWORD\", value: underlinePosition },\n { name: \"underlineThickness\", type: \"FWORD\", value: underlineThickness },\n { name: \"isFixedPitch\", type: \"ULONG\", value: isFixedPitch },\n { name: \"minMemType42\", type: \"ULONG\", value: minMemType42 },\n { name: \"maxMemType42\", type: \"ULONG\", value: maxMemType42 },\n { name: \"minMemType1\", type: \"ULONG\", value: minMemType1 },\n { name: \"maxMemType1\", type: \"ULONG\", value: maxMemType1 }\n ]);\n }\n var post_default = { parse: parsePostTable, make: makePostTable };\n\n // src/tables/gsub.mjs\n var subtableParsers = new Array(9);\n subtableParsers[1] = function parseLookup1() {\n const start = this.offset + this.relativeOffset;\n const substFormat = this.parseUShort();\n if (substFormat === 1) {\n return {\n substFormat: 1,\n coverage: this.parsePointer(Parser.coverage),\n deltaGlyphId: this.parseShort()\n };\n } else if (substFormat === 2) {\n return {\n substFormat: 2,\n coverage: this.parsePointer(Parser.coverage),\n substitute: this.parseOffset16List()\n };\n }\n check_default.assert(false, \"0x\" + start.toString(16) + \": lookup type 1 format must be 1 or 2.\");\n };\n subtableParsers[2] = function parseLookup2() {\n const substFormat = this.parseUShort();\n check_default.argument(substFormat === 1, \"GSUB Multiple Substitution Subtable identifier-format must be 1\");\n return {\n substFormat,\n coverage: this.parsePointer(Parser.coverage),\n sequences: this.parseListOfLists()\n };\n };\n subtableParsers[3] = function parseLookup3() {\n const substFormat = this.parseUShort();\n check_default.argument(substFormat === 1, \"GSUB Alternate Substitution Subtable identifier-format must be 1\");\n return {\n substFormat,\n coverage: this.parsePointer(Parser.coverage),\n alternateSets: this.parseListOfLists()\n };\n };\n subtableParsers[4] = function parseLookup4() {\n const substFormat = this.parseUShort();\n check_default.argument(substFormat === 1, \"GSUB ligature table identifier-format must be 1\");\n return {\n substFormat,\n coverage: this.parsePointer(Parser.coverage),\n ligatureSets: this.parseListOfLists(function() {\n return {\n ligGlyph: this.parseUShort(),\n components: this.parseUShortList(this.parseUShort() - 1)\n };\n })\n };\n };\n var lookupRecordDesc = {\n sequenceIndex: Parser.uShort,\n lookupListIndex: Parser.uShort\n };\n subtableParsers[5] = function parseLookup5() {\n const start = this.offset + this.relativeOffset;\n const substFormat = this.parseUShort();\n if (substFormat === 1) {\n return {\n substFormat,\n coverage: this.parsePointer(Parser.coverage),\n ruleSets: this.parseListOfLists(function() {\n const glyphCount = this.parseUShort();\n const substCount = this.parseUShort();\n return {\n input: this.parseUShortList(glyphCount - 1),\n lookupRecords: this.parseRecordList(substCount, lookupRecordDesc)\n };\n })\n };\n } else if (substFormat === 2) {\n return {\n substFormat,\n coverage: this.parsePointer(Parser.coverage),\n classDef: this.parsePointer(Parser.classDef),\n classSets: this.parseListOfLists(function() {\n const glyphCount = this.parseUShort();\n const substCount = this.parseUShort();\n return {\n classes: this.parseUShortList(glyphCount - 1),\n lookupRecords: this.parseRecordList(substCount, lookupRecordDesc)\n };\n })\n };\n } else if (substFormat === 3) {\n const glyphCount = this.parseUShort();\n const substCount = this.parseUShort();\n return {\n substFormat,\n coverages: this.parseList(glyphCount, Parser.pointer(Parser.coverage)),\n lookupRecords: this.parseRecordList(substCount, lookupRecordDesc)\n };\n }\n check_default.assert(false, \"0x\" + start.toString(16) + \": lookup type 5 format must be 1, 2 or 3.\");\n };\n subtableParsers[6] = function parseLookup6() {\n const start = this.offset + this.relativeOffset;\n const substFormat = this.parseUShort();\n if (substFormat === 1) {\n return {\n substFormat: 1,\n coverage: this.parsePointer(Parser.coverage),\n chainRuleSets: this.parseListOfLists(function() {\n return {\n backtrack: this.parseUShortList(),\n input: this.parseUShortList(this.parseShort() - 1),\n lookahead: this.parseUShortList(),\n lookupRecords: this.parseRecordList(lookupRecordDesc)\n };\n })\n };\n } else if (substFormat === 2) {\n return {\n substFormat: 2,\n coverage: this.parsePointer(Parser.coverage),\n backtrackClassDef: this.parsePointer(Parser.classDef),\n inputClassDef: this.parsePointer(Parser.classDef),\n lookaheadClassDef: this.parsePointer(Parser.classDef),\n chainClassSet: this.parseListOfLists(function() {\n return {\n backtrack: this.parseUShortList(),\n input: this.parseUShortList(this.parseShort() - 1),\n lookahead: this.parseUShortList(),\n lookupRecords: this.parseRecordList(lookupRecordDesc)\n };\n })\n };\n } else if (substFormat === 3) {\n return {\n substFormat: 3,\n backtrackCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n inputCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n lookaheadCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n lookupRecords: this.parseRecordList(lookupRecordDesc)\n };\n }\n check_default.assert(false, \"0x\" + start.toString(16) + \": lookup type 6 format must be 1, 2 or 3.\");\n };\n subtableParsers[7] = function parseLookup7() {\n const substFormat = this.parseUShort();\n check_default.argument(substFormat === 1, \"GSUB Extension Substitution subtable identifier-format must be 1\");\n const extensionLookupType = this.parseUShort();\n const extensionParser = new Parser(this.data, this.offset + this.parseULong());\n return {\n substFormat: 1,\n lookupType: extensionLookupType,\n extension: subtableParsers[extensionLookupType].call(extensionParser)\n };\n };\n subtableParsers[8] = function parseLookup8() {\n const substFormat = this.parseUShort();\n check_default.argument(substFormat === 1, \"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1\");\n return {\n substFormat,\n coverage: this.parsePointer(Parser.coverage),\n backtrackCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n lookaheadCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n substitutes: this.parseUShortList()\n };\n };\n function parseGsubTable(data, start) {\n start = start || 0;\n const p = new Parser(data, start);\n const tableVersion = p.parseVersion(1);\n check_default.argument(tableVersion === 1 || tableVersion === 1.1, \"Unsupported GSUB table version.\");\n if (tableVersion === 1) {\n return {\n version: tableVersion,\n scripts: p.parseScriptList(),\n features: p.parseFeatureList(),\n lookups: p.parseLookupList(subtableParsers)\n };\n } else {\n return {\n version: tableVersion,\n scripts: p.parseScriptList(),\n features: p.parseFeatureList(),\n lookups: p.parseLookupList(subtableParsers),\n variations: p.parseFeatureVariationsList()\n };\n }\n }\n var subtableMakers = new Array(9);\n subtableMakers[1] = function makeLookup1(subtable) {\n if (subtable.substFormat === 1) {\n return new table_default.Table(\"substitutionTable\", [\n { name: \"substFormat\", type: \"USHORT\", value: 1 },\n { name: \"coverage\", type: \"TABLE\", value: new table_default.Coverage(subtable.coverage) },\n { name: \"deltaGlyphID\", type: \"SHORT\", value: subtable.deltaGlyphId }\n ]);\n } else if (subtable.substFormat === 2) {\n return new table_default.Table(\"substitutionTable\", [\n { name: \"substFormat\", type: \"USHORT\", value: 2 },\n { name: \"coverage\", type: \"TABLE\", value: new table_default.Coverage(subtable.coverage) }\n ].concat(table_default.ushortList(\"substitute\", subtable.substitute)));\n }\n check_default.fail(\"Lookup type 1 substFormat must be 1 or 2.\");\n };\n subtableMakers[2] = function makeLookup2(subtable) {\n check_default.assert(subtable.substFormat === 1, \"Lookup type 2 substFormat must be 1.\");\n return new table_default.Table(\"substitutionTable\", [\n { name: \"substFormat\", type: \"USHORT\", value: 1 },\n { name: \"coverage\", type: \"TABLE\", value: new table_default.Coverage(subtable.coverage) }\n ].concat(table_default.tableList(\"seqSet\", subtable.sequences, function(sequenceSet) {\n return new table_default.Table(\"sequenceSetTable\", table_default.ushortList(\"sequence\", sequenceSet));\n })));\n };\n subtableMakers[3] = function makeLookup3(subtable) {\n check_default.assert(subtable.substFormat === 1, \"Lookup type 3 substFormat must be 1.\");\n return new table_default.Table(\"substitutionTable\", [\n { name: \"substFormat\", type: \"USHORT\", value: 1 },\n { name: \"coverage\", type: \"TABLE\", value: new table_default.Coverage(subtable.coverage) }\n ].concat(table_default.tableList(\"altSet\", subtable.alternateSets, function(alternateSet) {\n return new table_default.Table(\"alternateSetTable\", table_default.ushortList(\"alternate\", alternateSet));\n })));\n };\n subtableMakers[4] = function makeLookup4(subtable) {\n check_default.assert(subtable.substFormat === 1, \"Lookup type 4 substFormat must be 1.\");\n return new table_default.Table(\"substitutionTable\", [\n { name: \"substFormat\", type: \"USHORT\", value: 1 },\n { name: \"coverage\", type: \"TABLE\", value: new table_default.Coverage(subtable.coverage) }\n ].concat(table_default.tableList(\"ligSet\", subtable.ligatureSets, function(ligatureSet) {\n return new table_default.Table(\"ligatureSetTable\", table_default.tableList(\"ligature\", ligatureSet, function(ligature) {\n return new table_default.Table(\n \"ligatureTable\",\n [{ name: \"ligGlyph\", type: \"USHORT\", value: ligature.ligGlyph }].concat(table_default.ushortList(\"component\", ligature.components, ligature.components.length + 1))\n );\n }));\n })));\n };\n subtableMakers[5] = function makeLookup5(subtable) {\n if (subtable.substFormat === 1) {\n return new table_default.Table(\"contextualSubstitutionTable\", [\n { name: \"substFormat\", type: \"USHORT\", value: subtable.substFormat },\n { name: \"coverage\", type: \"TABLE\", value: new table_default.Coverage(subtable.coverage) }\n ].concat(table_default.tableList(\"sequenceRuleSet\", subtable.ruleSets, function(sequenceRuleSet) {\n if (!sequenceRuleSet) {\n return new table_default.Table(\"NULL\", null);\n }\n return new table_default.Table(\"sequenceRuleSetTable\", table_default.tableList(\"sequenceRule\", sequenceRuleSet, function(sequenceRule) {\n let tableData = table_default.ushortList(\"seqLookup\", [], sequenceRule.lookupRecords.length).concat(table_default.ushortList(\"inputSequence\", sequenceRule.input, sequenceRule.input.length + 1));\n [tableData[0], tableData[1]] = [tableData[1], tableData[0]];\n for (let i = 0; i < sequenceRule.lookupRecords.length; i++) {\n const record = sequenceRule.lookupRecords[i];\n tableData = tableData.concat({ name: \"sequenceIndex\" + i, type: \"USHORT\", value: record.sequenceIndex }).concat({ name: \"lookupListIndex\" + i, type: \"USHORT\", value: record.lookupListIndex });\n }\n return new table_default.Table(\"sequenceRuleTable\", tableData);\n }));\n })));\n } else if (subtable.substFormat === 2) {\n return new table_default.Table(\"contextualSubstitutionTable\", [\n { name: \"substFormat\", type: \"USHORT\", value: subtable.substFormat },\n { name: \"coverage\", type: \"TABLE\", value: new table_default.Coverage(subtable.coverage) },\n { name: \"classDef\", type: \"TABLE\", value: new table_default.ClassDef(subtable.classDef) }\n ].concat(table_default.tableList(\"classSeqRuleSet\", subtable.classSets, function(classSeqRuleSet) {\n if (!classSeqRuleSet) {\n return new table_default.Table(\"NULL\", null);\n }\n return new table_default.Table(\"classSeqRuleSetTable\", table_default.tableList(\"classSeqRule\", classSeqRuleSet, function(classSeqRule) {\n let tableData = table_default.ushortList(\"classes\", classSeqRule.classes, classSeqRule.classes.length + 1).concat(table_default.ushortList(\"seqLookupCount\", [], classSeqRule.lookupRecords.length));\n for (let i = 0; i < classSeqRule.lookupRecords.length; i++) {\n const record = classSeqRule.lookupRecords[i];\n tableData = tableData.concat({ name: \"sequenceIndex\" + i, type: \"USHORT\", value: record.sequenceIndex }).concat({ name: \"lookupListIndex\" + i, type: \"USHORT\", value: record.lookupListIndex });\n }\n return new table_default.Table(\"classSeqRuleTable\", tableData);\n }));\n })));\n } else if (subtable.substFormat === 3) {\n let tableData = [\n { name: \"substFormat\", type: \"USHORT\", value: subtable.substFormat }\n ];\n tableData.push({ name: \"inputGlyphCount\", type: \"USHORT\", value: subtable.coverages.length });\n tableData.push({ name: \"substitutionCount\", type: \"USHORT\", value: subtable.lookupRecords.length });\n for (let i = 0; i < subtable.coverages.length; i++) {\n const coverage = subtable.coverages[i];\n tableData.push({ name: \"inputCoverage\" + i, type: \"TABLE\", value: new table_default.Coverage(coverage) });\n }\n for (let i = 0; i < subtable.lookupRecords.length; i++) {\n const record = subtable.lookupRecords[i];\n tableData = tableData.concat({ name: \"sequenceIndex\" + i, type: \"USHORT\", value: record.sequenceIndex }).concat({ name: \"lookupListIndex\" + i, type: \"USHORT\", value: record.lookupListIndex });\n }\n let returnTable = new table_default.Table(\"contextualSubstitutionTable\", tableData);\n return returnTable;\n }\n check_default.assert(false, \"lookup type 5 format must be 1, 2 or 3.\");\n };\n subtableMakers[6] = function makeLookup6(subtable) {\n if (subtable.substFormat === 1) {\n let returnTable = new table_default.Table(\"chainContextTable\", [\n { name: \"substFormat\", type: \"USHORT\", value: subtable.substFormat },\n { name: \"coverage\", type: \"TABLE\", value: new table_default.Coverage(subtable.coverage) }\n ].concat(table_default.tableList(\"chainRuleSet\", subtable.chainRuleSets, function(chainRuleSet) {\n return new table_default.Table(\"chainRuleSetTable\", table_default.tableList(\"chainRule\", chainRuleSet, function(chainRule) {\n let tableData = table_default.ushortList(\"backtrackGlyph\", chainRule.backtrack, chainRule.backtrack.length).concat(table_default.ushortList(\"inputGlyph\", chainRule.input, chainRule.input.length + 1)).concat(table_default.ushortList(\"lookaheadGlyph\", chainRule.lookahead, chainRule.lookahead.length)).concat(table_default.ushortList(\"substitution\", [], chainRule.lookupRecords.length));\n for (let i = 0; i < chainRule.lookupRecords.length; i++) {\n const record = chainRule.lookupRecords[i];\n tableData = tableData.concat({ name: \"sequenceIndex\" + i, type: \"USHORT\", value: record.sequenceIndex }).concat({ name: \"lookupListIndex\" + i, type: \"USHORT\", value: record.lookupListIndex });\n }\n return new table_default.Table(\"chainRuleTable\", tableData);\n }));\n })));\n return returnTable;\n } else if (subtable.substFormat === 2) {\n check_default.assert(false, \"lookup type 6 format 2 is not yet supported.\");\n } else if (subtable.substFormat === 3) {\n let tableData = [\n { name: \"substFormat\", type: \"USHORT\", value: subtable.substFormat }\n ];\n tableData.push({ name: \"backtrackGlyphCount\", type: \"USHORT\", value: subtable.backtrackCoverage.length });\n for (let i = 0; i < subtable.backtrackCoverage.length; i++) {\n const coverage = subtable.backtrackCoverage[i];\n tableData.push({ name: \"backtrackCoverage\" + i, type: \"TABLE\", value: new table_default.Coverage(coverage) });\n }\n tableData.push({ name: \"inputGlyphCount\", type: \"USHORT\", value: subtable.inputCoverage.length });\n for (let i = 0; i < subtable.inputCoverage.length; i++) {\n const coverage = subtable.inputCoverage[i];\n tableData.push({ name: \"inputCoverage\" + i, type: \"TABLE\", value: new table_default.Coverage(coverage) });\n }\n tableData.push({ name: \"lookaheadGlyphCount\", type: \"USHORT\", value: subtable.lookaheadCoverage.length });\n for (let i = 0; i < subtable.lookaheadCoverage.length; i++) {\n const coverage = subtable.lookaheadCoverage[i];\n tableData.push({ name: \"lookaheadCoverage\" + i, type: \"TABLE\", value: new table_default.Coverage(coverage) });\n }\n tableData.push({ name: \"substitutionCount\", type: \"USHORT\", value: subtable.lookupRecords.length });\n for (let i = 0; i < subtable.lookupRecords.length; i++) {\n const record = subtable.lookupRecords[i];\n tableData = tableData.concat({ name: \"sequenceIndex\" + i, type: \"USHORT\", value: record.sequenceIndex }).concat({ name: \"lookupListIndex\" + i, type: \"USHORT\", value: record.lookupListIndex });\n }\n let returnTable = new table_default.Table(\"chainContextTable\", tableData);\n return returnTable;\n }\n check_default.assert(false, \"lookup type 6 format must be 1, 2 or 3.\");\n };\n function makeGsubTable(gsub) {\n return new table_default.Table(\"GSUB\", [\n { name: \"version\", type: \"ULONG\", value: 65536 },\n { name: \"scripts\", type: \"TABLE\", value: new table_default.ScriptList(gsub.scripts) },\n { name: \"features\", type: \"TABLE\", value: new table_default.FeatureList(gsub.features) },\n { name: \"lookups\", type: \"TABLE\", value: new table_default.LookupList(gsub.lookups, subtableMakers) }\n ]);\n }\n var gsub_default = { parse: parseGsubTable, make: makeGsubTable };\n\n // src/tables/meta.mjs\n function parseMetaTable(data, start) {\n const p = new parse_default.Parser(data, start);\n const tableVersion = p.parseULong();\n check_default.argument(tableVersion === 1, \"Unsupported META table version.\");\n p.parseULong();\n p.parseULong();\n const numDataMaps = p.parseULong();\n const tags = {};\n for (let i = 0; i < numDataMaps; i++) {\n const tag = p.parseTag();\n const dataOffset = p.parseULong();\n const dataLength = p.parseULong();\n if (tag === \"appl\" || tag === \"bild\")\n continue;\n const text = decode.UTF8(data, start + dataOffset, dataLength);\n tags[tag] = text;\n }\n return tags;\n }\n function makeMetaTable(tags) {\n const numTags = Object.keys(tags).length;\n let stringPool = \"\";\n const stringPoolOffset = 16 + numTags * 12;\n const result = new table_default.Table(\"meta\", [\n { name: \"version\", type: \"ULONG\", value: 1 },\n { name: \"flags\", type: \"ULONG\", value: 0 },\n { name: \"offset\", type: \"ULONG\", value: stringPoolOffset },\n { name: \"numTags\", type: \"ULONG\", value: numTags }\n ]);\n for (let tag in tags) {\n const pos = stringPool.length;\n stringPool += tags[tag];\n result.fields.push({ name: \"tag \" + tag, type: \"TAG\", value: tag });\n result.fields.push({ name: \"offset \" + tag, type: \"ULONG\", value: stringPoolOffset + pos });\n result.fields.push({ name: \"length \" + tag, type: \"ULONG\", value: tags[tag].length });\n }\n result.fields.push({ name: \"stringPool\", type: \"CHARARRAY\", value: stringPool });\n return result;\n }\n var meta_default = { parse: parseMetaTable, make: makeMetaTable };\n\n // src/tables/colr.mjs\n function parseColrTable(data, start) {\n const p = new Parser(data, start);\n const version = p.parseUShort();\n if (version !== 0) {\n console.warn(\"Only COLRv0 is currently fully supported. A subset of color glyphs might be available in this font if provided in the v0 format.\");\n }\n const numBaseGlyphRecords = p.parseUShort();\n const baseGlyphRecordsOffset = p.parseOffset32();\n const layerRecordsOffset = p.parseOffset32();\n const numLayerRecords = p.parseUShort();\n p.relativeOffset = baseGlyphRecordsOffset;\n const baseGlyphRecords = p.parseRecordList(numBaseGlyphRecords, {\n glyphID: Parser.uShort,\n firstLayerIndex: Parser.uShort,\n numLayers: Parser.uShort\n });\n p.relativeOffset = layerRecordsOffset;\n const layerRecords = p.parseRecordList(numLayerRecords, {\n glyphID: Parser.uShort,\n paletteIndex: Parser.uShort\n });\n return {\n version,\n baseGlyphRecords,\n layerRecords\n };\n }\n function makeColrTable({ version = 0, baseGlyphRecords = [], layerRecords = [] }) {\n check_default.argument(version === 0, \"Only COLRv0 supported.\");\n const baseGlyphRecordsOffset = 14;\n const layerRecordsOffset = baseGlyphRecordsOffset + baseGlyphRecords.length * 6;\n return new table_default.Table(\"COLR\", [\n { name: \"version\", type: \"USHORT\", value: version },\n { name: \"numBaseGlyphRecords\", type: \"USHORT\", value: baseGlyphRecords.length },\n { name: \"baseGlyphRecordsOffset\", type: \"ULONG\", value: baseGlyphRecordsOffset },\n { name: \"layerRecordsOffset\", type: \"ULONG\", value: layerRecordsOffset },\n { name: \"numLayerRecords\", type: \"USHORT\", value: layerRecords.length },\n ...baseGlyphRecords.map((glyph, i) => [\n { name: \"glyphID_\" + i, type: \"USHORT\", value: glyph.glyphID },\n { name: \"firstLayerIndex_\" + i, type: \"USHORT\", value: glyph.firstLayerIndex },\n { name: \"numLayers_\" + i, type: \"USHORT\", value: glyph.numLayers }\n ]).flat(),\n ...layerRecords.map((layer, i) => [\n { name: \"LayerGlyphID_\" + i, type: \"USHORT\", value: layer.glyphID },\n { name: \"paletteIndex_\" + i, type: \"USHORT\", value: layer.paletteIndex }\n ]).flat()\n ]);\n }\n var colr_default = { parse: parseColrTable, make: makeColrTable };\n\n // src/tables/fvar.mjs\n function makeFvarAxis(n, axis) {\n return [\n { name: \"tag_\" + n, type: \"TAG\", value: axis.tag },\n { name: \"minValue_\" + n, type: \"FIXED\", value: axis.minValue << 16 },\n { name: \"defaultValue_\" + n, type: \"FIXED\", value: axis.defaultValue << 16 },\n { name: \"maxValue_\" + n, type: \"FIXED\", value: axis.maxValue << 16 },\n { name: \"flags_\" + n, type: \"USHORT\", value: 0 },\n { name: \"nameID_\" + n, type: \"USHORT\", value: axis.axisNameID }\n ];\n }\n function parseFvarAxis(data, start, names) {\n const axis = {};\n const p = new parse_default.Parser(data, start);\n axis.tag = p.parseTag();\n axis.minValue = p.parseFixed();\n axis.defaultValue = p.parseFixed();\n axis.maxValue = p.parseFixed();\n p.skip(\"uShort\", 1);\n const axisNameID = p.parseUShort();\n axis.axisNameID = axisNameID;\n axis.name = getNameByID(names, axisNameID);\n return axis;\n }\n function makeFvarInstance(n, inst, axes, optionalFields = {}) {\n const fields = [\n { name: \"nameID_\" + n, type: \"USHORT\", value: inst.subfamilyNameID },\n { name: \"flags_\" + n, type: \"USHORT\", value: 0 }\n ];\n for (let i = 0; i < axes.length; ++i) {\n const axisTag = axes[i].tag;\n fields.push({\n name: \"axis_\" + n + \" \" + axisTag,\n type: \"FIXED\",\n value: inst.coordinates[axisTag] << 16\n });\n }\n if (optionalFields && optionalFields.postScriptNameID) {\n fields.push({\n name: \"postScriptNameID_\",\n type: \"USHORT\",\n value: inst.postScriptNameID !== void 0 ? inst.postScriptNameID : 65535\n });\n }\n return fields;\n }\n function parseFvarInstance(data, start, axes, names, instanceSize) {\n const inst = {};\n const p = new parse_default.Parser(data, start);\n const subfamilyNameID = p.parseUShort();\n inst.subfamilyNameID = subfamilyNameID;\n inst.name = getNameByID(names, subfamilyNameID, [2, 17]);\n p.skip(\"uShort\", 1);\n inst.coordinates = {};\n for (let i = 0; i < axes.length; ++i) {\n inst.coordinates[axes[i].tag] = p.parseFixed();\n }\n if (p.relativeOffset === instanceSize) {\n inst.postScriptNameID = void 0;\n inst.postScriptName = void 0;\n return inst;\n }\n const postScriptNameID = p.parseUShort();\n inst.postScriptNameID = postScriptNameID == 65535 ? void 0 : postScriptNameID;\n inst.postScriptName = inst.postScriptNameID !== void 0 ? getNameByID(names, postScriptNameID, [6]) : \"\";\n return inst;\n }\n function makeFvarTable(fvar, names) {\n const result = new table_default.Table(\"fvar\", [\n { name: \"version\", type: \"ULONG\", value: 65536 },\n { name: \"offsetToData\", type: \"USHORT\", value: 0 },\n { name: \"countSizePairs\", type: \"USHORT\", value: 2 },\n { name: \"axisCount\", type: \"USHORT\", value: fvar.axes.length },\n { name: \"axisSize\", type: \"USHORT\", value: 20 },\n { name: \"instanceCount\", type: \"USHORT\", value: fvar.instances.length },\n { name: \"instanceSize\", type: \"USHORT\", value: 4 + fvar.axes.length * 4 }\n ]);\n result.offsetToData = result.sizeOf();\n for (let i = 0; i < fvar.axes.length; i++) {\n result.fields = result.fields.concat(makeFvarAxis(i, fvar.axes[i], names));\n }\n const optionalFields = {};\n for (let j = 0; j < fvar.instances.length; j++) {\n if (fvar.instances[j].postScriptNameID !== void 0) {\n result.instanceSize += 2;\n optionalFields.postScriptNameID = true;\n break;\n }\n }\n for (let j = 0; j < fvar.instances.length; j++) {\n result.fields = result.fields.concat(makeFvarInstance(\n j,\n fvar.instances[j],\n fvar.axes,\n optionalFields\n ));\n }\n return result;\n }\n function parseFvarTable(data, start, names) {\n const p = new parse_default.Parser(data, start);\n const tableVersion = p.parseULong();\n check_default.argument(tableVersion === 65536, \"Unsupported fvar table version.\");\n const offsetToData = p.parseOffset16();\n p.skip(\"uShort\", 1);\n const axisCount = p.parseUShort();\n const axisSize = p.parseUShort();\n const instanceCount = p.parseUShort();\n const instanceSize = p.parseUShort();\n const axes = [];\n for (let i = 0; i < axisCount; i++) {\n axes.push(parseFvarAxis(data, start + offsetToData + i * axisSize, names));\n }\n const instances = [];\n const instanceStart = start + offsetToData + axisCount * axisSize;\n for (let j = 0; j < instanceCount; j++) {\n instances.push(parseFvarInstance(data, instanceStart + j * instanceSize, axes, names, instanceSize));\n }\n return { axes, instances };\n }\n var fvar_default = { make: makeFvarTable, parse: parseFvarTable };\n\n // src/tables/stat.mjs\n var axisRecordStruct = {\n tag: Parser.tag,\n nameID: Parser.uShort,\n ordering: Parser.uShort\n };\n var axisValueParsers = new Array(5);\n axisValueParsers[1] = function axisValueParser1() {\n return {\n axisIndex: this.parseUShort(),\n flags: this.parseUShort(),\n valueNameID: this.parseUShort(),\n value: this.parseFixed()\n };\n };\n axisValueParsers[2] = function axisValueParser2() {\n return {\n axisIndex: this.parseUShort(),\n flags: this.parseUShort(),\n valueNameID: this.parseUShort(),\n nominalValue: this.parseFixed(),\n rangeMinValue: this.parseFixed(),\n rangeMaxValue: this.parseFixed()\n };\n };\n axisValueParsers[3] = function axisValueParser3() {\n return {\n axisIndex: this.parseUShort(),\n flags: this.parseUShort(),\n valueNameID: this.parseUShort(),\n value: this.parseFixed(),\n linkedValue: this.parseFixed()\n };\n };\n axisValueParsers[4] = function axisValueParser4() {\n const axisCount = this.parseUShort();\n return {\n flags: this.parseUShort(),\n valueNameID: this.parseUShort(),\n axisValues: this.parseList(axisCount, function() {\n return {\n axisIndex: this.parseUShort(),\n value: this.parseFixed()\n };\n })\n };\n };\n function parseSTATAxisValue() {\n const valueTableFormat = this.parseUShort();\n const axisValueParser = axisValueParsers[valueTableFormat];\n const formatStub = {\n format: valueTableFormat\n };\n if (axisValueParser === void 0) {\n console.warn(`Unknown axis value table format ${valueTableFormat}`);\n return formatStub;\n }\n return Object.assign(formatStub, this.parseStruct(axisValueParser.bind(this)));\n }\n function parseSTATTable(data, start, fvar) {\n if (!start) {\n start = 0;\n }\n const p = new parse_default.Parser(data, start);\n const tableVersionMajor = p.parseUShort();\n const tableVersionMinor = p.parseUShort();\n if (tableVersionMajor !== 1) {\n console.warn(`Unsupported STAT table version ${tableVersionMajor}.${tableVersionMinor}`);\n }\n const version = [\n tableVersionMajor,\n tableVersionMinor\n ];\n const designAxisSize = p.parseUShort();\n const designAxisCount = p.parseUShort();\n const designAxesOffset = p.parseOffset32();\n const axisValueCount = p.parseUShort();\n const offsetToAxisValueOffsets = p.parseOffset32();\n const elidedFallbackNameID = tableVersionMajor > 1 || tableVersionMinor > 0 ? p.parseUShort() : void 0;\n if (fvar !== void 0) {\n check_default.argument(designAxisCount >= fvar.axes.length, \"STAT axis count must be greater than or equal to fvar axis count\");\n }\n if (axisValueCount > 0) {\n check_default.argument(designAxisCount >= 0, \"STAT axis count must be greater than 0 if STAT axis value count is greater than 0\");\n }\n const axes = [];\n for (let i = 0; i < designAxisCount; i++) {\n p.offset = start + designAxesOffset;\n p.relativeOffset = i * designAxisSize;\n axes.push(p.parseStruct(axisRecordStruct));\n }\n p.offset = start;\n p.relativeOffset = offsetToAxisValueOffsets;\n const valueOffsets = p.parseUShortList(axisValueCount);\n const values = [];\n for (let i = 0; i < axisValueCount; i++) {\n p.offset = start + offsetToAxisValueOffsets;\n p.relativeOffset = valueOffsets[i];\n values.push(parseSTATAxisValue.apply(p));\n }\n return {\n version,\n axes,\n values,\n elidedFallbackNameID\n };\n }\n var axisValueMakers = new Array(5);\n axisValueMakers[1] = function axisValueMaker1(n, table) {\n return [\n { name: `format${n}`, type: \"USHORT\", value: 1 },\n { name: `axisIndex${n}`, type: \"USHORT\", value: table.axisIndex },\n { name: `flags${n}`, type: \"USHORT\", value: table.flags },\n { name: `valueNameID${n}`, type: \"USHORT\", value: table.valueNameID },\n { name: `value${n}`, type: \"FLOAT\", value: table.value }\n ];\n };\n axisValueMakers[2] = function axisValueMaker2(n, table) {\n return [\n { name: `format${n}`, type: \"USHORT\", value: 2 },\n { name: `axisIndex${n}`, type: \"USHORT\", value: table.axisIndex },\n { name: `flags${n}`, type: \"USHORT\", value: table.flags },\n { name: `valueNameID${n}`, type: \"USHORT\", value: table.valueNameID },\n { name: `nominalValue${n}`, type: \"FLOAT\", value: table.nominalValue },\n { name: `rangeMinValue${n}`, type: \"FLOAT\", value: table.rangeMinValue },\n { name: `rangeMaxValue${n}`, type: \"FLOAT\", value: table.rangeMaxValue }\n ];\n };\n axisValueMakers[3] = function axisValueMaker3(n, table) {\n return [\n { name: `format${n}`, type: \"USHORT\", value: 3 },\n { name: `axisIndex${n}`, type: \"USHORT\", value: table.axisIndex },\n { name: `flags${n}`, type: \"USHORT\", value: table.flags },\n { name: `valueNameID${n}`, type: \"USHORT\", value: table.valueNameID },\n { name: `value${n}`, type: \"FLOAT\", value: table.value },\n { name: `linkedValue${n}`, type: \"FLOAT\", value: table.linkedValue }\n ];\n };\n axisValueMakers[4] = function axisValueMaker4(n, table) {\n let returnFields = [\n { name: `format${n}`, type: \"USHORT\", value: 4 },\n { name: `axisCount${n}`, type: \"USHORT\", value: table.axisValues.length },\n { name: `flags${n}`, type: \"USHORT\", value: table.flags },\n { name: `valueNameID${n}`, type: \"USHORT\", value: table.valueNameID }\n ];\n for (let i = 0; i < table.axisValues.length; i++) {\n returnFields = returnFields.concat([\n { name: `format${n}axisIndex${i}`, type: \"USHORT\", value: table.axisValues[i].axisIndex },\n { name: `format${n}value${i}`, type: \"FLOAT\", value: table.axisValues[i].value }\n ]);\n }\n return returnFields;\n };\n function makeSTATAxisRecord(n, axis) {\n return new table_default.Record(\"axisRecord_\" + n, [\n { name: \"axisTag_\" + n, type: \"TAG\", value: axis.tag },\n { name: \"axisNameID_\" + n, type: \"USHORT\", value: axis.nameID },\n { name: \"axisOrdering_\" + n, type: \"USHORT\", value: axis.ordering }\n ]);\n }\n function makeSTATValueTable(n, tableData) {\n const valueTableFormat = tableData.format;\n const axisValueMaker = axisValueMakers[valueTableFormat];\n check_default.argument(axisValueMaker !== void 0, `Unknown axis value table format ${valueTableFormat}`);\n const fields = axisValueMaker(n, tableData);\n return new table_default.Table(\"axisValueTable_\" + n, fields);\n }\n function makeSTATTable(STAT) {\n const result = new table_default.Table(\"STAT\", [\n { name: \"majorVersion\", type: \"USHORT\", value: 1 },\n { name: \"minorVersion\", type: \"USHORT\", value: 2 },\n { name: \"designAxisSize\", type: \"USHORT\", value: 8 },\n { name: \"designAxisCount\", type: \"USHORT\", value: STAT.axes.length },\n { name: \"designAxesOffset\", type: \"ULONG\", value: 0 },\n { name: \"axisValueCount\", type: \"USHORT\", value: STAT.values.length },\n { name: \"offsetToAxisValueOffsets\", type: \"ULONG\", value: 0 },\n { name: \"elidedFallbackNameID\", type: \"USHORT\", value: STAT.elidedFallbackNameID }\n ]);\n result.designAxesOffset = result.offsetToAxisValueOffsets = result.sizeOf();\n for (let i = 0; i < STAT.axes.length; i++) {\n const axisRecord = makeSTATAxisRecord(i, STAT.axes[i]);\n result.offsetToAxisValueOffsets += axisRecord.sizeOf();\n result.fields = result.fields.concat(axisRecord.fields);\n }\n const axisValueOffsets = [];\n let axisValueTables = [];\n let axisValueTableOffset = STAT.values.length * 2;\n for (let j = 0; j < STAT.values.length; j++) {\n const axisValueTable = makeSTATValueTable(j, STAT.values[j]);\n axisValueOffsets.push({\n name: \"offset_\" + j,\n type: \"USHORT\",\n value: axisValueTableOffset\n });\n axisValueTableOffset += axisValueTable.sizeOf();\n axisValueTables = axisValueTables.concat(axisValueTable.fields);\n }\n result.fields = result.fields.concat(axisValueOffsets);\n result.fields = result.fields.concat(axisValueTables);\n return result;\n }\n var stat_default = { make: makeSTATTable, parse: parseSTATTable };\n\n // src/tables/avar.mjs\n function makeAvarAxisValueMap(n, axisValueMap) {\n return new table_default.Record(\"axisValueMap_\" + n, [\n { name: \"fromCoordinate_\" + n, type: \"F2DOT14\", value: axisValueMap.fromCoordinate },\n { name: \"toCoordinate_\" + n, type: \"F2DOT14\", value: axisValueMap.toCoordinate }\n ]);\n }\n function makeAvarSegmentMap(n, axis) {\n const returnTable = new table_default.Record(\"segmentMap_\" + n, [\n { name: \"positionMapCount_\" + n, type: \"USHORT\", value: axis.axisValueMaps.length }\n ]);\n let axisValueMaps = [];\n for (let i = 0; i < axis.axisValueMaps.length; i++) {\n const valueMap = makeAvarAxisValueMap(`${n}_${i}`, axis.axisValueMaps[i]);\n axisValueMaps = axisValueMaps.concat(valueMap.fields);\n }\n returnTable.fields = returnTable.fields.concat(axisValueMaps);\n return returnTable;\n }\n function makeAvarTable(avar, fvar) {\n check_default.argument(avar.axisSegmentMaps.length === fvar.axes.length, \"avar axis count must correspond to fvar axis count\");\n const result = new table_default.Table(\"avar\", [\n { name: \"majorVersion\", type: \"USHORT\", value: 1 },\n { name: \"minorVersion\", type: \"USHORT\", value: 0 },\n { name: \"reserved\", type: \"USHORT\", value: 0 },\n { name: \"axisCount\", type: \"USHORT\", value: avar.axisSegmentMaps.length }\n ]);\n for (let i = 0; i < avar.axisSegmentMaps.length; i++) {\n const axisRecord = makeAvarSegmentMap(i, avar.axisSegmentMaps[i]);\n result.fields = result.fields.concat(axisRecord.fields);\n }\n return result;\n }\n function parseAvarTable(data, start, fvar) {\n if (!start) {\n start = 0;\n }\n const p = new Parser(data, start);\n const tableVersionMajor = p.parseUShort();\n const tableVersionMinor = p.parseUShort();\n if (tableVersionMajor !== 1) {\n console.warn(`Unsupported avar table version ${tableVersionMajor}.${tableVersionMinor}`);\n }\n p.skip(\"uShort\", 1);\n const axisCount = p.parseUShort();\n check_default.argument(axisCount === fvar.axes.length, \"avar axis count must correspond to fvar axis count\");\n const axisSegmentMaps = [];\n for (let i = 0; i < axisCount; i++) {\n const axisValueMaps = [];\n const positionMapCount = p.parseUShort();\n for (let j = 0; j < positionMapCount; j++) {\n const fromCoordinate = p.parseF2Dot14();\n const toCoordinate = p.parseF2Dot14();\n axisValueMaps.push({\n fromCoordinate,\n toCoordinate\n });\n }\n axisSegmentMaps.push({\n axisValueMaps\n });\n }\n return {\n version: [tableVersionMajor, tableVersionMinor],\n axisSegmentMaps\n };\n }\n var avar_default = { make: makeAvarTable, parse: parseAvarTable };\n\n // src/tables/cvar.mjs\n function parseCvarTable(data, start, fvar, cvt) {\n const p = new parse_default.Parser(data, start);\n const cvtVariations = p.parseTupleVariationStore(\n p.relativeOffset,\n fvar.axes.length,\n \"cvar\",\n cvt\n );\n const tableVersionMajor = p.parseUShort();\n const tableVersionMinor = p.parseUShort();\n if (tableVersionMajor !== 1) {\n console.warn(`Unsupported cvar table version ${tableVersionMajor}.${tableVersionMinor}`);\n }\n return {\n version: [tableVersionMajor, tableVersionMinor],\n ...cvtVariations\n };\n }\n function makeCvarTable() {\n console.warn(\"Writing of cvar tables is not yet supported.\");\n }\n var cvar_default = { make: makeCvarTable, parse: parseCvarTable };\n\n // src/tables/gvar.mjs\n function parseGvarTable(data, start, fvar, glyphs) {\n const p = new parse_default.Parser(data, start);\n const tableVersionMajor = p.parseUShort();\n const tableVersionMinor = p.parseUShort();\n if (tableVersionMajor !== 1) {\n console.warn(`Unsupported gvar table version ${tableVersionMajor}.${tableVersionMinor}`);\n }\n const axisCount = p.parseUShort();\n if (axisCount !== fvar.axes.length) {\n console.warn(`axisCount ${axisCount} in gvar table does not match the number of axes ${fvar.axes.length} in the fvar table!`);\n }\n const sharedTupleCount = p.parseUShort();\n const sharedTuples = p.parsePointer32(function() {\n return this.parseTupleRecords(sharedTupleCount, axisCount);\n });\n const glyphVariations = p.parseTupleVariationStoreList(axisCount, \"gvar\", glyphs);\n return {\n version: [tableVersionMajor, tableVersionMinor],\n sharedTuples,\n glyphVariations\n };\n }\n function makeGvarTable() {\n console.warn(\"Writing of gvar tables is not yet supported.\");\n }\n var gvar_default = { make: makeGvarTable, parse: parseGvarTable };\n\n // src/tables/gasp.mjs\n function parseGaspTable(data, start) {\n const gasp = {};\n const p = new parse_default.Parser(data, start);\n gasp.version = p.parseUShort();\n check_default.argument(gasp.version <= 1, \"Unsupported gasp table version.\");\n gasp.numRanges = p.parseUShort();\n gasp.gaspRanges = [];\n for (let i = 0; i < gasp.numRanges; i++) {\n gasp.gaspRanges[i] = {\n rangeMaxPPEM: p.parseUShort(),\n rangeGaspBehavior: p.parseUShort()\n };\n }\n return gasp;\n }\n function makeGaspTable(gasp) {\n const result = new table_default.Table(\"gasp\", [\n { name: \"version\", type: \"USHORT\", value: 1 },\n { name: \"numRanges\", type: \"USHORT\", value: gasp.numRanges }\n ]);\n for (let i in gasp.gaspRanges) {\n result.fields.push({ name: \"rangeMaxPPEM\", type: \"USHORT\", value: gasp.gaspRanges[i].rangeMaxPPEM });\n result.fields.push({ name: \"rangeGaspBehavior\", type: \"USHORT\", value: gasp.gaspRanges[i].rangeGaspBehavior });\n }\n return result;\n }\n var gasp_default = { parse: parseGaspTable, make: makeGaspTable };\n\n // src/tables/svg.mjs\n function parseSvgTable(data, offset) {\n const svgTable = /* @__PURE__ */ new Map();\n const buf = data.buffer;\n const p = new Parser(data, offset);\n const version = p.parseUShort();\n if (version !== 0) return svgTable;\n p.relativeOffset = p.parseOffset32();\n const svgDocumentListOffset = data.byteOffset + offset + p.relativeOffset;\n const numEntries = p.parseUShort();\n const svgDocMap = /* @__PURE__ */ new Map();\n for (let i = 0; i < numEntries; i++) {\n const startGlyphID = p.parseUShort();\n const endGlyphID = p.parseUShort();\n const svgDocOffset = svgDocumentListOffset + p.parseOffset32();\n const svgDocLength = p.parseULong();\n let svgDoc = svgDocMap.get(svgDocOffset);\n if (svgDoc === void 0) {\n svgDoc = new Uint8Array(buf, svgDocOffset, svgDocLength);\n svgDocMap.set(svgDocOffset, svgDoc);\n }\n for (let i2 = startGlyphID; i2 <= endGlyphID; i2++) {\n svgTable.set(i2, svgDoc);\n }\n }\n return svgTable;\n }\n function makeSvgTable(svgTable) {\n const glyphIds = Array.from(svgTable.keys()).sort();\n const documentRecords = [];\n const documentBuffers = [];\n const documentOffsets = /* @__PURE__ */ new Map();\n let nextSvgDocOffset = 0;\n let record = { endGlyphID: null };\n for (let i = 0, l = glyphIds.length; i < l; i++) {\n const glyphId = glyphIds[i];\n const svgDoc = svgTable.get(glyphId);\n let svgDocOffset = documentOffsets.get(svgDoc);\n if (svgDocOffset === void 0) {\n svgDocOffset = nextSvgDocOffset;\n documentBuffers.push(svgDoc);\n documentOffsets.set(svgDoc, svgDocOffset);\n nextSvgDocOffset += svgDoc.byteLength;\n }\n if (glyphId - 1 === record.endGlyphID && svgDocOffset === record.svgDocOffset) {\n record.endGlyphID = glyphId;\n } else {\n record = {\n startGlyphID: glyphId,\n endGlyphID: glyphId,\n svgDocOffset,\n svgDocLength: svgDoc.byteLength\n };\n documentRecords.push(record);\n }\n }\n const numEntries = documentRecords.length;\n const numDocuments = documentBuffers.length;\n const documentsOffset = 2 + numEntries * (2 + 2 + 4 + 4);\n const fields = new Array(3 + 1 + numEntries * 4 + numDocuments);\n let fieldIndex = 0;\n fields[fieldIndex++] = { name: \"version\", type: \"USHORT\", value: 0 };\n fields[fieldIndex++] = { name: \"svgDocumentListOffset\", type: \"ULONG\", value: 2 + 4 + 4 };\n fields[fieldIndex++] = { name: \"reserved\", type: \"ULONG\", value: 0 };\n fields[fieldIndex++] = { name: \"numEntries\", type: \"USHORT\", value: numEntries };\n for (let i = 0; i < numEntries; i++) {\n const namePrefix = \"documentRecord_\" + i;\n const { startGlyphID, endGlyphID, svgDocOffset, svgDocLength } = documentRecords[i];\n fields[fieldIndex++] = { name: namePrefix + \"_startGlyphID\", type: \"USHORT\", value: startGlyphID };\n fields[fieldIndex++] = { name: namePrefix + \"_endGlyphID\", type: \"USHORT\", value: endGlyphID };\n fields[fieldIndex++] = { name: namePrefix + \"_svgDocOffset\", type: \"ULONG\", value: documentsOffset + svgDocOffset };\n fields[fieldIndex++] = { name: namePrefix + \"_svgDocLength\", type: \"ULONG\", value: svgDocLength };\n }\n for (let i = 0; i < numDocuments; i++) {\n fields[fieldIndex++] = { name: \"svgDoc_\" + i, type: \"LITERAL\", value: documentBuffers[i] };\n }\n return new table_default.Table(\"SVG \", fields);\n }\n var svg_default = {\n make: makeSvgTable,\n parse: parseSvgTable\n };\n\n // src/tables/sfnt.mjs\n function log2(v) {\n return Math.log(v) / Math.log(2) | 0;\n }\n function computeCheckSum(bytes) {\n while (bytes.length % 4 !== 0) {\n bytes.push(0);\n }\n let sum = 0;\n for (let i = 0; i < bytes.length; i += 4) {\n sum += (bytes[i] << 24) + (bytes[i + 1] << 16) + (bytes[i + 2] << 8) + bytes[i + 3];\n }\n sum %= Math.pow(2, 32);\n return sum;\n }\n function makeTableRecord(tag, checkSum, offset, length) {\n return new table_default.Record(\"Table Record\", [\n { name: \"tag\", type: \"TAG\", value: tag !== void 0 ? tag : \"\" },\n { name: \"checkSum\", type: \"ULONG\", value: checkSum !== void 0 ? checkSum : 0 },\n { name: \"offset\", type: \"ULONG\", value: offset !== void 0 ? offset : 0 },\n { name: \"length\", type: \"ULONG\", value: length !== void 0 ? length : 0 }\n ]);\n }\n function makeSfntTable(tables) {\n const sfnt = new table_default.Table(\"sfnt\", [\n { name: \"version\", type: \"TAG\", value: \"OTTO\" },\n { name: \"numTables\", type: \"USHORT\", value: 0 },\n { name: \"searchRange\", type: \"USHORT\", value: 0 },\n { name: \"entrySelector\", type: \"USHORT\", value: 0 },\n { name: \"rangeShift\", type: \"USHORT\", value: 0 }\n ]);\n sfnt.tables = tables;\n sfnt.numTables = tables.length;\n const highestPowerOf2 = Math.pow(2, log2(sfnt.numTables));\n sfnt.searchRange = 16 * highestPowerOf2;\n sfnt.entrySelector = log2(highestPowerOf2);\n sfnt.rangeShift = sfnt.numTables * 16 - sfnt.searchRange;\n const recordFields = [];\n const tableFields = [];\n let offset = sfnt.sizeOf() + makeTableRecord().sizeOf() * sfnt.numTables;\n while (offset % 4 !== 0) {\n offset += 1;\n tableFields.push({ name: \"padding\", type: \"BYTE\", value: 0 });\n }\n for (let i = 0; i < tables.length; i += 1) {\n const t = tables[i];\n check_default.argument(t.tableName.length === 4, \"Table name\" + t.tableName + \" is invalid.\");\n const tableLength = t.sizeOf();\n const tableRecord = makeTableRecord(t.tableName, computeCheckSum(t.encode()), offset, tableLength);\n recordFields.push({ name: tableRecord.tag + \" Table Record\", type: \"RECORD\", value: tableRecord });\n tableFields.push({ name: t.tableName + \" table\", type: \"RECORD\", value: t });\n offset += tableLength;\n check_default.argument(!isNaN(offset), \"Something went wrong calculating the offset.\");\n while (offset % 4 !== 0) {\n offset += 1;\n tableFields.push({ name: \"padding\", type: \"BYTE\", value: 0 });\n }\n }\n recordFields.sort(function(r1, r2) {\n if (r1.value.tag > r2.value.tag) {\n return 1;\n } else {\n return -1;\n }\n });\n sfnt.fields = sfnt.fields.concat(recordFields);\n sfnt.fields = sfnt.fields.concat(tableFields);\n return sfnt;\n }\n function metricsForChar(font, chars, notFoundMetrics) {\n for (let i = 0; i < chars.length; i += 1) {\n const glyphIndex = font.charToGlyphIndex(chars[i]);\n if (glyphIndex > 0) {\n const glyph = font.glyphs.get(glyphIndex);\n return glyph.getMetrics();\n }\n }\n return notFoundMetrics;\n }\n function average(vs) {\n let sum = 0;\n for (let i = 0; i < vs.length; i += 1) {\n sum += vs[i];\n }\n return sum / vs.length;\n }\n function fontToSfntTable(font) {\n const xMins = [];\n const yMins = [];\n const xMaxs = [];\n const yMaxs = [];\n const advanceWidths = [];\n const leftSideBearings = [];\n const rightSideBearings = [];\n let firstCharIndex;\n let lastCharIndex = 0;\n let ulUnicodeRange1 = 0;\n let ulUnicodeRange2 = 0;\n let ulUnicodeRange3 = 0;\n let ulUnicodeRange4 = 0;\n for (let i = 0; i < font.glyphs.length; i += 1) {\n const glyph = font.glyphs.get(i);\n const unicode = glyph.unicode | 0;\n if (isNaN(glyph.advanceWidth)) {\n throw new Error(\"Glyph \" + glyph.name + \" (\" + i + \"): advanceWidth is not a number.\");\n }\n if (firstCharIndex > unicode || firstCharIndex === void 0) {\n if (unicode > 0) {\n firstCharIndex = unicode;\n }\n }\n if (lastCharIndex < unicode) {\n lastCharIndex = unicode;\n }\n const position = os2_default.getUnicodeRange(unicode);\n if (position < 32) {\n ulUnicodeRange1 |= 1 << position;\n } else if (position < 64) {\n ulUnicodeRange2 |= 1 << position - 32;\n } else if (position < 96) {\n ulUnicodeRange3 |= 1 << position - 64;\n } else if (position < 123) {\n ulUnicodeRange4 |= 1 << position - 96;\n } else {\n throw new Error(\"Unicode ranges bits > 123 are reserved for internal usage\");\n }\n if (glyph.name === \".notdef\") continue;\n const metrics = glyph.getMetrics();\n xMins.push(metrics.xMin);\n yMins.push(metrics.yMin);\n xMaxs.push(metrics.xMax);\n yMaxs.push(metrics.yMax);\n leftSideBearings.push(metrics.leftSideBearing);\n rightSideBearings.push(metrics.rightSideBearing);\n advanceWidths.push(glyph.advanceWidth);\n }\n const globals = {\n xMin: Math.min.apply(null, xMins),\n yMin: Math.min.apply(null, yMins),\n xMax: Math.max.apply(null, xMaxs),\n yMax: Math.max.apply(null, yMaxs),\n advanceWidthMax: Math.max.apply(null, advanceWidths),\n advanceWidthAvg: average(advanceWidths),\n minLeftSideBearing: Math.min.apply(null, leftSideBearings),\n maxLeftSideBearing: Math.max.apply(null, leftSideBearings),\n minRightSideBearing: Math.min.apply(null, rightSideBearings)\n };\n globals.ascender = font.ascender;\n globals.descender = font.descender;\n let macStyle = 0;\n if (font.weightClass >= 600) {\n macStyle |= font.macStyleValues.BOLD;\n }\n if (font.italicAngle < 0) {\n macStyle |= font.macStyleValues.ITALIC;\n }\n const headTable = head_default.make({\n flags: 3,\n // 00000011 (baseline for font at y=0; left sidebearing point at x=0)\n unitsPerEm: font.unitsPerEm,\n xMin: globals.xMin,\n yMin: globals.yMin,\n xMax: globals.xMax,\n yMax: globals.yMax,\n lowestRecPPEM: 3,\n macStyle,\n createdTimestamp: font.createdTimestamp\n });\n const hheaTable = hhea_default.make({\n ascender: globals.ascender,\n descender: globals.descender,\n advanceWidthMax: globals.advanceWidthMax,\n minLeftSideBearing: globals.minLeftSideBearing,\n minRightSideBearing: globals.minRightSideBearing,\n xMaxExtent: globals.maxLeftSideBearing + (globals.xMax - globals.xMin),\n numberOfHMetrics: font.glyphs.length\n });\n const maxpTable = maxp_default.make(font.glyphs.length);\n const os2Table = os2_default.make(Object.assign({\n xAvgCharWidth: Math.round(globals.advanceWidthAvg),\n usFirstCharIndex: firstCharIndex,\n usLastCharIndex: lastCharIndex,\n ulUnicodeRange1,\n ulUnicodeRange2,\n ulUnicodeRange3,\n ulUnicodeRange4,\n // See http://typophile.com/node/13081 for more info on vertical metrics.\n // We get metrics for typical characters (such as \"x\" for xHeight).\n // We provide some fallback characters if characters are unavailable: their\n // ordering was chosen experimentally.\n sTypoAscender: globals.ascender,\n sTypoDescender: globals.descender,\n sTypoLineGap: 0,\n usWinAscent: globals.yMax,\n usWinDescent: Math.abs(globals.yMin),\n ulCodePageRange1: 1,\n // FIXME: hard-code Latin 1 support for now\n sxHeight: metricsForChar(font, \"xyvw\", { yMax: Math.round(globals.ascender / 2) }).yMax,\n sCapHeight: metricsForChar(font, \"HIKLEFJMNTZBDPRAGOQSUVWXY\", globals).yMax,\n usDefaultChar: font.hasChar(\" \") ? 32 : 0,\n // Use space as the default character, if available.\n usBreakChar: font.hasChar(\" \") ? 32 : 0\n // Use space as the break character, if available.\n }, font.tables.os2));\n const hmtxTable = hmtx_default.make(font.glyphs);\n const cmapTable = cmap_default.make(font.glyphs);\n const englishFamilyName = font.getEnglishName(\"fontFamily\");\n const englishStyleName = font.getEnglishName(\"fontSubfamily\");\n const englishFullName = englishFamilyName + \" \" + englishStyleName;\n let postScriptName = font.getEnglishName(\"postScriptName\");\n if (!postScriptName) {\n postScriptName = englishFamilyName.replace(/\\s/g, \"\") + \"-\" + englishStyleName;\n }\n const names = {};\n for (let n in font.names) {\n names[n] = font.names[n];\n }\n names.unicode = names.unicode || {};\n names.macintosh = names.macintosh || {};\n names.windows = names.windows || {};\n const fontNamesUnicode = font.names.unicode || {};\n const fontNamesMacintosh = font.names.macintosh || {};\n const fontNamesWindows = font.names.windows || {};\n for (const platform in names) {\n names[platform] = names[platform] || {};\n if (!names[platform].uniqueID) {\n const manufacturer = font.getEnglishName(\"manufacturer\") || \"\";\n names[platform].uniqueID = { en: `${manufacturer}: ${englishFullName}` };\n }\n if (!names[platform].postScriptName) {\n names[platform].postScriptName = { en: postScriptName };\n }\n }\n if (!names.unicode.preferredFamily) {\n names.unicode.preferredFamily = fontNamesUnicode.fontFamily || fontNamesMacintosh.fontFamily || fontNamesWindows.fontFamily;\n }\n if (!names.macintosh.preferredFamily) {\n names.macintosh.preferredFamily = fontNamesMacintosh.fontFamily || fontNamesUnicode.fontFamily || fontNamesWindows.fontFamily;\n }\n if (!names.windows.preferredFamily) {\n names.windows.preferredFamily = fontNamesWindows.fontFamily || fontNamesUnicode.fontFamily || fontNamesMacintosh.fontFamily;\n }\n if (!names.unicode.preferredSubfamily) {\n names.unicode.preferredSubfamily = fontNamesUnicode.fontSubfamily || fontNamesMacintosh.fontSubfamily || fontNamesWindows.fontSubfamily;\n }\n if (!names.macintosh.preferredSubfamily) {\n names.macintosh.preferredSubfamily = fontNamesMacintosh.fontSubfamily || fontNamesUnicode.fontSubfamily || fontNamesWindows.fontSubfamily;\n }\n if (!names.windows.preferredSubfamily) {\n names.windows.preferredSubfamily = fontNamesWindows.fontSubfamily || fontNamesUnicode.fontSubfamily || fontNamesMacintosh.fontSubfamily;\n }\n const languageTags = [];\n const nameTable = name_default.make(names, languageTags);\n const ltagTable = languageTags.length > 0 ? ltag_default.make(languageTags) : void 0;\n const postTable = post_default.make(font);\n const cffTable = cff_default.make(font.glyphs, {\n version: font.getEnglishName(\"version\"),\n fullName: englishFullName,\n familyName: englishFamilyName,\n weightName: englishStyleName,\n postScriptName,\n unitsPerEm: font.unitsPerEm,\n fontBBox: [0, globals.yMin, globals.ascender, globals.advanceWidthMax],\n topDict: font.tables.cff && font.tables.cff.topDict || {}\n });\n const metaTable = font.metas && Object.keys(font.metas).length > 0 ? meta_default.make(font.metas) : void 0;\n const tables = [headTable, hheaTable, maxpTable, os2Table, nameTable, cmapTable, postTable, cffTable, hmtxTable];\n if (ltagTable) {\n tables.push(ltagTable);\n }\n const optionalTables = {\n gsub: gsub_default,\n cpal: cpal_default,\n colr: colr_default,\n stat: stat_default,\n avar: avar_default,\n cvar: cvar_default,\n fvar: fvar_default,\n gvar: gvar_default,\n gasp: gasp_default,\n svg: svg_default\n };\n const optionalTableArgs = {\n avar: [font.tables.fvar],\n fvar: [font.names]\n };\n for (let tableName in optionalTables) {\n const table = font.tables[tableName];\n if (table) {\n const tableData = optionalTables[tableName].make.call(font, table, ...optionalTableArgs[tableName] || []);\n if (tableData) {\n tables.push(tableData);\n }\n }\n }\n if (metaTable) {\n tables.push(metaTable);\n }\n const sfntTable = makeSfntTable(tables);\n const bytes = sfntTable.encode();\n const checkSum = computeCheckSum(bytes);\n const tableFields = sfntTable.fields;\n let checkSumAdjusted = false;\n for (let i = 0; i < tableFields.length; i += 1) {\n if (tableFields[i].name === \"head table\") {\n tableFields[i].value.checkSumAdjustment = 2981146554 - checkSum;\n checkSumAdjusted = true;\n break;\n }\n }\n if (!checkSumAdjusted) {\n throw new Error(\"Could not find head table with checkSum to adjust.\");\n }\n return sfntTable;\n }\n var sfnt_default = { make: makeSfntTable, fontToTable: fontToSfntTable, computeCheckSum };\n\n // src/layout.mjs\n function searchTag(arr, tag) {\n let imin = 0;\n let imax = arr.length - 1;\n while (imin <= imax) {\n const imid = imin + imax >>> 1;\n const val = arr[imid].tag;\n if (val === tag) {\n return imid;\n } else if (val < tag) {\n imin = imid + 1;\n } else {\n imax = imid - 1;\n }\n }\n return -imin - 1;\n }\n function binSearch(arr, value) {\n let imin = 0;\n let imax = arr.length - 1;\n while (imin <= imax) {\n const imid = imin + imax >>> 1;\n const val = arr[imid];\n if (val === value) {\n return imid;\n } else if (val < value) {\n imin = imid + 1;\n } else {\n imax = imid - 1;\n }\n }\n return -imin - 1;\n }\n function searchRange(ranges, value) {\n let range;\n let imin = 0;\n let imax = ranges.length - 1;\n while (imin <= imax) {\n const imid = imin + imax >>> 1;\n range = ranges[imid];\n const start = range.start;\n if (start === value) {\n return range;\n } else if (start < value) {\n imin = imid + 1;\n } else {\n imax = imid - 1;\n }\n }\n if (imin > 0) {\n range = ranges[imin - 1];\n if (value > range.end) return 0;\n return range;\n }\n }\n function Layout(font, tableName) {\n this.font = font;\n this.tableName = tableName;\n }\n Layout.prototype = {\n /**\n * Binary search an object by \"tag\" property\n * @instance\n * @function searchTag\n * @memberof opentype.Layout\n * @param {Array} arr\n * @param {string} tag\n * @return {number}\n */\n searchTag,\n /**\n * Binary search in a list of numbers\n * @instance\n * @function binSearch\n * @memberof opentype.Layout\n * @param {Array} arr\n * @param {number} value\n * @return {number}\n */\n binSearch,\n /**\n * Get or create the Layout table (GSUB, GPOS etc).\n * @param {boolean} create - Whether to create a new one.\n * @return {Object} The GSUB or GPOS table.\n */\n getTable: function(create) {\n let layout = this.font.tables[this.tableName];\n if (!layout && create) {\n layout = this.font.tables[this.tableName] = this.createDefaultTable();\n }\n return layout;\n },\n /**\n * Returns all scripts in the substitution table.\n * @instance\n * @return {Array}\n */\n getScriptNames: function() {\n let layout = this.getTable();\n if (!layout) {\n return [];\n }\n return layout.scripts.map(function(script) {\n return script.tag;\n });\n },\n /**\n * Returns the best bet for a script name.\n * Returns 'DFLT' if it exists.\n * If not, returns 'latn' if it exists.\n * If neither exist, returns undefined.\n */\n getDefaultScriptName: function() {\n let layout = this.getTable();\n if (!layout) {\n return;\n }\n let hasLatn = false;\n for (let i = 0; i < layout.scripts.length; i++) {\n const name = layout.scripts[i].tag;\n if (name === \"DFLT\") return name;\n if (name === \"latn\") hasLatn = true;\n }\n if (hasLatn) return \"latn\";\n },\n /**\n * Returns all LangSysRecords in the given script.\n * @instance\n * @param {string} [script='DFLT']\n * @param {boolean} create - forces the creation of this script table if it doesn't exist.\n * @return {Object} An object with tag and script properties.\n */\n getScriptTable: function(script, create) {\n const layout = this.getTable(create);\n if (layout) {\n script = script || \"DFLT\";\n const scripts = layout.scripts;\n const pos = searchTag(layout.scripts, script);\n if (pos >= 0) {\n return scripts[pos].script;\n } else if (create) {\n const scr = {\n tag: script,\n script: {\n defaultLangSys: { reserved: 0, reqFeatureIndex: 65535, featureIndexes: [] },\n langSysRecords: []\n }\n };\n scripts.splice(-1 - pos, 0, scr);\n return scr.script;\n }\n }\n },\n /**\n * Returns a language system table\n * @instance\n * @param {string} [script='DFLT']\n * @param {string} [language='dlft']\n * @param {boolean} create - forces the creation of this langSysTable if it doesn't exist.\n * @return {Object}\n */\n getLangSysTable: function(script, language, create) {\n const scriptTable = this.getScriptTable(script, create);\n if (scriptTable) {\n if (!language || language === \"dflt\" || language === \"DFLT\") {\n return scriptTable.defaultLangSys;\n }\n const pos = searchTag(scriptTable.langSysRecords, language);\n if (pos >= 0) {\n return scriptTable.langSysRecords[pos].langSys;\n } else if (create) {\n const langSysRecord = {\n tag: language,\n langSys: { reserved: 0, reqFeatureIndex: 65535, featureIndexes: [] }\n };\n scriptTable.langSysRecords.splice(-1 - pos, 0, langSysRecord);\n return langSysRecord.langSys;\n }\n }\n },\n /**\n * Get a specific feature table.\n * @instance\n * @param {string} [script='DFLT']\n * @param {string} [language='dlft']\n * @param {string} feature - One of the codes listed at https://www.microsoft.com/typography/OTSPEC/featurelist.htm\n * @param {boolean} create - forces the creation of the feature table if it doesn't exist.\n * @return {Object}\n */\n getFeatureTable: function(script, language, feature, create) {\n const langSysTable2 = this.getLangSysTable(script, language, create);\n if (langSysTable2) {\n let featureRecord;\n const featIndexes = langSysTable2.featureIndexes;\n const allFeatures = this.font.tables[this.tableName].features;\n for (let i = 0; i < featIndexes.length; i++) {\n featureRecord = allFeatures[featIndexes[i]];\n if (featureRecord.tag === feature) {\n return featureRecord.feature;\n }\n }\n if (create) {\n const index = allFeatures.length;\n check_default.assert(index === 0 || feature >= allFeatures[index - 1].tag, \"Features must be added in alphabetical order.\");\n featureRecord = {\n tag: feature,\n feature: { params: 0, lookupListIndexes: [] }\n };\n allFeatures.push(featureRecord);\n featIndexes.push(index);\n return featureRecord.feature;\n }\n }\n },\n /**\n * Get the lookup tables of a given type for a script/language/feature.\n * @instance\n * @param {string} [script='DFLT']\n * @param {string} [language='dlft']\n * @param {string} feature - 4-letter feature code\n * @param {number} lookupType - 1 to 9\n * @param {boolean} create - forces the creation of the lookup table if it doesn't exist, with no subtables.\n * @return {Object[]}\n */\n getLookupTables: function(script, language, feature, lookupType, create) {\n const featureTable = this.getFeatureTable(script, language, feature, create);\n const tables = [];\n if (featureTable) {\n let lookupTable;\n const lookupListIndexes = featureTable.lookupListIndexes;\n const allLookups = this.font.tables[this.tableName].lookups;\n for (let i = 0; i < lookupListIndexes.length; i++) {\n lookupTable = allLookups[lookupListIndexes[i]];\n if (lookupTable.lookupType === lookupType) {\n tables.push(lookupTable);\n }\n }\n if (tables.length === 0 && create) {\n lookupTable = {\n lookupType,\n lookupFlag: 0,\n subtables: [],\n markFilteringSet: void 0\n };\n const index = allLookups.length;\n allLookups.push(lookupTable);\n lookupListIndexes.push(index);\n return [lookupTable];\n }\n }\n return tables;\n },\n /**\n * Find a glyph in a class definition table\n * https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#class-definition-table\n * @param {object} classDefTable - an OpenType Layout class definition table\n * @param {number} glyphIndex - the index of the glyph to find\n * @returns {number} -1 if not found\n */\n getGlyphClass: function(classDefTable, glyphIndex) {\n switch (classDefTable.format) {\n case 1: {\n if (classDefTable.startGlyph <= glyphIndex && glyphIndex < classDefTable.startGlyph + classDefTable.classes.length) {\n return classDefTable.classes[glyphIndex - classDefTable.startGlyph];\n }\n return 0;\n }\n case 2: {\n const range = searchRange(classDefTable.ranges, glyphIndex);\n return range ? range.classId : 0;\n }\n }\n },\n /**\n * Find a glyph in a coverage table\n * https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#coverage-table\n * @param {object} coverageTable - an OpenType Layout coverage table\n * @param {number} glyphIndex - the index of the glyph to find\n * @returns {number} -1 if not found\n */\n getCoverageIndex: function(coverageTable, glyphIndex) {\n switch (coverageTable.format) {\n case 1: {\n const index = binSearch(coverageTable.glyphs, glyphIndex);\n return index >= 0 ? index : -1;\n }\n case 2: {\n const range = searchRange(coverageTable.ranges, glyphIndex);\n return range ? range.index + glyphIndex - range.start : -1;\n }\n }\n },\n /**\n * Returns the list of glyph indexes of a coverage table.\n * Format 1: the list is stored raw\n * Format 2: compact list as range records.\n * @instance\n * @param {Object} coverageTable\n * @return {Array}\n */\n expandCoverage: function(coverageTable) {\n if (coverageTable.format === 1) {\n return coverageTable.glyphs;\n } else {\n const glyphs = [];\n const ranges = coverageTable.ranges;\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n const start = range.start;\n const end = range.end;\n for (let j = start; j <= end; j++) {\n glyphs.push(j);\n }\n }\n return glyphs;\n }\n }\n };\n var layout_default = Layout;\n\n // src/position.mjs\n function Position(font) {\n layout_default.call(this, font, \"gpos\");\n }\n Position.prototype = layout_default.prototype;\n Position.prototype.init = function() {\n const script = this.getDefaultScriptName();\n this.defaultKerningTables = this.getKerningTables(script);\n };\n Position.prototype.getKerningValue = function(kerningLookups, leftIndex, rightIndex) {\n for (let i = 0; i < kerningLookups.length; i++) {\n const subtables = kerningLookups[i].subtables;\n for (let j = 0; j < subtables.length; j++) {\n const subtable = subtables[j];\n const covIndex = this.getCoverageIndex(subtable.coverage, leftIndex);\n if (covIndex < 0) continue;\n switch (subtable.posFormat) {\n case 1: {\n let pairSet = subtable.pairSets[covIndex];\n for (let k = 0; k < pairSet.length; k++) {\n let pair = pairSet[k];\n if (pair.secondGlyph === rightIndex) {\n return pair.value1 && pair.value1.xAdvance || 0;\n }\n }\n break;\n }\n case 2: {\n const class1 = this.getGlyphClass(subtable.classDef1, leftIndex);\n const class2 = this.getGlyphClass(subtable.classDef2, rightIndex);\n const pair = subtable.classRecords[class1][class2];\n return pair.value1 && pair.value1.xAdvance || 0;\n }\n }\n }\n }\n return 0;\n };\n Position.prototype.getKerningTables = function(script, language) {\n if (this.font.tables.gpos) {\n return this.getLookupTables(script, language, \"kern\", 2);\n }\n };\n var position_default = Position;\n\n // src/util.mjs\n function arraysEqual(ar1, ar2) {\n const n = ar1.length;\n if (n !== ar2.length) {\n return false;\n }\n for (let i = 0; i < n; i++) {\n if (ar1[i] !== ar2[i]) {\n return false;\n }\n }\n return true;\n }\n function binarySearch(array, key, value) {\n let low = 0, high = array.length - 1;\n let result = null;\n while (low <= high) {\n const mid = Math.floor((low + high) / 2);\n const record = array[mid];\n const recordValue = record[key];\n if (recordValue < value) {\n low = mid + 1;\n } else if (recordValue > value) {\n high = mid - 1;\n } else {\n result = record;\n break;\n }\n }\n return result;\n }\n function binarySearchIndex(array, key, value) {\n let low = 0, high = array.length - 1;\n while (low <= high) {\n const mid = Math.floor((low + high) / 2);\n const element = array[mid];\n if (element[key] < value) {\n low = mid + 1;\n } else if (element[key] > value) {\n high = mid - 1;\n } else {\n return mid;\n }\n }\n return -1;\n }\n function binarySearchInsert(array, key, value) {\n let low = 0, high = array.length;\n const compare = (a, b) => a[key] - b[key];\n while (low < high) {\n const mid = low + high >>> 1;\n if (compare(array[mid], value) < 0) low = mid + 1;\n else high = mid;\n }\n array.splice(low, 0, value);\n return low;\n }\n function isGzip(buf) {\n return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;\n }\n function unGzip(gzip) {\n const data = new DataView(gzip.buffer, gzip.byteOffset, gzip.byteLength);\n let start = 10;\n const end = gzip.byteLength - 8;\n const flg = data.getInt8(3);\n if (flg & 4) {\n start += 2 + data.getUint16(start, true);\n }\n if (flg & 8) {\n while (start < end) if (gzip[start++] === 0) break;\n }\n if (flg & 16) {\n while (start < end) if (gzip[start++] === 0) break;\n }\n if (flg & 2) {\n start += 2;\n }\n if (start >= end) throw new Error(\"Can't find compressed blocks\");\n const isize = data.getUint32(data.byteLength - 4, true);\n return tinf_uncompress(gzip.subarray(start, end), new Uint8Array(isize));\n }\n function copyPoint(p) {\n return {\n x: p.x,\n y: p.y,\n onCurve: p.onCurve,\n lastPointOfContour: p.lastPointOfContour\n };\n }\n function copyComponent(c) {\n return {\n glyphIndex: c.glyphIndex,\n xScale: c.xScale,\n scale01: c.scale01,\n scale10: c.scale10,\n yScale: c.yScale,\n dx: c.dx,\n dy: c.dy\n };\n }\n\n // src/substitution.mjs\n function Substitution(font) {\n layout_default.call(this, font, \"gsub\");\n }\n function getSubstFormat(lookupTable, format, defaultSubtable) {\n const subtables = lookupTable.subtables;\n for (let i = 0; i < subtables.length; i++) {\n const subtable = subtables[i];\n if (subtable.substFormat === format) {\n return subtable;\n }\n }\n if (defaultSubtable) {\n subtables.push(defaultSubtable);\n return defaultSubtable;\n }\n return void 0;\n }\n Substitution.prototype = layout_default.prototype;\n Substitution.prototype.createDefaultTable = function() {\n return {\n version: 1,\n scripts: [{\n tag: \"DFLT\",\n script: {\n defaultLangSys: { reserved: 0, reqFeatureIndex: 65535, featureIndexes: [] },\n langSysRecords: []\n }\n }],\n features: [],\n lookups: []\n };\n };\n Substitution.prototype.getSingle = function(feature, script, language) {\n const substitutions = [];\n const lookupTables = this.getLookupTables(script, language, feature, 1);\n for (let idx = 0; idx < lookupTables.length; idx++) {\n const subtables = lookupTables[idx].subtables;\n for (let i = 0; i < subtables.length; i++) {\n const subtable = subtables[i];\n const glyphs = this.expandCoverage(subtable.coverage);\n let j;\n if (subtable.substFormat === 1) {\n const delta = subtable.deltaGlyphId;\n for (j = 0; j < glyphs.length; j++) {\n const glyph = glyphs[j];\n substitutions.push({ sub: glyph, by: glyph + delta });\n }\n } else {\n const substitute = subtable.substitute;\n for (j = 0; j < glyphs.length; j++) {\n substitutions.push({ sub: glyphs[j], by: substitute[j] });\n }\n }\n }\n }\n return substitutions;\n };\n Substitution.prototype.getMultiple = function(feature, script, language) {\n const substitutions = [];\n const lookupTables = this.getLookupTables(script, language, feature, 2);\n for (let idx = 0; idx < lookupTables.length; idx++) {\n const subtables = lookupTables[idx].subtables;\n for (let i = 0; i < subtables.length; i++) {\n const subtable = subtables[i];\n const glyphs = this.expandCoverage(subtable.coverage);\n let j;\n for (j = 0; j < glyphs.length; j++) {\n const glyph = glyphs[j];\n const replacements = subtable.sequences[j];\n substitutions.push({ sub: glyph, by: replacements });\n }\n }\n }\n return substitutions;\n };\n Substitution.prototype.getAlternates = function(feature, script, language) {\n const alternates = [];\n const lookupTables = this.getLookupTables(script, language, feature, 3);\n for (let idx = 0; idx < lookupTables.length; idx++) {\n const subtables = lookupTables[idx].subtables;\n for (let i = 0; i < subtables.length; i++) {\n const subtable = subtables[i];\n const glyphs = this.expandCoverage(subtable.coverage);\n const alternateSets = subtable.alternateSets;\n for (let j = 0; j < glyphs.length; j++) {\n alternates.push({ sub: glyphs[j], by: alternateSets[j] });\n }\n }\n }\n return alternates;\n };\n Substitution.prototype.getLigatures = function(feature, script, language) {\n const ligatures = [];\n const lookupTables = this.getLookupTables(script, language, feature, 4);\n for (let idx = 0; idx < lookupTables.length; idx++) {\n const subtables = lookupTables[idx].subtables;\n for (let i = 0; i < subtables.length; i++) {\n const subtable = subtables[i];\n const glyphs = this.expandCoverage(subtable.coverage);\n const ligatureSets = subtable.ligatureSets;\n for (let j = 0; j < glyphs.length; j++) {\n const startGlyph = glyphs[j];\n const ligSet = ligatureSets[j];\n for (let k = 0; k < ligSet.length; k++) {\n const lig = ligSet[k];\n ligatures.push({\n sub: [startGlyph].concat(lig.components),\n by: lig.ligGlyph\n });\n }\n }\n }\n }\n return ligatures;\n };\n Substitution.prototype.addSingle = function(feature, substitution, script, language) {\n const lookupTable = this.getLookupTables(script, language, feature, 1, true)[0];\n const subtable = getSubstFormat(lookupTable, 2, {\n // lookup type 1 subtable, format 2, coverage format 1\n substFormat: 2,\n coverage: { format: 1, glyphs: [] },\n substitute: []\n });\n check_default.assert(subtable.coverage.format === 1, \"Single: unable to modify coverage table format \" + subtable.coverage.format);\n const coverageGlyph = substitution.sub;\n let pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph);\n if (pos < 0) {\n pos = -1 - pos;\n subtable.coverage.glyphs.splice(pos, 0, coverageGlyph);\n subtable.substitute.splice(pos, 0, 0);\n }\n subtable.substitute[pos] = substitution.by;\n };\n Substitution.prototype.addMultiple = function(feature, substitution, script, language) {\n check_default.assert(substitution.by instanceof Array && substitution.by.length > 1, 'Multiple: \"by\" must be an array of two or more ids');\n const lookupTable = this.getLookupTables(script, language, feature, 2, true)[0];\n const subtable = getSubstFormat(lookupTable, 1, {\n // lookup type 2 subtable, format 1, coverage format 1\n substFormat: 1,\n coverage: { format: 1, glyphs: [] },\n sequences: []\n });\n check_default.assert(subtable.coverage.format === 1, \"Multiple: unable to modify coverage table format \" + subtable.coverage.format);\n const coverageGlyph = substitution.sub;\n let pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph);\n if (pos < 0) {\n pos = -1 - pos;\n subtable.coverage.glyphs.splice(pos, 0, coverageGlyph);\n subtable.sequences.splice(pos, 0, 0);\n }\n subtable.sequences[pos] = substitution.by;\n };\n Substitution.prototype.addAlternate = function(feature, substitution, script, language) {\n const lookupTable = this.getLookupTables(script, language, feature, 3, true)[0];\n const subtable = getSubstFormat(lookupTable, 1, {\n // lookup type 3 subtable, format 1, coverage format 1\n substFormat: 1,\n coverage: { format: 1, glyphs: [] },\n alternateSets: []\n });\n check_default.assert(subtable.coverage.format === 1, \"Alternate: unable to modify coverage table format \" + subtable.coverage.format);\n const coverageGlyph = substitution.sub;\n let pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph);\n if (pos < 0) {\n pos = -1 - pos;\n subtable.coverage.glyphs.splice(pos, 0, coverageGlyph);\n subtable.alternateSets.splice(pos, 0, 0);\n }\n subtable.alternateSets[pos] = substitution.by;\n };\n Substitution.prototype.addLigature = function(feature, ligature, script, language) {\n const lookupTable = this.getLookupTables(script, language, feature, 4, true)[0];\n let subtable = lookupTable.subtables[0];\n if (!subtable) {\n subtable = {\n // lookup type 4 subtable, format 1, coverage format 1\n substFormat: 1,\n coverage: { format: 1, glyphs: [] },\n ligatureSets: []\n };\n lookupTable.subtables[0] = subtable;\n }\n check_default.assert(subtable.coverage.format === 1, \"Ligature: unable to modify coverage table format \" + subtable.coverage.format);\n const coverageGlyph = ligature.sub[0];\n const ligComponents = ligature.sub.slice(1);\n const ligatureTable = {\n ligGlyph: ligature.by,\n components: ligComponents\n };\n let pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph);\n if (pos >= 0) {\n const ligatureSet = subtable.ligatureSets[pos];\n for (let i = 0; i < ligatureSet.length; i++) {\n if (arraysEqual(ligatureSet[i].components, ligComponents)) {\n return;\n }\n }\n ligatureSet.push(ligatureTable);\n } else {\n pos = -1 - pos;\n subtable.coverage.glyphs.splice(pos, 0, coverageGlyph);\n subtable.ligatureSets.splice(pos, 0, [ligatureTable]);\n }\n };\n Substitution.prototype.getFeature = function(feature, script, language) {\n if (/ss\\d\\d/.test(feature)) {\n return this.getSingle(feature, script, language);\n }\n switch (feature) {\n case \"aalt\":\n case \"salt\":\n return this.getSingle(feature, script, language).concat(this.getAlternates(feature, script, language));\n case \"dlig\":\n case \"liga\":\n case \"rlig\":\n return this.getLigatures(feature, script, language);\n case \"ccmp\":\n return this.getMultiple(feature, script, language).concat(this.getLigatures(feature, script, language));\n case \"stch\":\n return this.getMultiple(feature, script, language);\n }\n return void 0;\n };\n Substitution.prototype.add = function(feature, sub, script, language) {\n if (/ss\\d\\d/.test(feature)) {\n return this.addSingle(feature, sub, script, language);\n }\n switch (feature) {\n case \"aalt\":\n case \"salt\":\n if (typeof sub.by === \"number\") {\n return this.addSingle(feature, sub, script, language);\n }\n return this.addAlternate(feature, sub, script, language);\n case \"dlig\":\n case \"liga\":\n case \"rlig\":\n return this.addLigature(feature, sub, script, language);\n case \"ccmp\":\n if (sub.by instanceof Array) {\n return this.addMultiple(feature, sub, script, language);\n }\n return this.addLigature(feature, sub, script, language);\n }\n return void 0;\n };\n var substitution_default = Substitution;\n\n // src/palettes.mjs\n var PaletteManager = class {\n // private properties don't work with reify\n // @TODO: refactor once we migrated to ES6 modules, see https://github.com/opentypejs/opentype.js/pull/579\n // #font = null;\n /**\n * @type {integer} CPAL color used to (pre)fill unset colors in a palette.\n * Format 0xBBGGRRAA\n */\n // defaultValue = 0x000000FF;\n /**\n * \n * @param {opentype.Font} font \n */\n constructor(font) {\n this.defaultValue = 255;\n this.font = font;\n }\n /**\n * Returns the font's cpal table object if present\n * @returns {Object}\n */\n cpal() {\n if (this.font.tables && this.font.tables.cpal) {\n return this.font.tables.cpal;\n }\n return false;\n }\n /**\n * Returns an array of arrays of color values for each palette, optionally in a specified color format\n * @param {string} colorFormat \n * @returns {Array}\n */\n getAll(colorFormat) {\n const palettes = [];\n const cpal = this.cpal();\n if (!cpal) return palettes;\n for (let i = 0; i < cpal.colorRecordIndices.length; i++) {\n const startIndex = cpal.colorRecordIndices[i];\n const paletteColors = [];\n for (let j = startIndex; j < startIndex + cpal.numPaletteEntries; j++) {\n paletteColors.push(formatColor(cpal.colorRecords[j], colorFormat || \"hexa\"));\n }\n palettes.push(paletteColors);\n }\n return palettes;\n }\n /**\n * Converts a color value string or array of color value strings to CPAL integer color value(s)\n * @param {string|Array} color \n * @returns {integer}\n */\n toCPALcolor(color) {\n if (Array.isArray(color)) {\n return color.map((color2) => parseColor(color2, \"raw\"));\n }\n return parseColor(color, \"raw\");\n }\n /**\n * Fills a set of palette colors (from palette index, or a provided array of CPAL color values) with a set of colors, falling back to the default color value, until a given count\n * @param {Array|integer} palette Palette index integer or Array of colors to be filled\n * @param {Array} colors Colors to fill the palette with\n * @param {integer} _colorCount Number of colors to fill the palette with, defaults to the value of the numPaletteEntries field. Used internally by extend() and shouldn't be set manually\n * @returns \n */\n fillPalette(palette, colors = [], _colorCount = this.cpal().numPaletteEntries) {\n palette = Number.isInteger(palette) ? this.get(palette, \"raw\") : palette;\n return Object.assign(Array(_colorCount).fill(this.defaultValue), this.toCPALcolor(palette).concat(this.toCPALcolor(colors)));\n }\n /**\n * Extend existing palettes and numPaletteEntries by a number of color slots\n * @param {integer} num number of additional color slots to add to all palettes\n */\n extend(num) {\n if (this.ensureCPAL(Array(num).fill(this.defaultValue))) {\n return;\n }\n const cpal = this.cpal();\n const newCount = cpal.numPaletteEntries + num;\n const palettes = this.getAll().map((palette) => this.fillPalette(palette, [], newCount));\n cpal.numPaletteEntries = newCount;\n cpal.colorRecords = this.toCPALcolor(palettes.flat());\n this.updateIndices();\n }\n /**\n * Get a specific palette by its zero-based index\n * @param {integer} paletteIndex \n * @param {string} [colorFormat='hexa']\n * @returns {Array}\n */\n get(paletteIndex, colorFormat = \"hexa\") {\n return this.getAll(colorFormat)[paletteIndex] || null;\n }\n /**\n * Get a color from a specific palette by its zero-based index\n * @param {integer} index \n * @param {integer} paletteIndex\n * @param {string} [colorFormat ='hexa']\n * @returns \n */\n getColor(index, paletteIndex = 0, colorFormat = \"hexa\") {\n return getPaletteColor(this.font, index, paletteIndex, colorFormat);\n }\n /**\n * Set one or more colors on a specific palette by its zero-based index\n * @param {integer} index zero-based color index to start filling from\n * @param {string|integer|Array} color color value or array of color values\n * @param {integer} paletteIndex\n * @returns \n */\n setColor(index, colors, paletteIndex = 0) {\n index = parseInt(index);\n paletteIndex = parseInt(paletteIndex);\n let palettes = this.getAll(\"raw\");\n let palette = palettes[paletteIndex];\n if (!palette) {\n throw Error(`paletteIndex ${paletteIndex} out of range`);\n }\n const cpal = this.cpal();\n const colorCount = cpal.numPaletteEntries;\n if (!Array.isArray(colors)) {\n colors = [colors];\n }\n if (colors.length + index > colorCount) {\n this.extend(colors.length + index - colorCount);\n palettes = this.getAll(\"raw\");\n palette = palettes[paletteIndex];\n }\n for (let i = 0; i < colors.length; i++) {\n palette[i + index] = this.toCPALcolor(colors[i]);\n }\n cpal.colorRecords = palettes.flat();\n this.updateIndices();\n }\n /**\n * Add a new palette. \n * @param {Array} colors (optional) colors to add to the palette, differences to existing palettes will be filled with the defaultValue.\n * @returns \n */\n add(colors) {\n if (this.ensureCPAL(colors)) {\n return;\n }\n const cpal = this.cpal();\n const colorCount = cpal.numPaletteEntries;\n if (colors && colors.length) {\n colors = this.toCPALcolor(colors);\n if (colors.length > colorCount) {\n this.extend(colors.length - colorCount);\n } else if (colors.length < colorCount) {\n colors = this.fillPalette(colors);\n }\n cpal.colorRecordIndices.push(cpal.colorRecords.length);\n cpal.colorRecords.push(...colors);\n } else {\n cpal.colorRecordIndices.push(cpal.colorRecords.length);\n cpal.colorRecords.push(...Array(colorCount).fill(this.defaultValue));\n }\n }\n /**\n * deletes a palette by its zero-based index\n * @param {integer} paletteIndex \n */\n delete(paletteIndex) {\n const palettes = this.getAll(\"raw\");\n delete palettes[paletteIndex];\n const cpal = this.cpal();\n cpal.colorRecordIndices.pop();\n cpal.colorRecords = palettes.flat();\n }\n /**\n * Deletes a specific color index in all palettes and updates all layers using that color with the replacement index\n * @param {integer} colorIndex index of the color that should be deleted\n * @param {integer} replacementIndex index (according to the palette before deletion) of the color to replace in layers using the color to be to deleted\n */\n deleteColor(colorIndex, replacementIndex) {\n if (colorIndex === replacementIndex) {\n throw Error(\"replacementIndex cannot be the same as colorIndex\");\n }\n const cpal = this.cpal();\n const palettes = this.getAll(\"raw\");\n const updatedPalettes = [];\n if (replacementIndex > cpal.numPaletteEntries - 1) {\n throw Error(`Replacement index out of range: numPaletteEntries after deletion: ${cpal.numPaletteEntries - 1}, replacementIndex: ${replacementIndex})`);\n }\n for (let i = 0; i < palettes.length; i++) {\n const palette = palettes[i];\n const updatedPalette = palette.filter((color, index) => index !== colorIndex);\n updatedPalettes.push(updatedPalette);\n }\n const colrTable = this.font.tables.colr;\n if (colrTable) {\n const layerRecords = colrTable.layerRecords;\n for (let i = 0; i < layerRecords.length; i++) {\n const currentIndex = layerRecords[i].paletteIndex;\n if (currentIndex > colorIndex) {\n const shiftAmount = 1;\n layerRecords[i].paletteIndex -= shiftAmount;\n } else if (currentIndex === colorIndex) {\n let replacementShift = 0;\n for (let j = 0; j < palettes.length; j++) {\n if (replacementIndex > colorIndex && replacementIndex <= colorIndex + palettes[j].length) {\n replacementShift++;\n break;\n }\n }\n layerRecords[i].paletteIndex = replacementIndex - replacementShift;\n }\n }\n this.font.tables.colr = {\n ...colrTable,\n layerRecords\n };\n }\n const flattenedPalettes = updatedPalettes.flat();\n for (let i = 0; i < palettes.length; i++) {\n cpal.colorRecordIndices[i] -= i;\n }\n cpal.numPaletteEntries = Math.max(0, cpal.numPaletteEntries - 1);\n cpal.colorRecords = this.toCPALcolor(flattenedPalettes);\n }\n /**\n * Makes sure that the CPAL table exists and is populated with default values.\n * @param {Array} colors (optional) colors to populate on creation\n * @returns {Boolean} true if it was created, false if it already existed.\n */\n ensureCPAL(colors) {\n if (!this.cpal()) {\n if (!colors || !colors.length) {\n colors = [this.defaultValue];\n } else {\n colors = this.toCPALcolor(colors);\n }\n this.font.tables.cpal = {\n version: 0,\n numPaletteEntries: colors.length,\n colorRecords: colors,\n colorRecordIndices: [0]\n };\n return true;\n }\n return false;\n }\n /**\n * Mainly used internally. Recalculates the colorRecordIndices array based on the numPaletteEntries and number of palettes\n */\n updateIndices() {\n const cpal = this.cpal();\n const paletteCount = Math.ceil(cpal.colorRecords.length / cpal.numPaletteEntries);\n cpal.colorRecordIndices = [];\n for (let i = 0; i < paletteCount; i++) {\n cpal.colorRecordIndices.push(i * cpal.numPaletteEntries);\n }\n }\n };\n\n // src/layers.mjs\n var LayerManager = class {\n // private properties don't work with reify\n // @TODO: refactor once we migrated to ES6 modules, see https://github.com/opentypejs/opentype.js/pull/579\n // #font = null;\n constructor(font) {\n this.font = font;\n }\n /**\n * Mainly used internally. Ensures that the COLR table exists and is populated with default values\n * @returns the LayerManager's font instance for chaining\n */\n ensureCOLR() {\n if (!this.font.tables.colr) {\n this.font.tables.colr = {\n version: 0,\n baseGlyphRecords: [],\n layerRecords: []\n };\n }\n return this.font;\n }\n /**\n * Gets the layers for a specific glyph\n * @param {integer} glyphIndex\n * @returns {Array