InputObject SideIndicator ----------- ------------- function getUint32(data, offset) { => return ( => ((data[offset] << 24) | => (data[offset + 1] << 16) | => (data[offset + 2] << 8) | => data[offset + 3]) >>> => 0 => function getUint16(data, offset) { => return (data[offset] << 8) | data[offset + 1]; => function getInt16(data, offset) { => return ((data[offset] << 24) | (data[offset + 1] << 16)) >> 16; => function getInt8(data, offset) { => return (data[offset] << 24) >> 24; => return getInt16(data, offset) / 16384; => getUint16(data, start + 2) === 1 => ? getUint32(data, start + 8) => : getUint32(data, start + 16); => const format = getUint16(data, start + offset); => getUint16(data, start + offset + 2); // length => const segCount = getUint16(data, start + offset + 6) >> 1; => ranges[i] = { end: getUint16(data, p) }; => ranges[i].start = getUint16(data, p); => ranges[i].idDelta = getUint16(data, p); => let idOffset = getUint16(data, p); => ranges[i].ids[j] = getUint16(data, p + idOffset); => const groups = getUint32(data, start + offset + 12); => start = getUint32(data, p); => end: getUint32(data, p + 4), => idDelta: getUint32(data, p + 8) - start, => ); => itemDecode = getUint32; => itemDecode = (data, offset) => 2 * getUint16(data, offset); => cmds.push({ cmd: "moveTo", args: [x, y] }); => cmds.push({ cmd: "lineTo", args: [x, y] }); => cmds.push({ cmd: "quadraticCurveTo", args: [xa, ya, x, y] }); => const numberOfContours = getInt16(code, i); => flags = getUint16(code, i); => const glyphIndex = getUint16(code, i + 2); => arg1 = getInt16(code, i); => arg2 = getInt16(code, i + 2); => arg1 = getUint16(code, i); => arg2 = getUint16(code, i + 2); => arg1 = getInt8(code, i++); => arg2 = getInt8(code, i++); => cmds.push( => { cmd: "save" }, => { => cmd: "transform", => args: [scaleX, scale01, scale10, scaleY, x, y], => ); => cmds.push({ cmd: "restore" }); => endPtsOfContours.push(getUint16(code, i)); => const instructionLength = getUint16(code, i); => x += getInt16(code, i); => y += getInt16(code, i); => cmds.push({ cmd: "moveTo", args: [x, y] }); => cmds.push({ cmd: "lineTo", args: [x, y] }); => cmds.push({ cmd: "bezierCurveTo", args: [x1, y1, x2, y2, x, y] }); => cmds.push({ cmd: "save" }, { cmd: "translate", args: [x, y] }); => cmds.push({ cmd: "restore" }); => stack.push(((code[i] << 24) | (code[i + 1] << 16)) >> 16); => } => const NOOP = []; => if (this.constructor === CompiledFont) { => let fn = this.compiledGlyphs[glyphId]; => if (!fn) { => this.compiledGlyphs[glyphId] = fn; => // Avoid attempting to re-compile a corrupt glyph. => this.compiledGlyphs[glyphId] = NOOP; => if (this.compiledCharCodeToGlyphId[charCode] === undefined) { => this.compiledCharCodeToGlyphId[charCode] = glyphId; => } => throw ex; => if (this.compiledCharCodeToGlyphId[charCode] === undefined) { => this.compiledCharCodeToGlyphId[charCode] = glyphId; => if (!code || code.length === 0 || code[0] === 14) { => const cmds = [ => { cmd: "save" }, => { cmd: "transform", args: fontMatrix.slice() }, => { cmd: "scale", args: ["size", "-size"] }, => ]; => cmds.push({ cmd: "restore" }); => return cmds; => } => constructor(cffInfo, cmap, fontMatrix, glyphNameMap) { => this.glyphNameMap = glyphNameMap || getGlyphsUnicode(); => } => const numTables = getUint16(data, 4); => const offset = getUint32(data, p + 8); => const length = getUint32(data, p + 12); => unitsPerEm = getUint16(data, offset + 18); => indexToLocFormat = getUint16(data, offset + 50); => return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap); => } => assert, <= Util, <= import { <= isNumberArray, <= readInt16, <= readInt8, <= readUint16, <= readUint32, <= } from "./core_utils.js"; <= return readInt16(data, offset) / 16384; <= readUint16(data, start + 2) === 1 <= ? readUint32(data, start + 8) <= : readUint32(data, start + 16); <= const format = readUint16(data, start + offset); <= readUint16(data, start + offset + 2); // length <= const segCount = readUint16(data, start + offset + 6) >> 1; <= ranges[i] = { end: readUint16(data, p) }; <= ranges[i].start = readUint16(data, p); <= ranges[i].idDelta = readUint16(data, p); <= let idOffset = readUint16(data, p); <= ranges[i].ids[j] = readUint16(data, p + idOffset); <= const groups = readUint32(data, start + offset + 12); <= start = readUint32(data, p); <= end: readUint32(data, p + 4), <= idDelta: readUint32(data, p + 8) - start, <= itemDecode = readUint32; <= itemDecode = (data, offset) => 2 * readUint16(data, offset); <= if (firstPoint) { <= // Close the current subpath in adding a straight line to the first point. <= cmds.add("L", firstPoint); <= firstPoint = [x, y]; <= cmds.add("M", [x, y]); <= cmds.add("L", [x, y]); <= cmds.add("Q", [xa, ya, x, y]); <= const numberOfContours = readInt16(code, i); <= let firstPoint = null; <= flags = readUint16(code, i); <= const glyphIndex = readUint16(code, i + 2); <= arg1 = readInt16(code, i); <= arg2 = readInt16(code, i + 2); <= arg1 = readUint16(code, i); <= arg2 = readUint16(code, i + 2); <= arg1 = readInt8(code, i++); <= arg2 = readInt8(code, i++); <= cmds.save(); <= cmds.transform([scaleX, scale01, scale10, scaleY, x, y]); <= cmds.restore(); <= endPtsOfContours.push(readUint16(code, i)); <= const instructionLength = readUint16(code, i); <= x += readInt16(code, i); <= y += readInt16(code, i); <= if (firstPoint) { <= // Close the current subpath in adding a straight line to the first point. <= cmds.add("L", firstPoint); <= firstPoint = [x, y]; <= cmds.add("M", [x, y]); <= cmds.add("L", [x, y]); <= cmds.add("C", [x1, y1, x2, y2, x, y]); <= let firstPoint = null; <= cmds.save(); <= cmds.translate(x, y); <= cmds.restore(); <= stack.push(readInt16(code, i)); <= const NOOP = ""; <= class Commands { <= cmds = []; <= transformStack = []; <= currentTransform = [1, 0, 0, 1, 0, 0]; <= add(cmd, args) { <= if (args) { <= const { currentTransform } = this; <= for (let i = 0, ii = args.length; i < ii; i += 2) { <= Util.applyTransform(args, currentTransform, i); <= this.cmds.push(`${cmd}${args.join(" ")}`); <= } else { <= this.cmds.push(cmd); <= transform(transf) { <= this.currentTransform = Util.transform(this.currentTransform, transf); <= translate(x, y) { <= this.transform([1, 0, 0, 1, x, y]); <= save() { <= this.transformStack.push(this.currentTransform.slice()); <= restore() { <= this.currentTransform = this.transformStack.pop() || [1, 0, 0, 1, 0, 0]; <= getSVG() { <= return this.cmds.join(""); <= if ( <= (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) && <= this.constructor === CompiledFont <= ) { <= let fn = this.compiledGlyphs[glyphId], <= compileEx; <= if (fn === undefined) { <= fn = NOOP; // Avoid attempting to re-compile a corrupt glyph. <= compileEx = ex; <= this.compiledGlyphs[glyphId] = fn; <= this.compiledCharCodeToGlyphId[charCode] ??= glyphId; <= if (compileEx) { <= throw compileEx; <= if (!code?.length || code[0] === 14) { <= } <= assert(isNumberArray(fontMatrix, 6), "Expected a valid fontMatrix."); <= const cmds = new Commands(); <= cmds.transform(fontMatrix.slice()); <= cmds.add("Z"); <= return cmds.getSVG(); <= } <= } <= } <= constructor(cffInfo, cmap, fontMatrix) { <= this.glyphNameMap = getGlyphsUnicode(); <= <= <= } <= } <= <= const numTables = readUint16(data, 4); <= const offset = readUint32(data, p + 8); <= const length = readUint32(data, p + 12); <= unitsPerEm = readUint16(data, offset + 18); <= indexToLocFormat = readUint16(data, offset + 50); <= } <= } <= <= } <= return new Type2Compiled(cff, cmap, font.fontMatrix); <= } <= <=