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
applyStandardFontGlyphMap(map, getSupplementalGlyphMapForCalibri());
[28000] Fix | Delete
}
[28001] Fix | Delete
if (cidToGidMap) {
[28002] Fix | Delete
for (const charCode in map) {
[28003] Fix | Delete
const cid = map[charCode];
[28004] Fix | Delete
if (cidToGidMap[cid] !== undefined) {
[28005] Fix | Delete
map[+charCode] = cidToGidMap[cid];
[28006] Fix | Delete
}
[28007] Fix | Delete
}
[28008] Fix | Delete
if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof IdentityToUnicodeMap) {
[28009] Fix | Delete
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
[28010] Fix | Delete
const cid = map[charCode];
[28011] Fix | Delete
if (cidToGidMap[cid] === undefined) {
[28012] Fix | Delete
map[+charCode] = unicodeCharCode;
[28013] Fix | Delete
}
[28014] Fix | Delete
});
[28015] Fix | Delete
}
[28016] Fix | Delete
}
[28017] Fix | Delete
if (!(this.toUnicode instanceof IdentityToUnicodeMap)) {
[28018] Fix | Delete
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
[28019] Fix | Delete
map[+charCode] = unicodeCharCode;
[28020] Fix | Delete
});
[28021] Fix | Delete
}
[28022] Fix | Delete
this.toFontChar = map;
[28023] Fix | Delete
this.toUnicode = new ToUnicodeMap(map);
[28024] Fix | Delete
} else if (/Symbol/i.test(fontName)) {
[28025] Fix | Delete
this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), this.differences);
[28026] Fix | Delete
} else if (/Dingbats/i.test(fontName)) {
[28027] Fix | Delete
this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), this.differences);
[28028] Fix | Delete
} else if (isStandardFont) {
[28029] Fix | Delete
const map = buildToFontChar(this.defaultEncoding, getGlyphsUnicode(), this.differences);
[28030] Fix | Delete
if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof IdentityToUnicodeMap)) {
[28031] Fix | Delete
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
[28032] Fix | Delete
map[+charCode] = unicodeCharCode;
[28033] Fix | Delete
});
[28034] Fix | Delete
}
[28035] Fix | Delete
this.toFontChar = map;
[28036] Fix | Delete
} else {
[28037] Fix | Delete
const glyphsUnicodeMap = getGlyphsUnicode();
[28038] Fix | Delete
const map = [];
[28039] Fix | Delete
this.toUnicode.forEach((charCode, unicodeCharCode) => {
[28040] Fix | Delete
if (!this.composite) {
[28041] Fix | Delete
const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
[28042] Fix | Delete
const unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
[28043] Fix | Delete
if (unicode !== -1) {
[28044] Fix | Delete
unicodeCharCode = unicode;
[28045] Fix | Delete
}
[28046] Fix | Delete
}
[28047] Fix | Delete
map[+charCode] = unicodeCharCode;
[28048] Fix | Delete
});
[28049] Fix | Delete
if (this.composite && this.toUnicode instanceof IdentityToUnicodeMap) {
[28050] Fix | Delete
if (/Tahoma|Verdana/i.test(name)) {
[28051] Fix | Delete
applyStandardFontGlyphMap(map, getGlyphMapForStandardFonts());
[28052] Fix | Delete
}
[28053] Fix | Delete
}
[28054] Fix | Delete
this.toFontChar = map;
[28055] Fix | Delete
}
[28056] Fix | Delete
amendFallbackToUnicode(properties);
[28057] Fix | Delete
this.loadedName = fontName.split("-", 1)[0];
[28058] Fix | Delete
}
[28059] Fix | Delete
checkAndRepair(name, font, properties) {
[28060] Fix | Delete
const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
[28061] Fix | Delete
function readTables(file, numTables) {
[28062] Fix | Delete
const tables = Object.create(null);
[28063] Fix | Delete
tables["OS/2"] = null;
[28064] Fix | Delete
tables.cmap = null;
[28065] Fix | Delete
tables.head = null;
[28066] Fix | Delete
tables.hhea = null;
[28067] Fix | Delete
tables.hmtx = null;
[28068] Fix | Delete
tables.maxp = null;
[28069] Fix | Delete
tables.name = null;
[28070] Fix | Delete
tables.post = null;
[28071] Fix | Delete
for (let i = 0; i < numTables; i++) {
[28072] Fix | Delete
const table = readTableEntry(file);
[28073] Fix | Delete
if (!VALID_TABLES.includes(table.tag)) {
[28074] Fix | Delete
continue;
[28075] Fix | Delete
}
[28076] Fix | Delete
if (table.length === 0) {
[28077] Fix | Delete
continue;
[28078] Fix | Delete
}
[28079] Fix | Delete
tables[table.tag] = table;
[28080] Fix | Delete
}
[28081] Fix | Delete
return tables;
[28082] Fix | Delete
}
[28083] Fix | Delete
function readTableEntry(file) {
[28084] Fix | Delete
const tag = file.getString(4);
[28085] Fix | Delete
const checksum = file.getInt32() >>> 0;
[28086] Fix | Delete
const offset = file.getInt32() >>> 0;
[28087] Fix | Delete
const length = file.getInt32() >>> 0;
[28088] Fix | Delete
const previousPosition = file.pos;
[28089] Fix | Delete
file.pos = file.start || 0;
[28090] Fix | Delete
file.skip(offset);
[28091] Fix | Delete
const data = file.getBytes(length);
[28092] Fix | Delete
file.pos = previousPosition;
[28093] Fix | Delete
if (tag === "head") {
[28094] Fix | Delete
data[8] = data[9] = data[10] = data[11] = 0;
[28095] Fix | Delete
data[17] |= 0x20;
[28096] Fix | Delete
}
[28097] Fix | Delete
return {
[28098] Fix | Delete
tag,
[28099] Fix | Delete
checksum,
[28100] Fix | Delete
length,
[28101] Fix | Delete
offset,
[28102] Fix | Delete
data
[28103] Fix | Delete
};
[28104] Fix | Delete
}
[28105] Fix | Delete
function readOpenTypeHeader(ttf) {
[28106] Fix | Delete
return {
[28107] Fix | Delete
version: ttf.getString(4),
[28108] Fix | Delete
numTables: ttf.getUint16(),
[28109] Fix | Delete
searchRange: ttf.getUint16(),
[28110] Fix | Delete
entrySelector: ttf.getUint16(),
[28111] Fix | Delete
rangeShift: ttf.getUint16()
[28112] Fix | Delete
};
[28113] Fix | Delete
}
[28114] Fix | Delete
function readTrueTypeCollectionHeader(ttc) {
[28115] Fix | Delete
const ttcTag = ttc.getString(4);
[28116] Fix | Delete
assert(ttcTag === "ttcf", "Must be a TrueType Collection font.");
[28117] Fix | Delete
const majorVersion = ttc.getUint16();
[28118] Fix | Delete
const minorVersion = ttc.getUint16();
[28119] Fix | Delete
const numFonts = ttc.getInt32() >>> 0;
[28120] Fix | Delete
const offsetTable = [];
[28121] Fix | Delete
for (let i = 0; i < numFonts; i++) {
[28122] Fix | Delete
offsetTable.push(ttc.getInt32() >>> 0);
[28123] Fix | Delete
}
[28124] Fix | Delete
const header = {
[28125] Fix | Delete
ttcTag,
[28126] Fix | Delete
majorVersion,
[28127] Fix | Delete
minorVersion,
[28128] Fix | Delete
numFonts,
[28129] Fix | Delete
offsetTable
[28130] Fix | Delete
};
[28131] Fix | Delete
switch (majorVersion) {
[28132] Fix | Delete
case 1:
[28133] Fix | Delete
return header;
[28134] Fix | Delete
case 2:
[28135] Fix | Delete
header.dsigTag = ttc.getInt32() >>> 0;
[28136] Fix | Delete
header.dsigLength = ttc.getInt32() >>> 0;
[28137] Fix | Delete
header.dsigOffset = ttc.getInt32() >>> 0;
[28138] Fix | Delete
return header;
[28139] Fix | Delete
}
[28140] Fix | Delete
throw new FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
[28141] Fix | Delete
}
[28142] Fix | Delete
function readTrueTypeCollectionData(ttc, fontName) {
[28143] Fix | Delete
const {
[28144] Fix | Delete
numFonts,
[28145] Fix | Delete
offsetTable
[28146] Fix | Delete
} = readTrueTypeCollectionHeader(ttc);
[28147] Fix | Delete
const fontNameParts = fontName.split("+");
[28148] Fix | Delete
let fallbackData;
[28149] Fix | Delete
for (let i = 0; i < numFonts; i++) {
[28150] Fix | Delete
ttc.pos = (ttc.start || 0) + offsetTable[i];
[28151] Fix | Delete
const potentialHeader = readOpenTypeHeader(ttc);
[28152] Fix | Delete
const potentialTables = readTables(ttc, potentialHeader.numTables);
[28153] Fix | Delete
if (!potentialTables.name) {
[28154] Fix | Delete
throw new FormatError('TrueType Collection font must contain a "name" table.');
[28155] Fix | Delete
}
[28156] Fix | Delete
const [nameTable] = readNameTable(potentialTables.name);
[28157] Fix | Delete
for (let j = 0, jj = nameTable.length; j < jj; j++) {
[28158] Fix | Delete
for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
[28159] Fix | Delete
const nameEntry = nameTable[j][k]?.replaceAll(/\s/g, "");
[28160] Fix | Delete
if (!nameEntry) {
[28161] Fix | Delete
continue;
[28162] Fix | Delete
}
[28163] Fix | Delete
if (nameEntry === fontName) {
[28164] Fix | Delete
return {
[28165] Fix | Delete
header: potentialHeader,
[28166] Fix | Delete
tables: potentialTables
[28167] Fix | Delete
};
[28168] Fix | Delete
}
[28169] Fix | Delete
if (fontNameParts.length < 2) {
[28170] Fix | Delete
continue;
[28171] Fix | Delete
}
[28172] Fix | Delete
for (const part of fontNameParts) {
[28173] Fix | Delete
if (nameEntry === part) {
[28174] Fix | Delete
fallbackData = {
[28175] Fix | Delete
name: part,
[28176] Fix | Delete
header: potentialHeader,
[28177] Fix | Delete
tables: potentialTables
[28178] Fix | Delete
};
[28179] Fix | Delete
}
[28180] Fix | Delete
}
[28181] Fix | Delete
}
[28182] Fix | Delete
}
[28183] Fix | Delete
}
[28184] Fix | Delete
if (fallbackData) {
[28185] Fix | Delete
warn(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
[28186] Fix | Delete
return {
[28187] Fix | Delete
header: fallbackData.header,
[28188] Fix | Delete
tables: fallbackData.tables
[28189] Fix | Delete
};
[28190] Fix | Delete
}
[28191] Fix | Delete
throw new FormatError(`TrueType Collection does not contain "${fontName}" font.`);
[28192] Fix | Delete
}
[28193] Fix | Delete
function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
[28194] Fix | Delete
if (!cmap) {
[28195] Fix | Delete
warn("No cmap table available.");
[28196] Fix | Delete
return {
[28197] Fix | Delete
platformId: -1,
[28198] Fix | Delete
encodingId: -1,
[28199] Fix | Delete
mappings: [],
[28200] Fix | Delete
hasShortCmap: false
[28201] Fix | Delete
};
[28202] Fix | Delete
}
[28203] Fix | Delete
let segment;
[28204] Fix | Delete
let start = (file.start || 0) + cmap.offset;
[28205] Fix | Delete
file.pos = start;
[28206] Fix | Delete
file.skip(2);
[28207] Fix | Delete
const numTables = file.getUint16();
[28208] Fix | Delete
let potentialTable;
[28209] Fix | Delete
let canBreak = false;
[28210] Fix | Delete
for (let i = 0; i < numTables; i++) {
[28211] Fix | Delete
const platformId = file.getUint16();
[28212] Fix | Delete
const encodingId = file.getUint16();
[28213] Fix | Delete
const offset = file.getInt32() >>> 0;
[28214] Fix | Delete
let useTable = false;
[28215] Fix | Delete
if (potentialTable?.platformId === platformId && potentialTable?.encodingId === encodingId) {
[28216] Fix | Delete
continue;
[28217] Fix | Delete
}
[28218] Fix | Delete
if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
[28219] Fix | Delete
useTable = true;
[28220] Fix | Delete
} else if (platformId === 1 && encodingId === 0) {
[28221] Fix | Delete
useTable = true;
[28222] Fix | Delete
} else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
[28223] Fix | Delete
useTable = true;
[28224] Fix | Delete
if (!isSymbolicFont) {
[28225] Fix | Delete
canBreak = true;
[28226] Fix | Delete
}
[28227] Fix | Delete
} else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
[28228] Fix | Delete
useTable = true;
[28229] Fix | Delete
let correctlySorted = true;
[28230] Fix | Delete
if (i < numTables - 1) {
[28231] Fix | Delete
const nextBytes = file.peekBytes(2),
[28232] Fix | Delete
nextPlatformId = int16(nextBytes[0], nextBytes[1]);
[28233] Fix | Delete
if (nextPlatformId < platformId) {
[28234] Fix | Delete
correctlySorted = false;
[28235] Fix | Delete
}
[28236] Fix | Delete
}
[28237] Fix | Delete
if (correctlySorted) {
[28238] Fix | Delete
canBreak = true;
[28239] Fix | Delete
}
[28240] Fix | Delete
}
[28241] Fix | Delete
if (useTable) {
[28242] Fix | Delete
potentialTable = {
[28243] Fix | Delete
platformId,
[28244] Fix | Delete
encodingId,
[28245] Fix | Delete
offset
[28246] Fix | Delete
};
[28247] Fix | Delete
}
[28248] Fix | Delete
if (canBreak) {
[28249] Fix | Delete
break;
[28250] Fix | Delete
}
[28251] Fix | Delete
}
[28252] Fix | Delete
if (potentialTable) {
[28253] Fix | Delete
file.pos = start + potentialTable.offset;
[28254] Fix | Delete
}
[28255] Fix | Delete
if (!potentialTable || file.peekByte() === -1) {
[28256] Fix | Delete
warn("Could not find a preferred cmap table.");
[28257] Fix | Delete
return {
[28258] Fix | Delete
platformId: -1,
[28259] Fix | Delete
encodingId: -1,
[28260] Fix | Delete
mappings: [],
[28261] Fix | Delete
hasShortCmap: false
[28262] Fix | Delete
};
[28263] Fix | Delete
}
[28264] Fix | Delete
const format = file.getUint16();
[28265] Fix | Delete
let hasShortCmap = false;
[28266] Fix | Delete
const mappings = [];
[28267] Fix | Delete
let j, glyphId;
[28268] Fix | Delete
if (format === 0) {
[28269] Fix | Delete
file.skip(2 + 2);
[28270] Fix | Delete
for (j = 0; j < 256; j++) {
[28271] Fix | Delete
const index = file.getByte();
[28272] Fix | Delete
if (!index) {
[28273] Fix | Delete
continue;
[28274] Fix | Delete
}
[28275] Fix | Delete
mappings.push({
[28276] Fix | Delete
charCode: j,
[28277] Fix | Delete
glyphId: index
[28278] Fix | Delete
});
[28279] Fix | Delete
}
[28280] Fix | Delete
hasShortCmap = true;
[28281] Fix | Delete
} else if (format === 2) {
[28282] Fix | Delete
file.skip(2 + 2);
[28283] Fix | Delete
const subHeaderKeys = [];
[28284] Fix | Delete
let maxSubHeaderKey = 0;
[28285] Fix | Delete
for (let i = 0; i < 256; i++) {
[28286] Fix | Delete
const subHeaderKey = file.getUint16() >> 3;
[28287] Fix | Delete
subHeaderKeys.push(subHeaderKey);
[28288] Fix | Delete
maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
[28289] Fix | Delete
}
[28290] Fix | Delete
const subHeaders = [];
[28291] Fix | Delete
for (let i = 0; i <= maxSubHeaderKey; i++) {
[28292] Fix | Delete
subHeaders.push({
[28293] Fix | Delete
firstCode: file.getUint16(),
[28294] Fix | Delete
entryCount: file.getUint16(),
[28295] Fix | Delete
idDelta: signedInt16(file.getByte(), file.getByte()),
[28296] Fix | Delete
idRangePos: file.pos + file.getUint16()
[28297] Fix | Delete
});
[28298] Fix | Delete
}
[28299] Fix | Delete
for (let i = 0; i < 256; i++) {
[28300] Fix | Delete
if (subHeaderKeys[i] === 0) {
[28301] Fix | Delete
file.pos = subHeaders[0].idRangePos + 2 * i;
[28302] Fix | Delete
glyphId = file.getUint16();
[28303] Fix | Delete
mappings.push({
[28304] Fix | Delete
charCode: i,
[28305] Fix | Delete
glyphId
[28306] Fix | Delete
});
[28307] Fix | Delete
} else {
[28308] Fix | Delete
const s = subHeaders[subHeaderKeys[i]];
[28309] Fix | Delete
for (j = 0; j < s.entryCount; j++) {
[28310] Fix | Delete
const charCode = (i << 8) + j + s.firstCode;
[28311] Fix | Delete
file.pos = s.idRangePos + 2 * j;
[28312] Fix | Delete
glyphId = file.getUint16();
[28313] Fix | Delete
if (glyphId !== 0) {
[28314] Fix | Delete
glyphId = (glyphId + s.idDelta) % 65536;
[28315] Fix | Delete
}
[28316] Fix | Delete
mappings.push({
[28317] Fix | Delete
charCode,
[28318] Fix | Delete
glyphId
[28319] Fix | Delete
});
[28320] Fix | Delete
}
[28321] Fix | Delete
}
[28322] Fix | Delete
}
[28323] Fix | Delete
} else if (format === 4) {
[28324] Fix | Delete
file.skip(2 + 2);
[28325] Fix | Delete
const segCount = file.getUint16() >> 1;
[28326] Fix | Delete
file.skip(6);
[28327] Fix | Delete
const segments = [];
[28328] Fix | Delete
let segIndex;
[28329] Fix | Delete
for (segIndex = 0; segIndex < segCount; segIndex++) {
[28330] Fix | Delete
segments.push({
[28331] Fix | Delete
end: file.getUint16()
[28332] Fix | Delete
});
[28333] Fix | Delete
}
[28334] Fix | Delete
file.skip(2);
[28335] Fix | Delete
for (segIndex = 0; segIndex < segCount; segIndex++) {
[28336] Fix | Delete
segments[segIndex].start = file.getUint16();
[28337] Fix | Delete
}
[28338] Fix | Delete
for (segIndex = 0; segIndex < segCount; segIndex++) {
[28339] Fix | Delete
segments[segIndex].delta = file.getUint16();
[28340] Fix | Delete
}
[28341] Fix | Delete
let offsetsCount = 0,
[28342] Fix | Delete
offsetIndex;
[28343] Fix | Delete
for (segIndex = 0; segIndex < segCount; segIndex++) {
[28344] Fix | Delete
segment = segments[segIndex];
[28345] Fix | Delete
const rangeOffset = file.getUint16();
[28346] Fix | Delete
if (!rangeOffset) {
[28347] Fix | Delete
segment.offsetIndex = -1;
[28348] Fix | Delete
continue;
[28349] Fix | Delete
}
[28350] Fix | Delete
offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
[28351] Fix | Delete
segment.offsetIndex = offsetIndex;
[28352] Fix | Delete
offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
[28353] Fix | Delete
}
[28354] Fix | Delete
const offsets = [];
[28355] Fix | Delete
for (j = 0; j < offsetsCount; j++) {
[28356] Fix | Delete
offsets.push(file.getUint16());
[28357] Fix | Delete
}
[28358] Fix | Delete
for (segIndex = 0; segIndex < segCount; segIndex++) {
[28359] Fix | Delete
segment = segments[segIndex];
[28360] Fix | Delete
start = segment.start;
[28361] Fix | Delete
const end = segment.end;
[28362] Fix | Delete
const delta = segment.delta;
[28363] Fix | Delete
offsetIndex = segment.offsetIndex;
[28364] Fix | Delete
for (j = start; j <= end; j++) {
[28365] Fix | Delete
if (j === 0xffff) {
[28366] Fix | Delete
continue;
[28367] Fix | Delete
}
[28368] Fix | Delete
glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
[28369] Fix | Delete
glyphId = glyphId + delta & 0xffff;
[28370] Fix | Delete
mappings.push({
[28371] Fix | Delete
charCode: j,
[28372] Fix | Delete
glyphId
[28373] Fix | Delete
});
[28374] Fix | Delete
}
[28375] Fix | Delete
}
[28376] Fix | Delete
} else if (format === 6) {
[28377] Fix | Delete
file.skip(2 + 2);
[28378] Fix | Delete
const firstCode = file.getUint16();
[28379] Fix | Delete
const entryCount = file.getUint16();
[28380] Fix | Delete
for (j = 0; j < entryCount; j++) {
[28381] Fix | Delete
glyphId = file.getUint16();
[28382] Fix | Delete
const charCode = firstCode + j;
[28383] Fix | Delete
mappings.push({
[28384] Fix | Delete
charCode,
[28385] Fix | Delete
glyphId
[28386] Fix | Delete
});
[28387] Fix | Delete
}
[28388] Fix | Delete
} else if (format === 12) {
[28389] Fix | Delete
file.skip(2 + 4 + 4);
[28390] Fix | Delete
const nGroups = file.getInt32() >>> 0;
[28391] Fix | Delete
for (j = 0; j < nGroups; j++) {
[28392] Fix | Delete
const startCharCode = file.getInt32() >>> 0;
[28393] Fix | Delete
const endCharCode = file.getInt32() >>> 0;
[28394] Fix | Delete
let glyphCode = file.getInt32() >>> 0;
[28395] Fix | Delete
for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
[28396] Fix | Delete
mappings.push({
[28397] Fix | Delete
charCode,
[28398] Fix | Delete
glyphId: glyphCode++
[28399] Fix | Delete
});
[28400] Fix | Delete
}
[28401] Fix | Delete
}
[28402] Fix | Delete
} else {
[28403] Fix | Delete
warn("cmap table has unsupported format: " + format);
[28404] Fix | Delete
return {
[28405] Fix | Delete
platformId: -1,
[28406] Fix | Delete
encodingId: -1,
[28407] Fix | Delete
mappings: [],
[28408] Fix | Delete
hasShortCmap: false
[28409] Fix | Delete
};
[28410] Fix | Delete
}
[28411] Fix | Delete
mappings.sort(function (a, b) {
[28412] Fix | Delete
return a.charCode - b.charCode;
[28413] Fix | Delete
});
[28414] Fix | Delete
for (let i = 1; i < mappings.length; i++) {
[28415] Fix | Delete
if (mappings[i - 1].charCode === mappings[i].charCode) {
[28416] Fix | Delete
mappings.splice(i, 1);
[28417] Fix | Delete
i--;
[28418] Fix | Delete
}
[28419] Fix | Delete
}
[28420] Fix | Delete
return {
[28421] Fix | Delete
platformId: potentialTable.platformId,
[28422] Fix | Delete
encodingId: potentialTable.encodingId,
[28423] Fix | Delete
mappings,
[28424] Fix | Delete
hasShortCmap
[28425] Fix | Delete
};
[28426] Fix | Delete
}
[28427] Fix | Delete
function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
[28428] Fix | Delete
if (!header) {
[28429] Fix | Delete
if (metrics) {
[28430] Fix | Delete
metrics.data = null;
[28431] Fix | Delete
}
[28432] Fix | Delete
return;
[28433] Fix | Delete
}
[28434] Fix | Delete
file.pos = (file.start || 0) + header.offset;
[28435] Fix | Delete
file.pos += 4;
[28436] Fix | Delete
file.pos += 2;
[28437] Fix | Delete
file.pos += 2;
[28438] Fix | Delete
file.pos += 2;
[28439] Fix | Delete
file.pos += 2;
[28440] Fix | Delete
file.pos += 2;
[28441] Fix | Delete
file.pos += 2;
[28442] Fix | Delete
file.pos += 2;
[28443] Fix | Delete
file.pos += 2;
[28444] Fix | Delete
file.pos += 2;
[28445] Fix | Delete
const caretOffset = file.getUint16();
[28446] Fix | Delete
file.pos += 8;
[28447] Fix | Delete
file.pos += 2;
[28448] Fix | Delete
let numOfMetrics = file.getUint16();
[28449] Fix | Delete
if (caretOffset !== 0) {
[28450] Fix | Delete
const macStyle = int16(headTable.data[44], headTable.data[45]);
[28451] Fix | Delete
if (!(macStyle & 2)) {
[28452] Fix | Delete
header.data[22] = 0;
[28453] Fix | Delete
header.data[23] = 0;
[28454] Fix | Delete
}
[28455] Fix | Delete
}
[28456] Fix | Delete
if (numOfMetrics > numGlyphs) {
[28457] Fix | Delete
info(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
[28458] Fix | Delete
numOfMetrics = numGlyphs;
[28459] Fix | Delete
header.data[34] = (numOfMetrics & 0xff00) >> 8;
[28460] Fix | Delete
header.data[35] = numOfMetrics & 0x00ff;
[28461] Fix | Delete
}
[28462] Fix | Delete
const numOfSidebearings = numGlyphs - numOfMetrics;
[28463] Fix | Delete
const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
[28464] Fix | Delete
if (numMissing > 0) {
[28465] Fix | Delete
const entries = new Uint8Array(metrics.length + numMissing * 2);
[28466] Fix | Delete
entries.set(metrics.data);
[28467] Fix | Delete
if (dupFirstEntry) {
[28468] Fix | Delete
entries[metrics.length] = metrics.data[2];
[28469] Fix | Delete
entries[metrics.length + 1] = metrics.data[3];
[28470] Fix | Delete
}
[28471] Fix | Delete
metrics.data = entries;
[28472] Fix | Delete
}
[28473] Fix | Delete
}
[28474] Fix | Delete
function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
[28475] Fix | Delete
const glyphProfile = {
[28476] Fix | Delete
length: 0,
[28477] Fix | Delete
sizeOfInstructions: 0
[28478] Fix | Delete
};
[28479] Fix | Delete
if (sourceStart < 0 || sourceStart >= source.length || sourceEnd > source.length || sourceEnd - sourceStart <= 12) {
[28480] Fix | Delete
return glyphProfile;
[28481] Fix | Delete
}
[28482] Fix | Delete
const glyf = source.subarray(sourceStart, sourceEnd);
[28483] Fix | Delete
const xMin = signedInt16(glyf[2], glyf[3]);
[28484] Fix | Delete
const yMin = signedInt16(glyf[4], glyf[5]);
[28485] Fix | Delete
const xMax = signedInt16(glyf[6], glyf[7]);
[28486] Fix | Delete
const yMax = signedInt16(glyf[8], glyf[9]);
[28487] Fix | Delete
if (xMin > xMax) {
[28488] Fix | Delete
writeSignedInt16(glyf, 2, xMax);
[28489] Fix | Delete
writeSignedInt16(glyf, 6, xMin);
[28490] Fix | Delete
}
[28491] Fix | Delete
if (yMin > yMax) {
[28492] Fix | Delete
writeSignedInt16(glyf, 4, yMax);
[28493] Fix | Delete
writeSignedInt16(glyf, 8, yMin);
[28494] Fix | Delete
}
[28495] Fix | Delete
const contoursCount = signedInt16(glyf[0], glyf[1]);
[28496] Fix | Delete
if (contoursCount < 0) {
[28497] Fix | Delete
if (contoursCount < -1) {
[28498] Fix | Delete
return glyphProfile;
[28499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function