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
}
[27000] Fix | Delete
}
[27001] Fix | Delete
warn('Invalid "Length1" property in Type1 font -- trying to recover.');
[27002] Fix | Delete
stream.pos = streamStartPos;
[27003] Fix | Delete
const SCAN_BLOCK_LENGTH = 2048;
[27004] Fix | Delete
let actualLength;
[27005] Fix | Delete
while (true) {
[27006] Fix | Delete
const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
[27007] Fix | Delete
block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
[27008] Fix | Delete
if (block.length === 0) {
[27009] Fix | Delete
break;
[27010] Fix | Delete
}
[27011] Fix | Delete
stream.pos += block.length;
[27012] Fix | Delete
if (block.found) {
[27013] Fix | Delete
actualLength = stream.pos - streamStartPos;
[27014] Fix | Delete
break;
[27015] Fix | Delete
}
[27016] Fix | Delete
}
[27017] Fix | Delete
stream.pos = streamStartPos;
[27018] Fix | Delete
if (actualLength) {
[27019] Fix | Delete
return {
[27020] Fix | Delete
stream: new Stream(stream.getBytes(actualLength)),
[27021] Fix | Delete
length: actualLength
[27022] Fix | Delete
};
[27023] Fix | Delete
}
[27024] Fix | Delete
warn('Unable to recover "Length1" property in Type1 font -- using as is.');
[27025] Fix | Delete
return {
[27026] Fix | Delete
stream: new Stream(stream.getBytes(suggestedLength)),
[27027] Fix | Delete
length: suggestedLength
[27028] Fix | Delete
};
[27029] Fix | Delete
}
[27030] Fix | Delete
function getEexecBlock(stream, suggestedLength) {
[27031] Fix | Delete
const eexecBytes = stream.getBytes();
[27032] Fix | Delete
if (eexecBytes.length === 0) {
[27033] Fix | Delete
throw new FormatError("getEexecBlock - no font program found.");
[27034] Fix | Delete
}
[27035] Fix | Delete
return {
[27036] Fix | Delete
stream: new Stream(eexecBytes),
[27037] Fix | Delete
length: eexecBytes.length
[27038] Fix | Delete
};
[27039] Fix | Delete
}
[27040] Fix | Delete
class Type1Font {
[27041] Fix | Delete
constructor(name, file, properties) {
[27042] Fix | Delete
const PFB_HEADER_SIZE = 6;
[27043] Fix | Delete
let headerBlockLength = properties.length1;
[27044] Fix | Delete
let eexecBlockLength = properties.length2;
[27045] Fix | Delete
let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
[27046] Fix | Delete
const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
[27047] Fix | Delete
if (pfbHeaderPresent) {
[27048] Fix | Delete
file.skip(PFB_HEADER_SIZE);
[27049] Fix | Delete
headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
[27050] Fix | Delete
}
[27051] Fix | Delete
const headerBlock = getHeaderBlock(file, headerBlockLength);
[27052] Fix | Delete
const headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
[27053] Fix | Delete
headerBlockParser.extractFontHeader(properties);
[27054] Fix | Delete
if (pfbHeaderPresent) {
[27055] Fix | Delete
pfbHeader = file.getBytes(PFB_HEADER_SIZE);
[27056] Fix | Delete
eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
[27057] Fix | Delete
}
[27058] Fix | Delete
const eexecBlock = getEexecBlock(file, eexecBlockLength);
[27059] Fix | Delete
const eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
[27060] Fix | Delete
const data = eexecBlockParser.extractFontProgram(properties);
[27061] Fix | Delete
for (const key in data.properties) {
[27062] Fix | Delete
properties[key] = data.properties[key];
[27063] Fix | Delete
}
[27064] Fix | Delete
const charstrings = data.charstrings;
[27065] Fix | Delete
const type2Charstrings = this.getType2Charstrings(charstrings);
[27066] Fix | Delete
const subrs = this.getType2Subrs(data.subrs);
[27067] Fix | Delete
this.charstrings = charstrings;
[27068] Fix | Delete
this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
[27069] Fix | Delete
this.seacs = this.getSeacs(data.charstrings);
[27070] Fix | Delete
}
[27071] Fix | Delete
get numGlyphs() {
[27072] Fix | Delete
return this.charstrings.length + 1;
[27073] Fix | Delete
}
[27074] Fix | Delete
getCharset() {
[27075] Fix | Delete
const charset = [".notdef"];
[27076] Fix | Delete
for (const {
[27077] Fix | Delete
glyphName
[27078] Fix | Delete
} of this.charstrings) {
[27079] Fix | Delete
charset.push(glyphName);
[27080] Fix | Delete
}
[27081] Fix | Delete
return charset;
[27082] Fix | Delete
}
[27083] Fix | Delete
getGlyphMapping(properties) {
[27084] Fix | Delete
const charstrings = this.charstrings;
[27085] Fix | Delete
if (properties.composite) {
[27086] Fix | Delete
const charCodeToGlyphId = Object.create(null);
[27087] Fix | Delete
for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
[27088] Fix | Delete
const charCode = properties.cMap.charCodeOf(glyphId);
[27089] Fix | Delete
charCodeToGlyphId[charCode] = glyphId + 1;
[27090] Fix | Delete
}
[27091] Fix | Delete
return charCodeToGlyphId;
[27092] Fix | Delete
}
[27093] Fix | Delete
const glyphNames = [".notdef"];
[27094] Fix | Delete
let builtInEncoding, glyphId;
[27095] Fix | Delete
for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
[27096] Fix | Delete
glyphNames.push(charstrings[glyphId].glyphName);
[27097] Fix | Delete
}
[27098] Fix | Delete
const encoding = properties.builtInEncoding;
[27099] Fix | Delete
if (encoding) {
[27100] Fix | Delete
builtInEncoding = Object.create(null);
[27101] Fix | Delete
for (const charCode in encoding) {
[27102] Fix | Delete
glyphId = glyphNames.indexOf(encoding[charCode]);
[27103] Fix | Delete
if (glyphId >= 0) {
[27104] Fix | Delete
builtInEncoding[charCode] = glyphId;
[27105] Fix | Delete
}
[27106] Fix | Delete
}
[27107] Fix | Delete
}
[27108] Fix | Delete
return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
[27109] Fix | Delete
}
[27110] Fix | Delete
hasGlyphId(id) {
[27111] Fix | Delete
if (id < 0 || id >= this.numGlyphs) {
[27112] Fix | Delete
return false;
[27113] Fix | Delete
}
[27114] Fix | Delete
if (id === 0) {
[27115] Fix | Delete
return true;
[27116] Fix | Delete
}
[27117] Fix | Delete
const glyph = this.charstrings[id - 1];
[27118] Fix | Delete
return glyph.charstring.length > 0;
[27119] Fix | Delete
}
[27120] Fix | Delete
getSeacs(charstrings) {
[27121] Fix | Delete
const seacMap = [];
[27122] Fix | Delete
for (let i = 0, ii = charstrings.length; i < ii; i++) {
[27123] Fix | Delete
const charstring = charstrings[i];
[27124] Fix | Delete
if (charstring.seac) {
[27125] Fix | Delete
seacMap[i + 1] = charstring.seac;
[27126] Fix | Delete
}
[27127] Fix | Delete
}
[27128] Fix | Delete
return seacMap;
[27129] Fix | Delete
}
[27130] Fix | Delete
getType2Charstrings(type1Charstrings) {
[27131] Fix | Delete
const type2Charstrings = [];
[27132] Fix | Delete
for (const type1Charstring of type1Charstrings) {
[27133] Fix | Delete
type2Charstrings.push(type1Charstring.charstring);
[27134] Fix | Delete
}
[27135] Fix | Delete
return type2Charstrings;
[27136] Fix | Delete
}
[27137] Fix | Delete
getType2Subrs(type1Subrs) {
[27138] Fix | Delete
let bias = 0;
[27139] Fix | Delete
const count = type1Subrs.length;
[27140] Fix | Delete
if (count < 1133) {
[27141] Fix | Delete
bias = 107;
[27142] Fix | Delete
} else if (count < 33769) {
[27143] Fix | Delete
bias = 1131;
[27144] Fix | Delete
} else {
[27145] Fix | Delete
bias = 32768;
[27146] Fix | Delete
}
[27147] Fix | Delete
const type2Subrs = [];
[27148] Fix | Delete
let i;
[27149] Fix | Delete
for (i = 0; i < bias; i++) {
[27150] Fix | Delete
type2Subrs.push([0x0b]);
[27151] Fix | Delete
}
[27152] Fix | Delete
for (i = 0; i < count; i++) {
[27153] Fix | Delete
type2Subrs.push(type1Subrs[i]);
[27154] Fix | Delete
}
[27155] Fix | Delete
return type2Subrs;
[27156] Fix | Delete
}
[27157] Fix | Delete
wrap(name, glyphs, charstrings, subrs, properties) {
[27158] Fix | Delete
const cff = new CFF();
[27159] Fix | Delete
cff.header = new CFFHeader(1, 0, 4, 4);
[27160] Fix | Delete
cff.names = [name];
[27161] Fix | Delete
const topDict = new CFFTopDict();
[27162] Fix | Delete
topDict.setByName("version", 391);
[27163] Fix | Delete
topDict.setByName("Notice", 392);
[27164] Fix | Delete
topDict.setByName("FullName", 393);
[27165] Fix | Delete
topDict.setByName("FamilyName", 394);
[27166] Fix | Delete
topDict.setByName("Weight", 395);
[27167] Fix | Delete
topDict.setByName("Encoding", null);
[27168] Fix | Delete
topDict.setByName("FontMatrix", properties.fontMatrix);
[27169] Fix | Delete
topDict.setByName("FontBBox", properties.bbox);
[27170] Fix | Delete
topDict.setByName("charset", null);
[27171] Fix | Delete
topDict.setByName("CharStrings", null);
[27172] Fix | Delete
topDict.setByName("Private", null);
[27173] Fix | Delete
cff.topDict = topDict;
[27174] Fix | Delete
const strings = new CFFStrings();
[27175] Fix | Delete
strings.add("Version 0.11");
[27176] Fix | Delete
strings.add("See original notice");
[27177] Fix | Delete
strings.add(name);
[27178] Fix | Delete
strings.add(name);
[27179] Fix | Delete
strings.add("Medium");
[27180] Fix | Delete
cff.strings = strings;
[27181] Fix | Delete
cff.globalSubrIndex = new CFFIndex();
[27182] Fix | Delete
const count = glyphs.length;
[27183] Fix | Delete
const charsetArray = [".notdef"];
[27184] Fix | Delete
let i, ii;
[27185] Fix | Delete
for (i = 0; i < count; i++) {
[27186] Fix | Delete
const glyphName = charstrings[i].glyphName;
[27187] Fix | Delete
const index = CFFStandardStrings.indexOf(glyphName);
[27188] Fix | Delete
if (index === -1) {
[27189] Fix | Delete
strings.add(glyphName);
[27190] Fix | Delete
}
[27191] Fix | Delete
charsetArray.push(glyphName);
[27192] Fix | Delete
}
[27193] Fix | Delete
cff.charset = new CFFCharset(false, 0, charsetArray);
[27194] Fix | Delete
const charStringsIndex = new CFFIndex();
[27195] Fix | Delete
charStringsIndex.add([0x8b, 0x0e]);
[27196] Fix | Delete
for (i = 0; i < count; i++) {
[27197] Fix | Delete
charStringsIndex.add(glyphs[i]);
[27198] Fix | Delete
}
[27199] Fix | Delete
cff.charStrings = charStringsIndex;
[27200] Fix | Delete
const privateDict = new CFFPrivateDict();
[27201] Fix | Delete
privateDict.setByName("Subrs", null);
[27202] Fix | Delete
const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
[27203] Fix | Delete
for (i = 0, ii = fields.length; i < ii; i++) {
[27204] Fix | Delete
const field = fields[i];
[27205] Fix | Delete
if (!(field in properties.privateData)) {
[27206] Fix | Delete
continue;
[27207] Fix | Delete
}
[27208] Fix | Delete
const value = properties.privateData[field];
[27209] Fix | Delete
if (Array.isArray(value)) {
[27210] Fix | Delete
for (let j = value.length - 1; j > 0; j--) {
[27211] Fix | Delete
value[j] -= value[j - 1];
[27212] Fix | Delete
}
[27213] Fix | Delete
}
[27214] Fix | Delete
privateDict.setByName(field, value);
[27215] Fix | Delete
}
[27216] Fix | Delete
cff.topDict.privateDict = privateDict;
[27217] Fix | Delete
const subrIndex = new CFFIndex();
[27218] Fix | Delete
for (i = 0, ii = subrs.length; i < ii; i++) {
[27219] Fix | Delete
subrIndex.add(subrs[i]);
[27220] Fix | Delete
}
[27221] Fix | Delete
privateDict.subrsIndex = subrIndex;
[27222] Fix | Delete
const compiler = new CFFCompiler(cff);
[27223] Fix | Delete
return compiler.compile();
[27224] Fix | Delete
}
[27225] Fix | Delete
}
[27226] Fix | Delete
[27227] Fix | Delete
;// CONCATENATED MODULE: ./src/core/fonts.js
[27228] Fix | Delete
[27229] Fix | Delete
[27230] Fix | Delete
[27231] Fix | Delete
[27232] Fix | Delete
[27233] Fix | Delete
[27234] Fix | Delete
[27235] Fix | Delete
[27236] Fix | Delete
[27237] Fix | Delete
[27238] Fix | Delete
[27239] Fix | Delete
[27240] Fix | Delete
[27241] Fix | Delete
[27242] Fix | Delete
[27243] Fix | Delete
[27244] Fix | Delete
[27245] Fix | Delete
[27246] Fix | Delete
[27247] Fix | Delete
[27248] Fix | Delete
[27249] Fix | Delete
[27250] Fix | Delete
[27251] Fix | Delete
[27252] Fix | Delete
[27253] Fix | Delete
[27254] Fix | Delete
[27255] Fix | Delete
[27256] Fix | Delete
[27257] Fix | Delete
[27258] Fix | Delete
[27259] Fix | Delete
[27260] Fix | Delete
[27261] Fix | Delete
[27262] Fix | Delete
[27263] Fix | Delete
const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
[27264] Fix | Delete
const PDF_GLYPH_SPACE_UNITS = 1000;
[27265] Fix | Delete
const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "isInvalidPDFjsFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "systemFontInfo", "type", "vertical"];
[27266] Fix | Delete
const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
[27267] Fix | Delete
function adjustWidths(properties) {
[27268] Fix | Delete
if (!properties.fontMatrix) {
[27269] Fix | Delete
return;
[27270] Fix | Delete
}
[27271] Fix | Delete
if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
[27272] Fix | Delete
return;
[27273] Fix | Delete
}
[27274] Fix | Delete
const scale = 0.001 / properties.fontMatrix[0];
[27275] Fix | Delete
const glyphsWidths = properties.widths;
[27276] Fix | Delete
for (const glyph in glyphsWidths) {
[27277] Fix | Delete
glyphsWidths[glyph] *= scale;
[27278] Fix | Delete
}
[27279] Fix | Delete
properties.defaultWidth *= scale;
[27280] Fix | Delete
}
[27281] Fix | Delete
function adjustTrueTypeToUnicode(properties, isSymbolicFont, nameRecords) {
[27282] Fix | Delete
if (properties.isInternalFont) {
[27283] Fix | Delete
return;
[27284] Fix | Delete
}
[27285] Fix | Delete
if (properties.hasIncludedToUnicodeMap) {
[27286] Fix | Delete
return;
[27287] Fix | Delete
}
[27288] Fix | Delete
if (properties.hasEncoding) {
[27289] Fix | Delete
return;
[27290] Fix | Delete
}
[27291] Fix | Delete
if (properties.toUnicode instanceof IdentityToUnicodeMap) {
[27292] Fix | Delete
return;
[27293] Fix | Delete
}
[27294] Fix | Delete
if (!isSymbolicFont) {
[27295] Fix | Delete
return;
[27296] Fix | Delete
}
[27297] Fix | Delete
if (nameRecords.length === 0) {
[27298] Fix | Delete
return;
[27299] Fix | Delete
}
[27300] Fix | Delete
if (properties.defaultEncoding === WinAnsiEncoding) {
[27301] Fix | Delete
return;
[27302] Fix | Delete
}
[27303] Fix | Delete
for (const r of nameRecords) {
[27304] Fix | Delete
if (!isWinNameRecord(r)) {
[27305] Fix | Delete
return;
[27306] Fix | Delete
}
[27307] Fix | Delete
}
[27308] Fix | Delete
const encoding = WinAnsiEncoding;
[27309] Fix | Delete
const toUnicode = [],
[27310] Fix | Delete
glyphsUnicodeMap = getGlyphsUnicode();
[27311] Fix | Delete
for (const charCode in encoding) {
[27312] Fix | Delete
const glyphName = encoding[charCode];
[27313] Fix | Delete
if (glyphName === "") {
[27314] Fix | Delete
continue;
[27315] Fix | Delete
}
[27316] Fix | Delete
const unicode = glyphsUnicodeMap[glyphName];
[27317] Fix | Delete
if (unicode === undefined) {
[27318] Fix | Delete
continue;
[27319] Fix | Delete
}
[27320] Fix | Delete
toUnicode[charCode] = String.fromCharCode(unicode);
[27321] Fix | Delete
}
[27322] Fix | Delete
if (toUnicode.length > 0) {
[27323] Fix | Delete
properties.toUnicode.amend(toUnicode);
[27324] Fix | Delete
}
[27325] Fix | Delete
}
[27326] Fix | Delete
function adjustType1ToUnicode(properties, builtInEncoding) {
[27327] Fix | Delete
if (properties.isInternalFont) {
[27328] Fix | Delete
return;
[27329] Fix | Delete
}
[27330] Fix | Delete
if (properties.hasIncludedToUnicodeMap) {
[27331] Fix | Delete
return;
[27332] Fix | Delete
}
[27333] Fix | Delete
if (builtInEncoding === properties.defaultEncoding) {
[27334] Fix | Delete
return;
[27335] Fix | Delete
}
[27336] Fix | Delete
if (properties.toUnicode instanceof IdentityToUnicodeMap) {
[27337] Fix | Delete
return;
[27338] Fix | Delete
}
[27339] Fix | Delete
const toUnicode = [],
[27340] Fix | Delete
glyphsUnicodeMap = getGlyphsUnicode();
[27341] Fix | Delete
for (const charCode in builtInEncoding) {
[27342] Fix | Delete
if (properties.hasEncoding) {
[27343] Fix | Delete
if (properties.baseEncodingName || properties.differences[charCode] !== undefined) {
[27344] Fix | Delete
continue;
[27345] Fix | Delete
}
[27346] Fix | Delete
}
[27347] Fix | Delete
const glyphName = builtInEncoding[charCode];
[27348] Fix | Delete
const unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
[27349] Fix | Delete
if (unicode !== -1) {
[27350] Fix | Delete
toUnicode[charCode] = String.fromCharCode(unicode);
[27351] Fix | Delete
}
[27352] Fix | Delete
}
[27353] Fix | Delete
if (toUnicode.length > 0) {
[27354] Fix | Delete
properties.toUnicode.amend(toUnicode);
[27355] Fix | Delete
}
[27356] Fix | Delete
}
[27357] Fix | Delete
function amendFallbackToUnicode(properties) {
[27358] Fix | Delete
if (!properties.fallbackToUnicode) {
[27359] Fix | Delete
return;
[27360] Fix | Delete
}
[27361] Fix | Delete
if (properties.toUnicode instanceof IdentityToUnicodeMap) {
[27362] Fix | Delete
return;
[27363] Fix | Delete
}
[27364] Fix | Delete
const toUnicode = [];
[27365] Fix | Delete
for (const charCode in properties.fallbackToUnicode) {
[27366] Fix | Delete
if (properties.toUnicode.has(charCode)) {
[27367] Fix | Delete
continue;
[27368] Fix | Delete
}
[27369] Fix | Delete
toUnicode[charCode] = properties.fallbackToUnicode[charCode];
[27370] Fix | Delete
}
[27371] Fix | Delete
if (toUnicode.length > 0) {
[27372] Fix | Delete
properties.toUnicode.amend(toUnicode);
[27373] Fix | Delete
}
[27374] Fix | Delete
}
[27375] Fix | Delete
class fonts_Glyph {
[27376] Fix | Delete
constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
[27377] Fix | Delete
this.originalCharCode = originalCharCode;
[27378] Fix | Delete
this.fontChar = fontChar;
[27379] Fix | Delete
this.unicode = unicode;
[27380] Fix | Delete
this.accent = accent;
[27381] Fix | Delete
this.width = width;
[27382] Fix | Delete
this.vmetric = vmetric;
[27383] Fix | Delete
this.operatorListId = operatorListId;
[27384] Fix | Delete
this.isSpace = isSpace;
[27385] Fix | Delete
this.isInFont = isInFont;
[27386] Fix | Delete
}
[27387] Fix | Delete
get category() {
[27388] Fix | Delete
return shadow(this, "category", getCharUnicodeCategory(this.unicode), true);
[27389] Fix | Delete
}
[27390] Fix | Delete
}
[27391] Fix | Delete
function int16(b0, b1) {
[27392] Fix | Delete
return (b0 << 8) + b1;
[27393] Fix | Delete
}
[27394] Fix | Delete
function writeSignedInt16(bytes, index, value) {
[27395] Fix | Delete
bytes[index + 1] = value;
[27396] Fix | Delete
bytes[index] = value >>> 8;
[27397] Fix | Delete
}
[27398] Fix | Delete
function signedInt16(b0, b1) {
[27399] Fix | Delete
const value = (b0 << 8) + b1;
[27400] Fix | Delete
return value & 1 << 15 ? value - 0x10000 : value;
[27401] Fix | Delete
}
[27402] Fix | Delete
function writeUint32(bytes, index, value) {
[27403] Fix | Delete
bytes[index + 3] = value & 0xff;
[27404] Fix | Delete
bytes[index + 2] = value >>> 8;
[27405] Fix | Delete
bytes[index + 1] = value >>> 16;
[27406] Fix | Delete
bytes[index] = value >>> 24;
[27407] Fix | Delete
}
[27408] Fix | Delete
function int32(b0, b1, b2, b3) {
[27409] Fix | Delete
return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
[27410] Fix | Delete
}
[27411] Fix | Delete
function string16(value) {
[27412] Fix | Delete
return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
[27413] Fix | Delete
}
[27414] Fix | Delete
function safeString16(value) {
[27415] Fix | Delete
if (value > 0x7fff) {
[27416] Fix | Delete
value = 0x7fff;
[27417] Fix | Delete
} else if (value < -0x8000) {
[27418] Fix | Delete
value = -0x8000;
[27419] Fix | Delete
}
[27420] Fix | Delete
return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
[27421] Fix | Delete
}
[27422] Fix | Delete
function isTrueTypeFile(file) {
[27423] Fix | Delete
const header = file.peekBytes(4);
[27424] Fix | Delete
return readUint32(header, 0) === 0x00010000 || bytesToString(header) === "true";
[27425] Fix | Delete
}
[27426] Fix | Delete
function isTrueTypeCollectionFile(file) {
[27427] Fix | Delete
const header = file.peekBytes(4);
[27428] Fix | Delete
return bytesToString(header) === "ttcf";
[27429] Fix | Delete
}
[27430] Fix | Delete
function isOpenTypeFile(file) {
[27431] Fix | Delete
const header = file.peekBytes(4);
[27432] Fix | Delete
return bytesToString(header) === "OTTO";
[27433] Fix | Delete
}
[27434] Fix | Delete
function isType1File(file) {
[27435] Fix | Delete
const header = file.peekBytes(2);
[27436] Fix | Delete
if (header[0] === 0x25 && header[1] === 0x21) {
[27437] Fix | Delete
return true;
[27438] Fix | Delete
}
[27439] Fix | Delete
if (header[0] === 0x80 && header[1] === 0x01) {
[27440] Fix | Delete
return true;
[27441] Fix | Delete
}
[27442] Fix | Delete
return false;
[27443] Fix | Delete
}
[27444] Fix | Delete
function isCFFFile(file) {
[27445] Fix | Delete
const header = file.peekBytes(4);
[27446] Fix | Delete
if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
[27447] Fix | Delete
return true;
[27448] Fix | Delete
}
[27449] Fix | Delete
return false;
[27450] Fix | Delete
}
[27451] Fix | Delete
function getFontFileType(file, {
[27452] Fix | Delete
type,
[27453] Fix | Delete
subtype,
[27454] Fix | Delete
composite
[27455] Fix | Delete
}) {
[27456] Fix | Delete
let fileType, fileSubtype;
[27457] Fix | Delete
if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
[27458] Fix | Delete
fileType = composite ? "CIDFontType2" : "TrueType";
[27459] Fix | Delete
} else if (isOpenTypeFile(file)) {
[27460] Fix | Delete
fileType = composite ? "CIDFontType2" : "OpenType";
[27461] Fix | Delete
} else if (isType1File(file)) {
[27462] Fix | Delete
if (composite) {
[27463] Fix | Delete
fileType = "CIDFontType0";
[27464] Fix | Delete
} else {
[27465] Fix | Delete
fileType = type === "MMType1" ? "MMType1" : "Type1";
[27466] Fix | Delete
}
[27467] Fix | Delete
} else if (isCFFFile(file)) {
[27468] Fix | Delete
if (composite) {
[27469] Fix | Delete
fileType = "CIDFontType0";
[27470] Fix | Delete
fileSubtype = "CIDFontType0C";
[27471] Fix | Delete
} else {
[27472] Fix | Delete
fileType = type === "MMType1" ? "MMType1" : "Type1";
[27473] Fix | Delete
fileSubtype = "Type1C";
[27474] Fix | Delete
}
[27475] Fix | Delete
} else {
[27476] Fix | Delete
warn("getFontFileType: Unable to detect correct font file Type/Subtype.");
[27477] Fix | Delete
fileType = type;
[27478] Fix | Delete
fileSubtype = subtype;
[27479] Fix | Delete
}
[27480] Fix | Delete
return [fileType, fileSubtype];
[27481] Fix | Delete
}
[27482] Fix | Delete
function applyStandardFontGlyphMap(map, glyphMap) {
[27483] Fix | Delete
for (const charCode in glyphMap) {
[27484] Fix | Delete
map[+charCode] = glyphMap[charCode];
[27485] Fix | Delete
}
[27486] Fix | Delete
}
[27487] Fix | Delete
function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
[27488] Fix | Delete
const toFontChar = [];
[27489] Fix | Delete
let unicode;
[27490] Fix | Delete
for (let i = 0, ii = encoding.length; i < ii; i++) {
[27491] Fix | Delete
unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap);
[27492] Fix | Delete
if (unicode !== -1) {
[27493] Fix | Delete
toFontChar[i] = unicode;
[27494] Fix | Delete
}
[27495] Fix | Delete
}
[27496] Fix | Delete
for (const charCode in differences) {
[27497] Fix | Delete
unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap);
[27498] Fix | Delete
if (unicode !== -1) {
[27499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function