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
toFontChar[+charCode] = unicode;
[27500] Fix | Delete
}
[27501] Fix | Delete
}
[27502] Fix | Delete
return toFontChar;
[27503] Fix | Delete
}
[27504] Fix | Delete
function isMacNameRecord(r) {
[27505] Fix | Delete
return r.platform === 1 && r.encoding === 0 && r.language === 0;
[27506] Fix | Delete
}
[27507] Fix | Delete
function isWinNameRecord(r) {
[27508] Fix | Delete
return r.platform === 3 && r.encoding === 1 && r.language === 0x409;
[27509] Fix | Delete
}
[27510] Fix | Delete
function convertCidString(charCode, cid, shouldThrow = false) {
[27511] Fix | Delete
switch (cid.length) {
[27512] Fix | Delete
case 1:
[27513] Fix | Delete
return cid.charCodeAt(0);
[27514] Fix | Delete
case 2:
[27515] Fix | Delete
return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
[27516] Fix | Delete
}
[27517] Fix | Delete
const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
[27518] Fix | Delete
if (shouldThrow) {
[27519] Fix | Delete
throw new FormatError(msg);
[27520] Fix | Delete
}
[27521] Fix | Delete
warn(msg);
[27522] Fix | Delete
return cid;
[27523] Fix | Delete
}
[27524] Fix | Delete
function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
[27525] Fix | Delete
const newMap = Object.create(null);
[27526] Fix | Delete
const toUnicodeExtraMap = new Map();
[27527] Fix | Delete
const toFontChar = [];
[27528] Fix | Delete
const usedGlyphIds = new Set();
[27529] Fix | Delete
let privateUseAreaIndex = 0;
[27530] Fix | Delete
const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
[27531] Fix | Delete
let nextAvailableFontCharCode = privateUseOffetStart;
[27532] Fix | Delete
let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
[27533] Fix | Delete
const isInPrivateArea = code => PRIVATE_USE_AREAS[0][0] <= code && code <= PRIVATE_USE_AREAS[0][1] || PRIVATE_USE_AREAS[1][0] <= code && code <= PRIVATE_USE_AREAS[1][1];
[27534] Fix | Delete
for (const originalCharCode in charCodeToGlyphId) {
[27535] Fix | Delete
let glyphId = charCodeToGlyphId[originalCharCode];
[27536] Fix | Delete
if (!hasGlyph(glyphId)) {
[27537] Fix | Delete
continue;
[27538] Fix | Delete
}
[27539] Fix | Delete
if (nextAvailableFontCharCode > privateUseOffetEnd) {
[27540] Fix | Delete
privateUseAreaIndex++;
[27541] Fix | Delete
if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
[27542] Fix | Delete
warn("Ran out of space in font private use area.");
[27543] Fix | Delete
break;
[27544] Fix | Delete
}
[27545] Fix | Delete
nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
[27546] Fix | Delete
privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
[27547] Fix | Delete
}
[27548] Fix | Delete
const fontCharCode = nextAvailableFontCharCode++;
[27549] Fix | Delete
if (glyphId === 0) {
[27550] Fix | Delete
glyphId = newGlyphZeroId;
[27551] Fix | Delete
}
[27552] Fix | Delete
let unicode = toUnicode.get(originalCharCode);
[27553] Fix | Delete
if (typeof unicode === "string") {
[27554] Fix | Delete
unicode = unicode.codePointAt(0);
[27555] Fix | Delete
}
[27556] Fix | Delete
if (unicode && !isInPrivateArea(unicode) && !usedGlyphIds.has(glyphId)) {
[27557] Fix | Delete
toUnicodeExtraMap.set(unicode, glyphId);
[27558] Fix | Delete
usedGlyphIds.add(glyphId);
[27559] Fix | Delete
}
[27560] Fix | Delete
newMap[fontCharCode] = glyphId;
[27561] Fix | Delete
toFontChar[originalCharCode] = fontCharCode;
[27562] Fix | Delete
}
[27563] Fix | Delete
return {
[27564] Fix | Delete
toFontChar,
[27565] Fix | Delete
charCodeToGlyphId: newMap,
[27566] Fix | Delete
toUnicodeExtraMap,
[27567] Fix | Delete
nextAvailableFontCharCode
[27568] Fix | Delete
};
[27569] Fix | Delete
}
[27570] Fix | Delete
function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
[27571] Fix | Delete
const codes = [];
[27572] Fix | Delete
for (const charCode in glyphs) {
[27573] Fix | Delete
if (glyphs[charCode] >= numGlyphs) {
[27574] Fix | Delete
continue;
[27575] Fix | Delete
}
[27576] Fix | Delete
codes.push({
[27577] Fix | Delete
fontCharCode: charCode | 0,
[27578] Fix | Delete
glyphId: glyphs[charCode]
[27579] Fix | Delete
});
[27580] Fix | Delete
}
[27581] Fix | Delete
if (toUnicodeExtraMap) {
[27582] Fix | Delete
for (const [unicode, glyphId] of toUnicodeExtraMap) {
[27583] Fix | Delete
if (glyphId >= numGlyphs) {
[27584] Fix | Delete
continue;
[27585] Fix | Delete
}
[27586] Fix | Delete
codes.push({
[27587] Fix | Delete
fontCharCode: unicode,
[27588] Fix | Delete
glyphId
[27589] Fix | Delete
});
[27590] Fix | Delete
}
[27591] Fix | Delete
}
[27592] Fix | Delete
if (codes.length === 0) {
[27593] Fix | Delete
codes.push({
[27594] Fix | Delete
fontCharCode: 0,
[27595] Fix | Delete
glyphId: 0
[27596] Fix | Delete
});
[27597] Fix | Delete
}
[27598] Fix | Delete
codes.sort(function fontGetRangesSort(a, b) {
[27599] Fix | Delete
return a.fontCharCode - b.fontCharCode;
[27600] Fix | Delete
});
[27601] Fix | Delete
const ranges = [];
[27602] Fix | Delete
const length = codes.length;
[27603] Fix | Delete
for (let n = 0; n < length;) {
[27604] Fix | Delete
const start = codes[n].fontCharCode;
[27605] Fix | Delete
const codeIndices = [codes[n].glyphId];
[27606] Fix | Delete
++n;
[27607] Fix | Delete
let end = start;
[27608] Fix | Delete
while (n < length && end + 1 === codes[n].fontCharCode) {
[27609] Fix | Delete
codeIndices.push(codes[n].glyphId);
[27610] Fix | Delete
++end;
[27611] Fix | Delete
++n;
[27612] Fix | Delete
if (end === 0xffff) {
[27613] Fix | Delete
break;
[27614] Fix | Delete
}
[27615] Fix | Delete
}
[27616] Fix | Delete
ranges.push([start, end, codeIndices]);
[27617] Fix | Delete
}
[27618] Fix | Delete
return ranges;
[27619] Fix | Delete
}
[27620] Fix | Delete
function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
[27621] Fix | Delete
const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
[27622] Fix | Delete
const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
[27623] Fix | Delete
let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + string32(4 + numTables * 8);
[27624] Fix | Delete
let i, ii, j, jj;
[27625] Fix | Delete
for (i = ranges.length - 1; i >= 0; --i) {
[27626] Fix | Delete
if (ranges[i][0] <= 0xffff) {
[27627] Fix | Delete
break;
[27628] Fix | Delete
}
[27629] Fix | Delete
}
[27630] Fix | Delete
const bmpLength = i + 1;
[27631] Fix | Delete
if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
[27632] Fix | Delete
ranges[i][1] = 0xfffe;
[27633] Fix | Delete
}
[27634] Fix | Delete
const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
[27635] Fix | Delete
const segCount = bmpLength + trailingRangesCount;
[27636] Fix | Delete
const searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
[27637] Fix | Delete
let startCount = "";
[27638] Fix | Delete
let endCount = "";
[27639] Fix | Delete
let idDeltas = "";
[27640] Fix | Delete
let idRangeOffsets = "";
[27641] Fix | Delete
let glyphsIds = "";
[27642] Fix | Delete
let bias = 0;
[27643] Fix | Delete
let range, start, end, codes;
[27644] Fix | Delete
for (i = 0, ii = bmpLength; i < ii; i++) {
[27645] Fix | Delete
range = ranges[i];
[27646] Fix | Delete
start = range[0];
[27647] Fix | Delete
end = range[1];
[27648] Fix | Delete
startCount += string16(start);
[27649] Fix | Delete
endCount += string16(end);
[27650] Fix | Delete
codes = range[2];
[27651] Fix | Delete
let contiguous = true;
[27652] Fix | Delete
for (j = 1, jj = codes.length; j < jj; ++j) {
[27653] Fix | Delete
if (codes[j] !== codes[j - 1] + 1) {
[27654] Fix | Delete
contiguous = false;
[27655] Fix | Delete
break;
[27656] Fix | Delete
}
[27657] Fix | Delete
}
[27658] Fix | Delete
if (!contiguous) {
[27659] Fix | Delete
const offset = (segCount - i) * 2 + bias * 2;
[27660] Fix | Delete
bias += end - start + 1;
[27661] Fix | Delete
idDeltas += string16(0);
[27662] Fix | Delete
idRangeOffsets += string16(offset);
[27663] Fix | Delete
for (j = 0, jj = codes.length; j < jj; ++j) {
[27664] Fix | Delete
glyphsIds += string16(codes[j]);
[27665] Fix | Delete
}
[27666] Fix | Delete
} else {
[27667] Fix | Delete
const startCode = codes[0];
[27668] Fix | Delete
idDeltas += string16(startCode - start & 0xffff);
[27669] Fix | Delete
idRangeOffsets += string16(0);
[27670] Fix | Delete
}
[27671] Fix | Delete
}
[27672] Fix | Delete
if (trailingRangesCount > 0) {
[27673] Fix | Delete
endCount += "\xFF\xFF";
[27674] Fix | Delete
startCount += "\xFF\xFF";
[27675] Fix | Delete
idDeltas += "\x00\x01";
[27676] Fix | Delete
idRangeOffsets += "\x00\x00";
[27677] Fix | Delete
}
[27678] Fix | Delete
const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
[27679] Fix | Delete
let format31012 = "";
[27680] Fix | Delete
let header31012 = "";
[27681] Fix | Delete
if (numTables > 1) {
[27682] Fix | Delete
cmap += "\x00\x03" + "\x00\x0A" + string32(4 + numTables * 8 + 4 + format314.length);
[27683] Fix | Delete
format31012 = "";
[27684] Fix | Delete
for (i = 0, ii = ranges.length; i < ii; i++) {
[27685] Fix | Delete
range = ranges[i];
[27686] Fix | Delete
start = range[0];
[27687] Fix | Delete
codes = range[2];
[27688] Fix | Delete
let code = codes[0];
[27689] Fix | Delete
for (j = 1, jj = codes.length; j < jj; ++j) {
[27690] Fix | Delete
if (codes[j] !== codes[j - 1] + 1) {
[27691] Fix | Delete
end = range[0] + j - 1;
[27692] Fix | Delete
format31012 += string32(start) + string32(end) + string32(code);
[27693] Fix | Delete
start = end + 1;
[27694] Fix | Delete
code = codes[j];
[27695] Fix | Delete
}
[27696] Fix | Delete
}
[27697] Fix | Delete
format31012 += string32(start) + string32(range[1]) + string32(code);
[27698] Fix | Delete
}
[27699] Fix | Delete
header31012 = "\x00\x0C" + "\x00\x00" + string32(format31012.length + 16) + "\x00\x00\x00\x00" + string32(format31012.length / 12);
[27700] Fix | Delete
}
[27701] Fix | Delete
return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
[27702] Fix | Delete
}
[27703] Fix | Delete
function validateOS2Table(os2, file) {
[27704] Fix | Delete
file.pos = (file.start || 0) + os2.offset;
[27705] Fix | Delete
const version = file.getUint16();
[27706] Fix | Delete
file.skip(60);
[27707] Fix | Delete
const selection = file.getUint16();
[27708] Fix | Delete
if (version < 4 && selection & 0x0300) {
[27709] Fix | Delete
return false;
[27710] Fix | Delete
}
[27711] Fix | Delete
const firstChar = file.getUint16();
[27712] Fix | Delete
const lastChar = file.getUint16();
[27713] Fix | Delete
if (firstChar > lastChar) {
[27714] Fix | Delete
return false;
[27715] Fix | Delete
}
[27716] Fix | Delete
file.skip(6);
[27717] Fix | Delete
const usWinAscent = file.getUint16();
[27718] Fix | Delete
if (usWinAscent === 0) {
[27719] Fix | Delete
return false;
[27720] Fix | Delete
}
[27721] Fix | Delete
os2.data[8] = os2.data[9] = 0;
[27722] Fix | Delete
return true;
[27723] Fix | Delete
}
[27724] Fix | Delete
function createOS2Table(properties, charstrings, override) {
[27725] Fix | Delete
override ||= {
[27726] Fix | Delete
unitsPerEm: 0,
[27727] Fix | Delete
yMax: 0,
[27728] Fix | Delete
yMin: 0,
[27729] Fix | Delete
ascent: 0,
[27730] Fix | Delete
descent: 0
[27731] Fix | Delete
};
[27732] Fix | Delete
let ulUnicodeRange1 = 0;
[27733] Fix | Delete
let ulUnicodeRange2 = 0;
[27734] Fix | Delete
let ulUnicodeRange3 = 0;
[27735] Fix | Delete
let ulUnicodeRange4 = 0;
[27736] Fix | Delete
let firstCharIndex = null;
[27737] Fix | Delete
let lastCharIndex = 0;
[27738] Fix | Delete
let position = -1;
[27739] Fix | Delete
if (charstrings) {
[27740] Fix | Delete
for (let code in charstrings) {
[27741] Fix | Delete
code |= 0;
[27742] Fix | Delete
if (firstCharIndex > code || !firstCharIndex) {
[27743] Fix | Delete
firstCharIndex = code;
[27744] Fix | Delete
}
[27745] Fix | Delete
if (lastCharIndex < code) {
[27746] Fix | Delete
lastCharIndex = code;
[27747] Fix | Delete
}
[27748] Fix | Delete
position = getUnicodeRangeFor(code, position);
[27749] Fix | Delete
if (position < 32) {
[27750] Fix | Delete
ulUnicodeRange1 |= 1 << position;
[27751] Fix | Delete
} else if (position < 64) {
[27752] Fix | Delete
ulUnicodeRange2 |= 1 << position - 32;
[27753] Fix | Delete
} else if (position < 96) {
[27754] Fix | Delete
ulUnicodeRange3 |= 1 << position - 64;
[27755] Fix | Delete
} else if (position < 123) {
[27756] Fix | Delete
ulUnicodeRange4 |= 1 << position - 96;
[27757] Fix | Delete
} else {
[27758] Fix | Delete
throw new FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
[27759] Fix | Delete
}
[27760] Fix | Delete
}
[27761] Fix | Delete
if (lastCharIndex > 0xffff) {
[27762] Fix | Delete
lastCharIndex = 0xffff;
[27763] Fix | Delete
}
[27764] Fix | Delete
} else {
[27765] Fix | Delete
firstCharIndex = 0;
[27766] Fix | Delete
lastCharIndex = 255;
[27767] Fix | Delete
}
[27768] Fix | Delete
const bbox = properties.bbox || [0, 0, 0, 0];
[27769] Fix | Delete
const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
[27770] Fix | Delete
const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
[27771] Fix | Delete
const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
[27772] Fix | Delete
let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
[27773] Fix | Delete
if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
[27774] Fix | Delete
typoDescent = -typoDescent;
[27775] Fix | Delete
}
[27776] Fix | Delete
const winAscent = override.yMax || typoAscent;
[27777] Fix | Delete
const winDescent = -override.yMin || -typoDescent;
[27778] Fix | Delete
return "\x00\x03" + "\x02\x24" + "\x01\xF4" + "\x00\x05" + "\x00\x00" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x00\x8C" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x01\xDF" + "\x00\x31" + "\x01\x02" + "\x00\x00" + "\x00\x00\x06" + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + "\x00\x00\x00\x00\x00\x00" + string32(ulUnicodeRange1) + string32(ulUnicodeRange2) + string32(ulUnicodeRange3) + string32(ulUnicodeRange4) + "\x2A\x32\x31\x2A" + string16(properties.italicAngle ? 1 : 0) + string16(firstCharIndex || properties.firstChar) + string16(lastCharIndex || properties.lastChar) + string16(typoAscent) + string16(typoDescent) + "\x00\x64" + string16(winAscent) + string16(winDescent) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + string16(properties.xHeight) + string16(properties.capHeight) + string16(0) + string16(firstCharIndex || properties.firstChar) + "\x00\x03";
[27779] Fix | Delete
}
[27780] Fix | Delete
function createPostTable(properties) {
[27781] Fix | Delete
const angle = Math.floor(properties.italicAngle * 2 ** 16);
[27782] Fix | Delete
return "\x00\x03\x00\x00" + string32(angle) + "\x00\x00" + "\x00\x00" + string32(properties.fixedPitch ? 1 : 0) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00";
[27783] Fix | Delete
}
[27784] Fix | Delete
function createPostscriptName(name) {
[27785] Fix | Delete
return name.replaceAll(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
[27786] Fix | Delete
}
[27787] Fix | Delete
function createNameTable(name, proto) {
[27788] Fix | Delete
if (!proto) {
[27789] Fix | Delete
proto = [[], []];
[27790] Fix | Delete
}
[27791] Fix | Delete
const strings = [proto[0][0] || "Original licence", proto[0][1] || name, proto[0][2] || "Unknown", proto[0][3] || "uniqueID", proto[0][4] || name, proto[0][5] || "Version 0.11", proto[0][6] || createPostscriptName(name), proto[0][7] || "Unknown", proto[0][8] || "Unknown", proto[0][9] || "Unknown"];
[27792] Fix | Delete
const stringsUnicode = [];
[27793] Fix | Delete
let i, ii, j, jj, str;
[27794] Fix | Delete
for (i = 0, ii = strings.length; i < ii; i++) {
[27795] Fix | Delete
str = proto[1][i] || strings[i];
[27796] Fix | Delete
const strBufUnicode = [];
[27797] Fix | Delete
for (j = 0, jj = str.length; j < jj; j++) {
[27798] Fix | Delete
strBufUnicode.push(string16(str.charCodeAt(j)));
[27799] Fix | Delete
}
[27800] Fix | Delete
stringsUnicode.push(strBufUnicode.join(""));
[27801] Fix | Delete
}
[27802] Fix | Delete
const names = [strings, stringsUnicode];
[27803] Fix | Delete
const platforms = ["\x00\x01", "\x00\x03"];
[27804] Fix | Delete
const encodings = ["\x00\x00", "\x00\x01"];
[27805] Fix | Delete
const languages = ["\x00\x00", "\x04\x09"];
[27806] Fix | Delete
const namesRecordCount = strings.length * platforms.length;
[27807] Fix | Delete
let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
[27808] Fix | Delete
let strOffset = 0;
[27809] Fix | Delete
for (i = 0, ii = platforms.length; i < ii; i++) {
[27810] Fix | Delete
const strs = names[i];
[27811] Fix | Delete
for (j = 0, jj = strs.length; j < jj; j++) {
[27812] Fix | Delete
str = strs[j];
[27813] Fix | Delete
const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
[27814] Fix | Delete
nameTable += nameRecord;
[27815] Fix | Delete
strOffset += str.length;
[27816] Fix | Delete
}
[27817] Fix | Delete
}
[27818] Fix | Delete
nameTable += strings.join("") + stringsUnicode.join("");
[27819] Fix | Delete
return nameTable;
[27820] Fix | Delete
}
[27821] Fix | Delete
class Font {
[27822] Fix | Delete
constructor(name, file, properties) {
[27823] Fix | Delete
this.name = name;
[27824] Fix | Delete
this.psName = null;
[27825] Fix | Delete
this.mimetype = null;
[27826] Fix | Delete
this.disableFontFace = false;
[27827] Fix | Delete
this.loadedName = properties.loadedName;
[27828] Fix | Delete
this.isType3Font = properties.isType3Font;
[27829] Fix | Delete
this.missingFile = false;
[27830] Fix | Delete
this.cssFontInfo = properties.cssFontInfo;
[27831] Fix | Delete
this._charsCache = Object.create(null);
[27832] Fix | Delete
this._glyphCache = Object.create(null);
[27833] Fix | Delete
let isSerifFont = !!(properties.flags & FontFlags.Serif);
[27834] Fix | Delete
if (!isSerifFont && !properties.isSimulatedFlags) {
[27835] Fix | Delete
const baseName = name.replaceAll(/[,_]/g, "-").split("-", 1)[0],
[27836] Fix | Delete
serifFonts = getSerifFonts();
[27837] Fix | Delete
for (const namePart of baseName.split("+")) {
[27838] Fix | Delete
if (serifFonts[namePart]) {
[27839] Fix | Delete
isSerifFont = true;
[27840] Fix | Delete
break;
[27841] Fix | Delete
}
[27842] Fix | Delete
}
[27843] Fix | Delete
}
[27844] Fix | Delete
this.isSerifFont = isSerifFont;
[27845] Fix | Delete
this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
[27846] Fix | Delete
this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
[27847] Fix | Delete
let {
[27848] Fix | Delete
type,
[27849] Fix | Delete
subtype
[27850] Fix | Delete
} = properties;
[27851] Fix | Delete
this.type = type;
[27852] Fix | Delete
this.subtype = subtype;
[27853] Fix | Delete
this.systemFontInfo = properties.systemFontInfo;
[27854] Fix | Delete
const matches = name.match(/^InvalidPDFjsFont_(.*)_\d+$/);
[27855] Fix | Delete
this.isInvalidPDFjsFont = !!matches;
[27856] Fix | Delete
if (this.isInvalidPDFjsFont) {
[27857] Fix | Delete
this.fallbackName = matches[1];
[27858] Fix | Delete
} else if (this.isMonospace) {
[27859] Fix | Delete
this.fallbackName = "monospace";
[27860] Fix | Delete
} else if (this.isSerifFont) {
[27861] Fix | Delete
this.fallbackName = "serif";
[27862] Fix | Delete
} else {
[27863] Fix | Delete
this.fallbackName = "sans-serif";
[27864] Fix | Delete
}
[27865] Fix | Delete
if (this.systemFontInfo?.guessFallback) {
[27866] Fix | Delete
this.systemFontInfo.guessFallback = false;
[27867] Fix | Delete
this.systemFontInfo.css += `,${this.fallbackName}`;
[27868] Fix | Delete
}
[27869] Fix | Delete
this.differences = properties.differences;
[27870] Fix | Delete
this.widths = properties.widths;
[27871] Fix | Delete
this.defaultWidth = properties.defaultWidth;
[27872] Fix | Delete
this.composite = properties.composite;
[27873] Fix | Delete
this.cMap = properties.cMap;
[27874] Fix | Delete
this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
[27875] Fix | Delete
this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
[27876] Fix | Delete
this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
[27877] Fix | Delete
this.lineHeight = this.ascent - this.descent;
[27878] Fix | Delete
this.fontMatrix = properties.fontMatrix;
[27879] Fix | Delete
this.bbox = properties.bbox;
[27880] Fix | Delete
this.defaultEncoding = properties.defaultEncoding;
[27881] Fix | Delete
this.toUnicode = properties.toUnicode;
[27882] Fix | Delete
this.toFontChar = [];
[27883] Fix | Delete
if (properties.type === "Type3") {
[27884] Fix | Delete
for (let charCode = 0; charCode < 256; charCode++) {
[27885] Fix | Delete
this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
[27886] Fix | Delete
}
[27887] Fix | Delete
return;
[27888] Fix | Delete
}
[27889] Fix | Delete
this.cidEncoding = properties.cidEncoding || "";
[27890] Fix | Delete
this.vertical = !!properties.vertical;
[27891] Fix | Delete
if (this.vertical) {
[27892] Fix | Delete
this.vmetrics = properties.vmetrics;
[27893] Fix | Delete
this.defaultVMetrics = properties.defaultVMetrics;
[27894] Fix | Delete
}
[27895] Fix | Delete
if (!file || file.isEmpty) {
[27896] Fix | Delete
if (file) {
[27897] Fix | Delete
warn('Font file is empty in "' + name + '" (' + this.loadedName + ")");
[27898] Fix | Delete
}
[27899] Fix | Delete
this.fallbackToSystemFont(properties);
[27900] Fix | Delete
return;
[27901] Fix | Delete
}
[27902] Fix | Delete
[type, subtype] = getFontFileType(file, properties);
[27903] Fix | Delete
if (type !== this.type || subtype !== this.subtype) {
[27904] Fix | Delete
info("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
[27905] Fix | Delete
}
[27906] Fix | Delete
let data;
[27907] Fix | Delete
try {
[27908] Fix | Delete
switch (type) {
[27909] Fix | Delete
case "MMType1":
[27910] Fix | Delete
info("MMType1 font (" + name + "), falling back to Type1.");
[27911] Fix | Delete
case "Type1":
[27912] Fix | Delete
case "CIDFontType0":
[27913] Fix | Delete
this.mimetype = "font/opentype";
[27914] Fix | Delete
const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
[27915] Fix | Delete
adjustWidths(properties);
[27916] Fix | Delete
data = this.convert(name, cff, properties);
[27917] Fix | Delete
break;
[27918] Fix | Delete
case "OpenType":
[27919] Fix | Delete
case "TrueType":
[27920] Fix | Delete
case "CIDFontType2":
[27921] Fix | Delete
this.mimetype = "font/opentype";
[27922] Fix | Delete
data = this.checkAndRepair(name, file, properties);
[27923] Fix | Delete
if (this.isOpenType) {
[27924] Fix | Delete
adjustWidths(properties);
[27925] Fix | Delete
type = "OpenType";
[27926] Fix | Delete
}
[27927] Fix | Delete
break;
[27928] Fix | Delete
default:
[27929] Fix | Delete
throw new FormatError(`Font ${type} is not supported`);
[27930] Fix | Delete
}
[27931] Fix | Delete
} catch (e) {
[27932] Fix | Delete
warn(e);
[27933] Fix | Delete
this.fallbackToSystemFont(properties);
[27934] Fix | Delete
return;
[27935] Fix | Delete
}
[27936] Fix | Delete
amendFallbackToUnicode(properties);
[27937] Fix | Delete
this.data = data;
[27938] Fix | Delete
this.type = type;
[27939] Fix | Delete
this.subtype = subtype;
[27940] Fix | Delete
this.fontMatrix = properties.fontMatrix;
[27941] Fix | Delete
this.widths = properties.widths;
[27942] Fix | Delete
this.defaultWidth = properties.defaultWidth;
[27943] Fix | Delete
this.toUnicode = properties.toUnicode;
[27944] Fix | Delete
this.seacMap = properties.seacMap;
[27945] Fix | Delete
}
[27946] Fix | Delete
get renderer() {
[27947] Fix | Delete
const renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
[27948] Fix | Delete
return shadow(this, "renderer", renderer);
[27949] Fix | Delete
}
[27950] Fix | Delete
exportData(extraProperties = false) {
[27951] Fix | Delete
const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
[27952] Fix | Delete
const data = Object.create(null);
[27953] Fix | Delete
let property, value;
[27954] Fix | Delete
for (property of exportDataProperties) {
[27955] Fix | Delete
value = this[property];
[27956] Fix | Delete
if (value !== undefined) {
[27957] Fix | Delete
data[property] = value;
[27958] Fix | Delete
}
[27959] Fix | Delete
}
[27960] Fix | Delete
return data;
[27961] Fix | Delete
}
[27962] Fix | Delete
fallbackToSystemFont(properties) {
[27963] Fix | Delete
this.missingFile = true;
[27964] Fix | Delete
const {
[27965] Fix | Delete
name,
[27966] Fix | Delete
type
[27967] Fix | Delete
} = this;
[27968] Fix | Delete
let fontName = normalizeFontName(name);
[27969] Fix | Delete
const stdFontMap = getStdFontMap(),
[27970] Fix | Delete
nonStdFontMap = getNonStdFontMap();
[27971] Fix | Delete
const isStandardFont = !!stdFontMap[fontName];
[27972] Fix | Delete
const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
[27973] Fix | Delete
fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
[27974] Fix | Delete
const fontBasicMetricsMap = getFontBasicMetrics();
[27975] Fix | Delete
const metrics = fontBasicMetricsMap[fontName];
[27976] Fix | Delete
if (metrics) {
[27977] Fix | Delete
if (isNaN(this.ascent)) {
[27978] Fix | Delete
this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
[27979] Fix | Delete
}
[27980] Fix | Delete
if (isNaN(this.descent)) {
[27981] Fix | Delete
this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
[27982] Fix | Delete
}
[27983] Fix | Delete
if (isNaN(this.capHeight)) {
[27984] Fix | Delete
this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
[27985] Fix | Delete
}
[27986] Fix | Delete
}
[27987] Fix | Delete
this.bold = /bold/gi.test(fontName);
[27988] Fix | Delete
this.italic = /oblique|italic/gi.test(fontName);
[27989] Fix | Delete
this.black = /Black/g.test(name);
[27990] Fix | Delete
const isNarrow = /Narrow/g.test(name);
[27991] Fix | Delete
this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
[27992] Fix | Delete
if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
[27993] Fix | Delete
const cidToGidMap = properties.cidToGidMap;
[27994] Fix | Delete
const map = [];
[27995] Fix | Delete
applyStandardFontGlyphMap(map, getGlyphMapForStandardFonts());
[27996] Fix | Delete
if (/Arial-?Black/i.test(name)) {
[27997] Fix | Delete
applyStandardFontGlyphMap(map, getSupplementalGlyphMapForArialBlack());
[27998] Fix | Delete
} else if (/Calibri/i.test(name)) {
[27999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function