: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
error = this.executeCommand(2, COMMAND_MAP.rmoveto);
error = this.executeCommand(1, COMMAND_MAP.hmoveto);
error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
error = this.executeCommand(2, COMMAND_MAP.vstem);
error = this.executeCommand(2, COMMAND_MAP.hstem);
if (seacAnalysisEnabled) {
const asb = this.stack.at(-5);
this.seac = this.stack.splice(-4, 4);
this.seac[0] += this.lsb - asb;
error = this.executeCommand(0, COMMAND_MAP.endchar);
error = this.executeCommand(4, COMMAND_MAP.endchar);
if (this.stack.length < 4) {
const sby = this.stack.pop();
this.stack.push(wx, sbx, sby);
error = this.executeCommand(3, COMMAND_MAP.rmoveto);
if (this.stack.length < 2) {
const num2 = this.stack.pop();
const num1 = this.stack.pop();
this.stack.push(num1 / num2);
if (this.stack.length < 2) {
subrNumber = this.stack.pop();
const numArgs = this.stack.pop();
if (subrNumber === 0 && numArgs === 3) {
const flexArgs = this.stack.splice(-17, 17);
this.stack.push(flexArgs[2] + flexArgs[0], flexArgs[3] + flexArgs[1], flexArgs[4], flexArgs[5], flexArgs[6], flexArgs[7], flexArgs[8], flexArgs[9], flexArgs[10], flexArgs[11], flexArgs[12], flexArgs[13], flexArgs[14]);
error = this.executeCommand(13, COMMAND_MAP.flex, true);
this.stack.push(flexArgs[15], flexArgs[16]);
} else if (subrNumber === 1 && numArgs === 0) {
warn('Unknown type 1 charstring command of "' + value + '"');
} else if (value <= 246) {
} else if (value <= 250) {
value = (value - 247) * 256 + encoded[++i] + 108;
} else if (value <= 254) {
value = -((value - 251) * 256) - encoded[++i] - 108;
value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
executeCommand(howManyArgs, command, keepStack) {
const stackLength = this.stack.length;
if (howManyArgs > stackLength) {
const start = stackLength - howManyArgs;
for (let i = start; i < stackLength; i++) {
let value = this.stack[i];
if (Number.isInteger(value)) {
this.output.push(28, value >> 8 & 0xff, value & 0xff);
value = 65536 * value | 0;
this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
this.output.push(...command);
this.stack.splice(start, howManyArgs);
const EEXEC_ENCRYPT_KEY = 55665;
const CHAR_STRS_ENCRYPT_KEY = 4330;
function isHexDigit(code) {
return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
function decrypt(data, key, discardNumber) {
if (discardNumber >= data.length) {
return new Uint8Array(0);
for (i = 0; i < discardNumber; i++) {
r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
const count = data.length - discardNumber;
const decrypted = new Uint8Array(count);
for (i = discardNumber, j = 0; j < count; i++, j++) {
decrypted[j] = value ^ r >> 8;
r = (value + r) * c1 + c2 & (1 << 16) - 1;
function decryptAscii(data, key, discardNumber) {
const count = data.length,
maybeLength = count >>> 1;
const decrypted = new Uint8Array(maybeLength);
for (i = 0, j = 0; i < count; i++) {
if (!isHexDigit(digit1)) {
while (i < count && !isHexDigit(digit2 = data[i])) {
const value = parseInt(String.fromCharCode(digit1, digit2), 16);
decrypted[j++] = value ^ r >> 8;
r = (value + r) * c1 + c2 & (1 << 16) - 1;
return decrypted.slice(discardNumber, j);
return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
constructor(stream, encrypted, seacAnalysisEnabled) {
const data = stream.getBytes();
const isBinary = !((isHexDigit(data[0]) || isWhiteSpace(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7]));
stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
this.seacAnalysisEnabled = !!seacAnalysisEnabled;
const token = this.getToken();
if (token === null || token === "]" || token === "}") {
array.push(parseFloat(token || 0));
const token = this.getToken();
return parseFloat(token || 0);
const token = this.getToken();
return parseInt(token || 0, 10) | 0;
const token = this.getToken();
return token === "true" ? 1 : 0;
return this.currentChar = this.stream.getByte();
return this.currentChar = this.stream.getByte();
let ch = this.currentChar;
if (ch === 0x0a || ch === 0x0d) {
} else if (ch === 0x25) {
} else if (!isWhiteSpace(ch)) {
return String.fromCharCode(ch);
token += String.fromCharCode(ch);
} while (ch >= 0 && !isWhiteSpace(ch) && !isSpecial(ch));
readCharStrings(bytes, lenIV) {
return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
extractFontProgram(properties) {
const stream = this.stream;
const privateData = Object.create(null);
let token, length, data, lenIV;
while ((token = this.getToken()) !== null) {
if (token === null || token === "end") {
const glyph = this.getToken();
data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
lenIV = program.properties.privateData.lenIV;
const encoded = this.readCharStrings(data, lenIV);
if (token === "noaccess") {
} else if (token === "/") {
while (this.getToken() === "dup") {
const index = this.readInt();
data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
lenIV = program.properties.privateData.lenIV;
const encoded = this.readCharStrings(data, lenIV);
if (token === "noaccess") {
const blueArray = this.readNumberArray();
if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
program.properties.privateData[token] = blueArray;
program.properties.privateData[token] = this.readNumberArray();
program.properties.privateData[token] = this.readNumberArray()[0];
program.properties.privateData[token] = this.readNumber();
program.properties.privateData[token] = this.readNumber() || 0.06;
program.properties.privateData[token] = this.readBoolean();
const charString = new Type1CharString();
const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
let output = charString.output;
const charStringObject = {
if (glyph === ".notdef") {
program.charstrings.unshift(charStringObject);
program.charstrings.push(charStringObject);
if (properties.builtInEncoding) {
const index = properties.builtInEncoding.indexOf(glyph);
if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
properties.widths[index] = charString.width;
extractFontHeader(properties) {
while ((token = this.getToken()) !== null) {
const matrix = this.readNumberArray();
properties.fontMatrix = matrix;
const encodingArg = this.getToken();
if (!/^\d+$/.test(encodingArg)) {
encoding = getEncoding(encodingArg);
const size = parseInt(encodingArg, 10) | 0;
for (let j = 0; j < size; j++) {
while (token !== "dup" && token !== "def") {
const index = this.readInt();
const glyph = this.getToken();
properties.builtInEncoding = encoding;
const fontBBox = this.readNumberArray();
properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
properties.descent = Math.min(fontBBox[1], fontBBox[3]);
properties.ascentScaled = true;
;// CONCATENATED MODULE: ./src/core/type1_font.js
function findBlock(streamBytes, signature, startIndex) {
const streamBytesLength = streamBytes.length;
const signatureLength = signature.length;
const scanLength = streamBytesLength - signatureLength;
while (j < signatureLength && streamBytes[i + j] === signature[j]) {
if (j >= signatureLength) {
while (i < streamBytesLength && isWhiteSpace(streamBytes[i])) {
function getHeaderBlock(stream, suggestedLength) {
const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
const streamStartPos = stream.pos;
let headerBytes, headerBytesLength, block;
headerBytes = stream.getBytes(suggestedLength);
headerBytesLength = headerBytes.length;
if (headerBytesLength === suggestedLength) {
block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
if (block.found && block.length === suggestedLength) {
stream: new Stream(headerBytes),