Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/embedpre.../assets/pdf/build
File: pdf.worker.js
return parseFloatOperand();
[15000] Fix | Delete
} else if (value === 28) {
[15001] Fix | Delete
value = dict[pos++];
[15002] Fix | Delete
value = (value << 24 | dict[pos++] << 16) >> 16;
[15003] Fix | Delete
return value;
[15004] Fix | Delete
} else if (value === 29) {
[15005] Fix | Delete
value = dict[pos++];
[15006] Fix | Delete
value = value << 8 | dict[pos++];
[15007] Fix | Delete
value = value << 8 | dict[pos++];
[15008] Fix | Delete
value = value << 8 | dict[pos++];
[15009] Fix | Delete
return value;
[15010] Fix | Delete
} else if (value >= 32 && value <= 246) {
[15011] Fix | Delete
return value - 139;
[15012] Fix | Delete
} else if (value >= 247 && value <= 250) {
[15013] Fix | Delete
return (value - 247) * 256 + dict[pos++] + 108;
[15014] Fix | Delete
} else if (value >= 251 && value <= 254) {
[15015] Fix | Delete
return -((value - 251) * 256) - dict[pos++] - 108;
[15016] Fix | Delete
}
[15017] Fix | Delete
warn('CFFParser_parseDict: "' + value + '" is a reserved command.');
[15018] Fix | Delete
return NaN;
[15019] Fix | Delete
}
[15020] Fix | Delete
function parseFloatOperand() {
[15021] Fix | Delete
let str = "";
[15022] Fix | Delete
const eof = 15;
[15023] Fix | Delete
const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
[15024] Fix | Delete
const length = dict.length;
[15025] Fix | Delete
while (pos < length) {
[15026] Fix | Delete
const b = dict[pos++];
[15027] Fix | Delete
const b1 = b >> 4;
[15028] Fix | Delete
const b2 = b & 15;
[15029] Fix | Delete
if (b1 === eof) {
[15030] Fix | Delete
break;
[15031] Fix | Delete
}
[15032] Fix | Delete
str += lookup[b1];
[15033] Fix | Delete
if (b2 === eof) {
[15034] Fix | Delete
break;
[15035] Fix | Delete
}
[15036] Fix | Delete
str += lookup[b2];
[15037] Fix | Delete
}
[15038] Fix | Delete
return parseFloat(str);
[15039] Fix | Delete
}
[15040] Fix | Delete
let operands = [];
[15041] Fix | Delete
const entries = [];
[15042] Fix | Delete
pos = 0;
[15043] Fix | Delete
const end = dict.length;
[15044] Fix | Delete
while (pos < end) {
[15045] Fix | Delete
let b = dict[pos];
[15046] Fix | Delete
if (b <= 21) {
[15047] Fix | Delete
if (b === 12) {
[15048] Fix | Delete
b = b << 8 | dict[++pos];
[15049] Fix | Delete
}
[15050] Fix | Delete
entries.push([b, operands]);
[15051] Fix | Delete
operands = [];
[15052] Fix | Delete
++pos;
[15053] Fix | Delete
} else {
[15054] Fix | Delete
operands.push(parseOperand());
[15055] Fix | Delete
}
[15056] Fix | Delete
}
[15057] Fix | Delete
return entries;
[15058] Fix | Delete
}
[15059] Fix | Delete
parseIndex(pos) {
[15060] Fix | Delete
const cffIndex = new CFFIndex();
[15061] Fix | Delete
const bytes = this.bytes;
[15062] Fix | Delete
const count = bytes[pos++] << 8 | bytes[pos++];
[15063] Fix | Delete
const offsets = [];
[15064] Fix | Delete
let end = pos;
[15065] Fix | Delete
let i, ii;
[15066] Fix | Delete
if (count !== 0) {
[15067] Fix | Delete
const offsetSize = bytes[pos++];
[15068] Fix | Delete
const startPos = pos + (count + 1) * offsetSize - 1;
[15069] Fix | Delete
for (i = 0, ii = count + 1; i < ii; ++i) {
[15070] Fix | Delete
let offset = 0;
[15071] Fix | Delete
for (let j = 0; j < offsetSize; ++j) {
[15072] Fix | Delete
offset <<= 8;
[15073] Fix | Delete
offset += bytes[pos++];
[15074] Fix | Delete
}
[15075] Fix | Delete
offsets.push(startPos + offset);
[15076] Fix | Delete
}
[15077] Fix | Delete
end = offsets[count];
[15078] Fix | Delete
}
[15079] Fix | Delete
for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
[15080] Fix | Delete
const offsetStart = offsets[i];
[15081] Fix | Delete
const offsetEnd = offsets[i + 1];
[15082] Fix | Delete
cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
[15083] Fix | Delete
}
[15084] Fix | Delete
return {
[15085] Fix | Delete
obj: cffIndex,
[15086] Fix | Delete
endPos: end
[15087] Fix | Delete
};
[15088] Fix | Delete
}
[15089] Fix | Delete
parseNameIndex(index) {
[15090] Fix | Delete
const names = [];
[15091] Fix | Delete
for (let i = 0, ii = index.count; i < ii; ++i) {
[15092] Fix | Delete
const name = index.get(i);
[15093] Fix | Delete
names.push(bytesToString(name));
[15094] Fix | Delete
}
[15095] Fix | Delete
return names;
[15096] Fix | Delete
}
[15097] Fix | Delete
parseStringIndex(index) {
[15098] Fix | Delete
const strings = new CFFStrings();
[15099] Fix | Delete
for (let i = 0, ii = index.count; i < ii; ++i) {
[15100] Fix | Delete
const data = index.get(i);
[15101] Fix | Delete
strings.add(bytesToString(data));
[15102] Fix | Delete
}
[15103] Fix | Delete
return strings;
[15104] Fix | Delete
}
[15105] Fix | Delete
createDict(Type, dict, strings) {
[15106] Fix | Delete
const cffDict = new Type(strings);
[15107] Fix | Delete
for (const [key, value] of dict) {
[15108] Fix | Delete
cffDict.setByKey(key, value);
[15109] Fix | Delete
}
[15110] Fix | Delete
return cffDict;
[15111] Fix | Delete
}
[15112] Fix | Delete
parseCharString(state, data, localSubrIndex, globalSubrIndex) {
[15113] Fix | Delete
if (!data || state.callDepth > MAX_SUBR_NESTING) {
[15114] Fix | Delete
return false;
[15115] Fix | Delete
}
[15116] Fix | Delete
let stackSize = state.stackSize;
[15117] Fix | Delete
const stack = state.stack;
[15118] Fix | Delete
let length = data.length;
[15119] Fix | Delete
for (let j = 0; j < length;) {
[15120] Fix | Delete
const value = data[j++];
[15121] Fix | Delete
let validationCommand = null;
[15122] Fix | Delete
if (value === 12) {
[15123] Fix | Delete
const q = data[j++];
[15124] Fix | Delete
if (q === 0) {
[15125] Fix | Delete
data[j - 2] = 139;
[15126] Fix | Delete
data[j - 1] = 22;
[15127] Fix | Delete
stackSize = 0;
[15128] Fix | Delete
} else {
[15129] Fix | Delete
validationCommand = CharstringValidationData12[q];
[15130] Fix | Delete
}
[15131] Fix | Delete
} else if (value === 28) {
[15132] Fix | Delete
stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
[15133] Fix | Delete
j += 2;
[15134] Fix | Delete
stackSize++;
[15135] Fix | Delete
} else if (value === 14) {
[15136] Fix | Delete
if (stackSize >= 4) {
[15137] Fix | Delete
stackSize -= 4;
[15138] Fix | Delete
if (this.seacAnalysisEnabled) {
[15139] Fix | Delete
state.seac = stack.slice(stackSize, stackSize + 4);
[15140] Fix | Delete
return false;
[15141] Fix | Delete
}
[15142] Fix | Delete
}
[15143] Fix | Delete
validationCommand = CharstringValidationData[value];
[15144] Fix | Delete
} else if (value >= 32 && value <= 246) {
[15145] Fix | Delete
stack[stackSize] = value - 139;
[15146] Fix | Delete
stackSize++;
[15147] Fix | Delete
} else if (value >= 247 && value <= 254) {
[15148] Fix | Delete
stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
[15149] Fix | Delete
j++;
[15150] Fix | Delete
stackSize++;
[15151] Fix | Delete
} else if (value === 255) {
[15152] Fix | Delete
stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
[15153] Fix | Delete
j += 4;
[15154] Fix | Delete
stackSize++;
[15155] Fix | Delete
} else if (value === 19 || value === 20) {
[15156] Fix | Delete
state.hints += stackSize >> 1;
[15157] Fix | Delete
if (state.hints === 0) {
[15158] Fix | Delete
data.copyWithin(j - 1, j, -1);
[15159] Fix | Delete
j -= 1;
[15160] Fix | Delete
length -= 1;
[15161] Fix | Delete
continue;
[15162] Fix | Delete
}
[15163] Fix | Delete
j += state.hints + 7 >> 3;
[15164] Fix | Delete
stackSize %= 2;
[15165] Fix | Delete
validationCommand = CharstringValidationData[value];
[15166] Fix | Delete
} else if (value === 10 || value === 29) {
[15167] Fix | Delete
const subrsIndex = value === 10 ? localSubrIndex : globalSubrIndex;
[15168] Fix | Delete
if (!subrsIndex) {
[15169] Fix | Delete
validationCommand = CharstringValidationData[value];
[15170] Fix | Delete
warn("Missing subrsIndex for " + validationCommand.id);
[15171] Fix | Delete
return false;
[15172] Fix | Delete
}
[15173] Fix | Delete
let bias = 32768;
[15174] Fix | Delete
if (subrsIndex.count < 1240) {
[15175] Fix | Delete
bias = 107;
[15176] Fix | Delete
} else if (subrsIndex.count < 33900) {
[15177] Fix | Delete
bias = 1131;
[15178] Fix | Delete
}
[15179] Fix | Delete
const subrNumber = stack[--stackSize] + bias;
[15180] Fix | Delete
if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
[15181] Fix | Delete
validationCommand = CharstringValidationData[value];
[15182] Fix | Delete
warn("Out of bounds subrIndex for " + validationCommand.id);
[15183] Fix | Delete
return false;
[15184] Fix | Delete
}
[15185] Fix | Delete
state.stackSize = stackSize;
[15186] Fix | Delete
state.callDepth++;
[15187] Fix | Delete
const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
[15188] Fix | Delete
if (!valid) {
[15189] Fix | Delete
return false;
[15190] Fix | Delete
}
[15191] Fix | Delete
state.callDepth--;
[15192] Fix | Delete
stackSize = state.stackSize;
[15193] Fix | Delete
continue;
[15194] Fix | Delete
} else if (value === 11) {
[15195] Fix | Delete
state.stackSize = stackSize;
[15196] Fix | Delete
return true;
[15197] Fix | Delete
} else if (value === 0 && j === data.length) {
[15198] Fix | Delete
data[j - 1] = 14;
[15199] Fix | Delete
validationCommand = CharstringValidationData[14];
[15200] Fix | Delete
} else if (value === 9) {
[15201] Fix | Delete
data.copyWithin(j - 1, j, -1);
[15202] Fix | Delete
j -= 1;
[15203] Fix | Delete
length -= 1;
[15204] Fix | Delete
continue;
[15205] Fix | Delete
} else {
[15206] Fix | Delete
validationCommand = CharstringValidationData[value];
[15207] Fix | Delete
}
[15208] Fix | Delete
if (validationCommand) {
[15209] Fix | Delete
if (validationCommand.stem) {
[15210] Fix | Delete
state.hints += stackSize >> 1;
[15211] Fix | Delete
if (value === 3 || value === 23) {
[15212] Fix | Delete
state.hasVStems = true;
[15213] Fix | Delete
} else if (state.hasVStems && (value === 1 || value === 18)) {
[15214] Fix | Delete
warn("CFF stem hints are in wrong order");
[15215] Fix | Delete
data[j - 1] = value === 1 ? 3 : 23;
[15216] Fix | Delete
}
[15217] Fix | Delete
}
[15218] Fix | Delete
if ("min" in validationCommand) {
[15219] Fix | Delete
if (!state.undefStack && stackSize < validationCommand.min) {
[15220] Fix | Delete
warn("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
[15221] Fix | Delete
if (stackSize === 0) {
[15222] Fix | Delete
data[j - 1] = 14;
[15223] Fix | Delete
return true;
[15224] Fix | Delete
}
[15225] Fix | Delete
return false;
[15226] Fix | Delete
}
[15227] Fix | Delete
}
[15228] Fix | Delete
if (state.firstStackClearing && validationCommand.stackClearing) {
[15229] Fix | Delete
state.firstStackClearing = false;
[15230] Fix | Delete
stackSize -= validationCommand.min;
[15231] Fix | Delete
if (stackSize >= 2 && validationCommand.stem) {
[15232] Fix | Delete
stackSize %= 2;
[15233] Fix | Delete
} else if (stackSize > 1) {
[15234] Fix | Delete
warn("Found too many parameters for stack-clearing command");
[15235] Fix | Delete
}
[15236] Fix | Delete
if (stackSize > 0) {
[15237] Fix | Delete
state.width = stack[stackSize - 1];
[15238] Fix | Delete
}
[15239] Fix | Delete
}
[15240] Fix | Delete
if ("stackDelta" in validationCommand) {
[15241] Fix | Delete
if ("stackFn" in validationCommand) {
[15242] Fix | Delete
validationCommand.stackFn(stack, stackSize);
[15243] Fix | Delete
}
[15244] Fix | Delete
stackSize += validationCommand.stackDelta;
[15245] Fix | Delete
} else if (validationCommand.stackClearing) {
[15246] Fix | Delete
stackSize = 0;
[15247] Fix | Delete
} else if (validationCommand.resetStack) {
[15248] Fix | Delete
stackSize = 0;
[15249] Fix | Delete
state.undefStack = false;
[15250] Fix | Delete
} else if (validationCommand.undefStack) {
[15251] Fix | Delete
stackSize = 0;
[15252] Fix | Delete
state.undefStack = true;
[15253] Fix | Delete
state.firstStackClearing = false;
[15254] Fix | Delete
}
[15255] Fix | Delete
}
[15256] Fix | Delete
}
[15257] Fix | Delete
if (length < data.length) {
[15258] Fix | Delete
data.fill(14, length);
[15259] Fix | Delete
}
[15260] Fix | Delete
state.stackSize = stackSize;
[15261] Fix | Delete
return true;
[15262] Fix | Delete
}
[15263] Fix | Delete
parseCharStrings({
[15264] Fix | Delete
charStrings,
[15265] Fix | Delete
localSubrIndex,
[15266] Fix | Delete
globalSubrIndex,
[15267] Fix | Delete
fdSelect,
[15268] Fix | Delete
fdArray,
[15269] Fix | Delete
privateDict
[15270] Fix | Delete
}) {
[15271] Fix | Delete
const seacs = [];
[15272] Fix | Delete
const widths = [];
[15273] Fix | Delete
const count = charStrings.count;
[15274] Fix | Delete
for (let i = 0; i < count; i++) {
[15275] Fix | Delete
const charstring = charStrings.get(i);
[15276] Fix | Delete
const state = {
[15277] Fix | Delete
callDepth: 0,
[15278] Fix | Delete
stackSize: 0,
[15279] Fix | Delete
stack: [],
[15280] Fix | Delete
undefStack: true,
[15281] Fix | Delete
hints: 0,
[15282] Fix | Delete
firstStackClearing: true,
[15283] Fix | Delete
seac: null,
[15284] Fix | Delete
width: null,
[15285] Fix | Delete
hasVStems: false
[15286] Fix | Delete
};
[15287] Fix | Delete
let valid = true;
[15288] Fix | Delete
let localSubrToUse = null;
[15289] Fix | Delete
let privateDictToUse = privateDict;
[15290] Fix | Delete
if (fdSelect && fdArray.length) {
[15291] Fix | Delete
const fdIndex = fdSelect.getFDIndex(i);
[15292] Fix | Delete
if (fdIndex === -1) {
[15293] Fix | Delete
warn("Glyph index is not in fd select.");
[15294] Fix | Delete
valid = false;
[15295] Fix | Delete
}
[15296] Fix | Delete
if (fdIndex >= fdArray.length) {
[15297] Fix | Delete
warn("Invalid fd index for glyph index.");
[15298] Fix | Delete
valid = false;
[15299] Fix | Delete
}
[15300] Fix | Delete
if (valid) {
[15301] Fix | Delete
privateDictToUse = fdArray[fdIndex].privateDict;
[15302] Fix | Delete
localSubrToUse = privateDictToUse.subrsIndex;
[15303] Fix | Delete
}
[15304] Fix | Delete
} else if (localSubrIndex) {
[15305] Fix | Delete
localSubrToUse = localSubrIndex;
[15306] Fix | Delete
}
[15307] Fix | Delete
if (valid) {
[15308] Fix | Delete
valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
[15309] Fix | Delete
}
[15310] Fix | Delete
if (state.width !== null) {
[15311] Fix | Delete
const nominalWidth = privateDictToUse.getByName("nominalWidthX");
[15312] Fix | Delete
widths[i] = nominalWidth + state.width;
[15313] Fix | Delete
} else {
[15314] Fix | Delete
const defaultWidth = privateDictToUse.getByName("defaultWidthX");
[15315] Fix | Delete
widths[i] = defaultWidth;
[15316] Fix | Delete
}
[15317] Fix | Delete
if (state.seac !== null) {
[15318] Fix | Delete
seacs[i] = state.seac;
[15319] Fix | Delete
}
[15320] Fix | Delete
if (!valid) {
[15321] Fix | Delete
charStrings.set(i, new Uint8Array([14]));
[15322] Fix | Delete
}
[15323] Fix | Delete
}
[15324] Fix | Delete
return {
[15325] Fix | Delete
charStrings,
[15326] Fix | Delete
seacs,
[15327] Fix | Delete
widths
[15328] Fix | Delete
};
[15329] Fix | Delete
}
[15330] Fix | Delete
emptyPrivateDictionary(parentDict) {
[15331] Fix | Delete
const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
[15332] Fix | Delete
parentDict.setByKey(18, [0, 0]);
[15333] Fix | Delete
parentDict.privateDict = privateDict;
[15334] Fix | Delete
}
[15335] Fix | Delete
parsePrivateDict(parentDict) {
[15336] Fix | Delete
if (!parentDict.hasName("Private")) {
[15337] Fix | Delete
this.emptyPrivateDictionary(parentDict);
[15338] Fix | Delete
return;
[15339] Fix | Delete
}
[15340] Fix | Delete
const privateOffset = parentDict.getByName("Private");
[15341] Fix | Delete
if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
[15342] Fix | Delete
parentDict.removeByName("Private");
[15343] Fix | Delete
return;
[15344] Fix | Delete
}
[15345] Fix | Delete
const size = privateOffset[0];
[15346] Fix | Delete
const offset = privateOffset[1];
[15347] Fix | Delete
if (size === 0 || offset >= this.bytes.length) {
[15348] Fix | Delete
this.emptyPrivateDictionary(parentDict);
[15349] Fix | Delete
return;
[15350] Fix | Delete
}
[15351] Fix | Delete
const privateDictEnd = offset + size;
[15352] Fix | Delete
const dictData = this.bytes.subarray(offset, privateDictEnd);
[15353] Fix | Delete
const dict = this.parseDict(dictData);
[15354] Fix | Delete
const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
[15355] Fix | Delete
parentDict.privateDict = privateDict;
[15356] Fix | Delete
if (privateDict.getByName("ExpansionFactor") === 0) {
[15357] Fix | Delete
privateDict.setByName("ExpansionFactor", 0.06);
[15358] Fix | Delete
}
[15359] Fix | Delete
if (!privateDict.getByName("Subrs")) {
[15360] Fix | Delete
return;
[15361] Fix | Delete
}
[15362] Fix | Delete
const subrsOffset = privateDict.getByName("Subrs");
[15363] Fix | Delete
const relativeOffset = offset + subrsOffset;
[15364] Fix | Delete
if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
[15365] Fix | Delete
this.emptyPrivateDictionary(parentDict);
[15366] Fix | Delete
return;
[15367] Fix | Delete
}
[15368] Fix | Delete
const subrsIndex = this.parseIndex(relativeOffset);
[15369] Fix | Delete
privateDict.subrsIndex = subrsIndex.obj;
[15370] Fix | Delete
}
[15371] Fix | Delete
parseCharsets(pos, length, strings, cid) {
[15372] Fix | Delete
if (pos === 0) {
[15373] Fix | Delete
return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset);
[15374] Fix | Delete
} else if (pos === 1) {
[15375] Fix | Delete
return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset);
[15376] Fix | Delete
} else if (pos === 2) {
[15377] Fix | Delete
return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset);
[15378] Fix | Delete
}
[15379] Fix | Delete
const bytes = this.bytes;
[15380] Fix | Delete
const start = pos;
[15381] Fix | Delete
const format = bytes[pos++];
[15382] Fix | Delete
const charset = [cid ? 0 : ".notdef"];
[15383] Fix | Delete
let id, count, i;
[15384] Fix | Delete
length -= 1;
[15385] Fix | Delete
switch (format) {
[15386] Fix | Delete
case 0:
[15387] Fix | Delete
for (i = 0; i < length; i++) {
[15388] Fix | Delete
id = bytes[pos++] << 8 | bytes[pos++];
[15389] Fix | Delete
charset.push(cid ? id : strings.get(id));
[15390] Fix | Delete
}
[15391] Fix | Delete
break;
[15392] Fix | Delete
case 1:
[15393] Fix | Delete
while (charset.length <= length) {
[15394] Fix | Delete
id = bytes[pos++] << 8 | bytes[pos++];
[15395] Fix | Delete
count = bytes[pos++];
[15396] Fix | Delete
for (i = 0; i <= count; i++) {
[15397] Fix | Delete
charset.push(cid ? id++ : strings.get(id++));
[15398] Fix | Delete
}
[15399] Fix | Delete
}
[15400] Fix | Delete
break;
[15401] Fix | Delete
case 2:
[15402] Fix | Delete
while (charset.length <= length) {
[15403] Fix | Delete
id = bytes[pos++] << 8 | bytes[pos++];
[15404] Fix | Delete
count = bytes[pos++] << 8 | bytes[pos++];
[15405] Fix | Delete
for (i = 0; i <= count; i++) {
[15406] Fix | Delete
charset.push(cid ? id++ : strings.get(id++));
[15407] Fix | Delete
}
[15408] Fix | Delete
}
[15409] Fix | Delete
break;
[15410] Fix | Delete
default:
[15411] Fix | Delete
throw new FormatError("Unknown charset format");
[15412] Fix | Delete
}
[15413] Fix | Delete
const end = pos;
[15414] Fix | Delete
const raw = bytes.subarray(start, end);
[15415] Fix | Delete
return new CFFCharset(false, format, charset, raw);
[15416] Fix | Delete
}
[15417] Fix | Delete
parseEncoding(pos, properties, strings, charset) {
[15418] Fix | Delete
const encoding = Object.create(null);
[15419] Fix | Delete
const bytes = this.bytes;
[15420] Fix | Delete
let predefined = false;
[15421] Fix | Delete
let format, i, ii;
[15422] Fix | Delete
let raw = null;
[15423] Fix | Delete
function readSupplement() {
[15424] Fix | Delete
const supplementsCount = bytes[pos++];
[15425] Fix | Delete
for (i = 0; i < supplementsCount; i++) {
[15426] Fix | Delete
const code = bytes[pos++];
[15427] Fix | Delete
const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
[15428] Fix | Delete
encoding[code] = charset.indexOf(strings.get(sid));
[15429] Fix | Delete
}
[15430] Fix | Delete
}
[15431] Fix | Delete
if (pos === 0 || pos === 1) {
[15432] Fix | Delete
predefined = true;
[15433] Fix | Delete
format = pos;
[15434] Fix | Delete
const baseEncoding = pos ? ExpertEncoding : StandardEncoding;
[15435] Fix | Delete
for (i = 0, ii = charset.length; i < ii; i++) {
[15436] Fix | Delete
const index = baseEncoding.indexOf(charset[i]);
[15437] Fix | Delete
if (index !== -1) {
[15438] Fix | Delete
encoding[index] = i;
[15439] Fix | Delete
}
[15440] Fix | Delete
}
[15441] Fix | Delete
} else {
[15442] Fix | Delete
const dataStart = pos;
[15443] Fix | Delete
format = bytes[pos++];
[15444] Fix | Delete
switch (format & 0x7f) {
[15445] Fix | Delete
case 0:
[15446] Fix | Delete
const glyphsCount = bytes[pos++];
[15447] Fix | Delete
for (i = 1; i <= glyphsCount; i++) {
[15448] Fix | Delete
encoding[bytes[pos++]] = i;
[15449] Fix | Delete
}
[15450] Fix | Delete
break;
[15451] Fix | Delete
case 1:
[15452] Fix | Delete
const rangesCount = bytes[pos++];
[15453] Fix | Delete
let gid = 1;
[15454] Fix | Delete
for (i = 0; i < rangesCount; i++) {
[15455] Fix | Delete
const start = bytes[pos++];
[15456] Fix | Delete
const left = bytes[pos++];
[15457] Fix | Delete
for (let j = start; j <= start + left; j++) {
[15458] Fix | Delete
encoding[j] = gid++;
[15459] Fix | Delete
}
[15460] Fix | Delete
}
[15461] Fix | Delete
break;
[15462] Fix | Delete
default:
[15463] Fix | Delete
throw new FormatError(`Unknown encoding format: ${format} in CFF`);
[15464] Fix | Delete
}
[15465] Fix | Delete
const dataEnd = pos;
[15466] Fix | Delete
if (format & 0x80) {
[15467] Fix | Delete
bytes[dataStart] &= 0x7f;
[15468] Fix | Delete
readSupplement();
[15469] Fix | Delete
}
[15470] Fix | Delete
raw = bytes.subarray(dataStart, dataEnd);
[15471] Fix | Delete
}
[15472] Fix | Delete
format &= 0x7f;
[15473] Fix | Delete
return new CFFEncoding(predefined, format, encoding, raw);
[15474] Fix | Delete
}
[15475] Fix | Delete
parseFDSelect(pos, length) {
[15476] Fix | Delete
const bytes = this.bytes;
[15477] Fix | Delete
const format = bytes[pos++];
[15478] Fix | Delete
const fdSelect = [];
[15479] Fix | Delete
let i;
[15480] Fix | Delete
switch (format) {
[15481] Fix | Delete
case 0:
[15482] Fix | Delete
for (i = 0; i < length; ++i) {
[15483] Fix | Delete
const id = bytes[pos++];
[15484] Fix | Delete
fdSelect.push(id);
[15485] Fix | Delete
}
[15486] Fix | Delete
break;
[15487] Fix | Delete
case 3:
[15488] Fix | Delete
const rangesCount = bytes[pos++] << 8 | bytes[pos++];
[15489] Fix | Delete
for (i = 0; i < rangesCount; ++i) {
[15490] Fix | Delete
let first = bytes[pos++] << 8 | bytes[pos++];
[15491] Fix | Delete
if (i === 0 && first !== 0) {
[15492] Fix | Delete
warn("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
[15493] Fix | Delete
first = 0;
[15494] Fix | Delete
}
[15495] Fix | Delete
const fdIndex = bytes[pos++];
[15496] Fix | Delete
const next = bytes[pos] << 8 | bytes[pos + 1];
[15497] Fix | Delete
for (let j = first; j < next; ++j) {
[15498] Fix | Delete
fdSelect.push(fdIndex);
[15499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function