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
sink.enqueue(textContent, length);
[36500] Fix | Delete
textContent.items = [];
[36501] Fix | Delete
textContent.styles = Object.create(null);
[36502] Fix | Delete
}
[36503] Fix | Delete
const timeSlotManager = new TimeSlotManager();
[36504] Fix | Delete
return new Promise(function promiseBody(resolve, reject) {
[36505] Fix | Delete
const next = function (promise) {
[36506] Fix | Delete
enqueueChunk(true);
[36507] Fix | Delete
Promise.all([promise, sink.ready]).then(function () {
[36508] Fix | Delete
try {
[36509] Fix | Delete
promiseBody(resolve, reject);
[36510] Fix | Delete
} catch (ex) {
[36511] Fix | Delete
reject(ex);
[36512] Fix | Delete
}
[36513] Fix | Delete
}, reject);
[36514] Fix | Delete
};
[36515] Fix | Delete
task.ensureNotTerminated();
[36516] Fix | Delete
timeSlotManager.reset();
[36517] Fix | Delete
const operation = {};
[36518] Fix | Delete
let stop,
[36519] Fix | Delete
args = [];
[36520] Fix | Delete
while (!(stop = timeSlotManager.check())) {
[36521] Fix | Delete
args.length = 0;
[36522] Fix | Delete
operation.args = args;
[36523] Fix | Delete
if (!preprocessor.read(operation)) {
[36524] Fix | Delete
break;
[36525] Fix | Delete
}
[36526] Fix | Delete
const previousState = textState;
[36527] Fix | Delete
textState = stateManager.state;
[36528] Fix | Delete
const fn = operation.fn;
[36529] Fix | Delete
args = operation.args;
[36530] Fix | Delete
switch (fn | 0) {
[36531] Fix | Delete
case OPS.setFont:
[36532] Fix | Delete
var fontNameArg = args[0].name,
[36533] Fix | Delete
fontSizeArg = args[1];
[36534] Fix | Delete
if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
[36535] Fix | Delete
break;
[36536] Fix | Delete
}
[36537] Fix | Delete
flushTextContentItem();
[36538] Fix | Delete
textState.fontName = fontNameArg;
[36539] Fix | Delete
textState.fontSize = fontSizeArg;
[36540] Fix | Delete
next(handleSetFont(fontNameArg, null));
[36541] Fix | Delete
return;
[36542] Fix | Delete
case OPS.setTextRise:
[36543] Fix | Delete
textState.textRise = args[0];
[36544] Fix | Delete
break;
[36545] Fix | Delete
case OPS.setHScale:
[36546] Fix | Delete
textState.textHScale = args[0] / 100;
[36547] Fix | Delete
break;
[36548] Fix | Delete
case OPS.setLeading:
[36549] Fix | Delete
textState.leading = args[0];
[36550] Fix | Delete
break;
[36551] Fix | Delete
case OPS.moveText:
[36552] Fix | Delete
textState.translateTextLineMatrix(args[0], args[1]);
[36553] Fix | Delete
textState.textMatrix = textState.textLineMatrix.slice();
[36554] Fix | Delete
break;
[36555] Fix | Delete
case OPS.setLeadingMoveText:
[36556] Fix | Delete
textState.leading = -args[1];
[36557] Fix | Delete
textState.translateTextLineMatrix(args[0], args[1]);
[36558] Fix | Delete
textState.textMatrix = textState.textLineMatrix.slice();
[36559] Fix | Delete
break;
[36560] Fix | Delete
case OPS.nextLine:
[36561] Fix | Delete
textState.carriageReturn();
[36562] Fix | Delete
break;
[36563] Fix | Delete
case OPS.setTextMatrix:
[36564] Fix | Delete
textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
[36565] Fix | Delete
textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
[36566] Fix | Delete
updateAdvanceScale();
[36567] Fix | Delete
break;
[36568] Fix | Delete
case OPS.setCharSpacing:
[36569] Fix | Delete
textState.charSpacing = args[0];
[36570] Fix | Delete
break;
[36571] Fix | Delete
case OPS.setWordSpacing:
[36572] Fix | Delete
textState.wordSpacing = args[0];
[36573] Fix | Delete
break;
[36574] Fix | Delete
case OPS.beginText:
[36575] Fix | Delete
textState.textMatrix = IDENTITY_MATRIX.slice();
[36576] Fix | Delete
textState.textLineMatrix = IDENTITY_MATRIX.slice();
[36577] Fix | Delete
break;
[36578] Fix | Delete
case OPS.showSpacedText:
[36579] Fix | Delete
if (!stateManager.state.font) {
[36580] Fix | Delete
self.ensureStateFont(stateManager.state);
[36581] Fix | Delete
continue;
[36582] Fix | Delete
}
[36583] Fix | Delete
const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
[36584] Fix | Delete
const elements = args[0];
[36585] Fix | Delete
for (let i = 0, ii = elements.length; i < ii; i++) {
[36586] Fix | Delete
const item = elements[i];
[36587] Fix | Delete
if (typeof item === "string") {
[36588] Fix | Delete
showSpacedTextBuffer.push(item);
[36589] Fix | Delete
} else if (typeof item === "number" && item !== 0) {
[36590] Fix | Delete
const str = showSpacedTextBuffer.join("");
[36591] Fix | Delete
showSpacedTextBuffer.length = 0;
[36592] Fix | Delete
buildTextContentItem({
[36593] Fix | Delete
chars: str,
[36594] Fix | Delete
extraSpacing: item * spaceFactor
[36595] Fix | Delete
});
[36596] Fix | Delete
}
[36597] Fix | Delete
}
[36598] Fix | Delete
if (showSpacedTextBuffer.length > 0) {
[36599] Fix | Delete
const str = showSpacedTextBuffer.join("");
[36600] Fix | Delete
showSpacedTextBuffer.length = 0;
[36601] Fix | Delete
buildTextContentItem({
[36602] Fix | Delete
chars: str,
[36603] Fix | Delete
extraSpacing: 0
[36604] Fix | Delete
});
[36605] Fix | Delete
}
[36606] Fix | Delete
break;
[36607] Fix | Delete
case OPS.showText:
[36608] Fix | Delete
if (!stateManager.state.font) {
[36609] Fix | Delete
self.ensureStateFont(stateManager.state);
[36610] Fix | Delete
continue;
[36611] Fix | Delete
}
[36612] Fix | Delete
buildTextContentItem({
[36613] Fix | Delete
chars: args[0],
[36614] Fix | Delete
extraSpacing: 0
[36615] Fix | Delete
});
[36616] Fix | Delete
break;
[36617] Fix | Delete
case OPS.nextLineShowText:
[36618] Fix | Delete
if (!stateManager.state.font) {
[36619] Fix | Delete
self.ensureStateFont(stateManager.state);
[36620] Fix | Delete
continue;
[36621] Fix | Delete
}
[36622] Fix | Delete
textState.carriageReturn();
[36623] Fix | Delete
buildTextContentItem({
[36624] Fix | Delete
chars: args[0],
[36625] Fix | Delete
extraSpacing: 0
[36626] Fix | Delete
});
[36627] Fix | Delete
break;
[36628] Fix | Delete
case OPS.nextLineSetSpacingShowText:
[36629] Fix | Delete
if (!stateManager.state.font) {
[36630] Fix | Delete
self.ensureStateFont(stateManager.state);
[36631] Fix | Delete
continue;
[36632] Fix | Delete
}
[36633] Fix | Delete
textState.wordSpacing = args[0];
[36634] Fix | Delete
textState.charSpacing = args[1];
[36635] Fix | Delete
textState.carriageReturn();
[36636] Fix | Delete
buildTextContentItem({
[36637] Fix | Delete
chars: args[2],
[36638] Fix | Delete
extraSpacing: 0
[36639] Fix | Delete
});
[36640] Fix | Delete
break;
[36641] Fix | Delete
case OPS.paintXObject:
[36642] Fix | Delete
flushTextContentItem();
[36643] Fix | Delete
if (!xobjs) {
[36644] Fix | Delete
xobjs = resources.get("XObject") || Dict.empty;
[36645] Fix | Delete
}
[36646] Fix | Delete
var isValidName = args[0] instanceof Name;
[36647] Fix | Delete
var name = args[0].name;
[36648] Fix | Delete
if (isValidName && emptyXObjectCache.getByName(name)) {
[36649] Fix | Delete
break;
[36650] Fix | Delete
}
[36651] Fix | Delete
next(new Promise(function (resolveXObject, rejectXObject) {
[36652] Fix | Delete
if (!isValidName) {
[36653] Fix | Delete
throw new FormatError("XObject must be referred to by name.");
[36654] Fix | Delete
}
[36655] Fix | Delete
let xobj = xobjs.getRaw(name);
[36656] Fix | Delete
if (xobj instanceof Ref) {
[36657] Fix | Delete
if (emptyXObjectCache.getByRef(xobj)) {
[36658] Fix | Delete
resolveXObject();
[36659] Fix | Delete
return;
[36660] Fix | Delete
}
[36661] Fix | Delete
const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
[36662] Fix | Delete
if (globalImage) {
[36663] Fix | Delete
resolveXObject();
[36664] Fix | Delete
return;
[36665] Fix | Delete
}
[36666] Fix | Delete
xobj = xref.fetch(xobj);
[36667] Fix | Delete
}
[36668] Fix | Delete
if (!(xobj instanceof BaseStream)) {
[36669] Fix | Delete
throw new FormatError("XObject should be a stream");
[36670] Fix | Delete
}
[36671] Fix | Delete
const type = xobj.dict.get("Subtype");
[36672] Fix | Delete
if (!(type instanceof Name)) {
[36673] Fix | Delete
throw new FormatError("XObject should have a Name subtype");
[36674] Fix | Delete
}
[36675] Fix | Delete
if (type.name !== "Form") {
[36676] Fix | Delete
emptyXObjectCache.set(name, xobj.dict.objId, true);
[36677] Fix | Delete
resolveXObject();
[36678] Fix | Delete
return;
[36679] Fix | Delete
}
[36680] Fix | Delete
const currentState = stateManager.state.clone();
[36681] Fix | Delete
const xObjStateManager = new StateManager(currentState);
[36682] Fix | Delete
const matrix = lookupMatrix(xobj.dict.getArray("Matrix"), null);
[36683] Fix | Delete
if (matrix) {
[36684] Fix | Delete
xObjStateManager.transform(matrix);
[36685] Fix | Delete
}
[36686] Fix | Delete
enqueueChunk();
[36687] Fix | Delete
const sinkWrapper = {
[36688] Fix | Delete
enqueueInvoked: false,
[36689] Fix | Delete
enqueue(chunk, size) {
[36690] Fix | Delete
this.enqueueInvoked = true;
[36691] Fix | Delete
sink.enqueue(chunk, size);
[36692] Fix | Delete
},
[36693] Fix | Delete
get desiredSize() {
[36694] Fix | Delete
return sink.desiredSize;
[36695] Fix | Delete
},
[36696] Fix | Delete
get ready() {
[36697] Fix | Delete
return sink.ready;
[36698] Fix | Delete
}
[36699] Fix | Delete
};
[36700] Fix | Delete
self.getTextContent({
[36701] Fix | Delete
stream: xobj,
[36702] Fix | Delete
task,
[36703] Fix | Delete
resources: xobj.dict.get("Resources") || resources,
[36704] Fix | Delete
stateManager: xObjStateManager,
[36705] Fix | Delete
includeMarkedContent,
[36706] Fix | Delete
sink: sinkWrapper,
[36707] Fix | Delete
seenStyles,
[36708] Fix | Delete
viewBox,
[36709] Fix | Delete
lang,
[36710] Fix | Delete
markedContentData,
[36711] Fix | Delete
disableNormalization,
[36712] Fix | Delete
keepWhiteSpace
[36713] Fix | Delete
}).then(function () {
[36714] Fix | Delete
if (!sinkWrapper.enqueueInvoked) {
[36715] Fix | Delete
emptyXObjectCache.set(name, xobj.dict.objId, true);
[36716] Fix | Delete
}
[36717] Fix | Delete
resolveXObject();
[36718] Fix | Delete
}, rejectXObject);
[36719] Fix | Delete
}).catch(function (reason) {
[36720] Fix | Delete
if (reason instanceof AbortException) {
[36721] Fix | Delete
return;
[36722] Fix | Delete
}
[36723] Fix | Delete
if (self.options.ignoreErrors) {
[36724] Fix | Delete
warn(`getTextContent - ignoring XObject: "${reason}".`);
[36725] Fix | Delete
return;
[36726] Fix | Delete
}
[36727] Fix | Delete
throw reason;
[36728] Fix | Delete
}));
[36729] Fix | Delete
return;
[36730] Fix | Delete
case OPS.setGState:
[36731] Fix | Delete
isValidName = args[0] instanceof Name;
[36732] Fix | Delete
name = args[0].name;
[36733] Fix | Delete
if (isValidName && emptyGStateCache.getByName(name)) {
[36734] Fix | Delete
break;
[36735] Fix | Delete
}
[36736] Fix | Delete
next(new Promise(function (resolveGState, rejectGState) {
[36737] Fix | Delete
if (!isValidName) {
[36738] Fix | Delete
throw new FormatError("GState must be referred to by name.");
[36739] Fix | Delete
}
[36740] Fix | Delete
const extGState = resources.get("ExtGState");
[36741] Fix | Delete
if (!(extGState instanceof Dict)) {
[36742] Fix | Delete
throw new FormatError("ExtGState should be a dictionary.");
[36743] Fix | Delete
}
[36744] Fix | Delete
const gState = extGState.get(name);
[36745] Fix | Delete
if (!(gState instanceof Dict)) {
[36746] Fix | Delete
throw new FormatError("GState should be a dictionary.");
[36747] Fix | Delete
}
[36748] Fix | Delete
const gStateFont = gState.get("Font");
[36749] Fix | Delete
if (!gStateFont) {
[36750] Fix | Delete
emptyGStateCache.set(name, gState.objId, true);
[36751] Fix | Delete
resolveGState();
[36752] Fix | Delete
return;
[36753] Fix | Delete
}
[36754] Fix | Delete
flushTextContentItem();
[36755] Fix | Delete
textState.fontName = null;
[36756] Fix | Delete
textState.fontSize = gStateFont[1];
[36757] Fix | Delete
handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
[36758] Fix | Delete
}).catch(function (reason) {
[36759] Fix | Delete
if (reason instanceof AbortException) {
[36760] Fix | Delete
return;
[36761] Fix | Delete
}
[36762] Fix | Delete
if (self.options.ignoreErrors) {
[36763] Fix | Delete
warn(`getTextContent - ignoring ExtGState: "${reason}".`);
[36764] Fix | Delete
return;
[36765] Fix | Delete
}
[36766] Fix | Delete
throw reason;
[36767] Fix | Delete
}));
[36768] Fix | Delete
return;
[36769] Fix | Delete
case OPS.beginMarkedContent:
[36770] Fix | Delete
flushTextContentItem();
[36771] Fix | Delete
if (includeMarkedContent) {
[36772] Fix | Delete
markedContentData.level++;
[36773] Fix | Delete
textContent.items.push({
[36774] Fix | Delete
type: "beginMarkedContent",
[36775] Fix | Delete
tag: args[0] instanceof Name ? args[0].name : null
[36776] Fix | Delete
});
[36777] Fix | Delete
}
[36778] Fix | Delete
break;
[36779] Fix | Delete
case OPS.beginMarkedContentProps:
[36780] Fix | Delete
flushTextContentItem();
[36781] Fix | Delete
if (includeMarkedContent) {
[36782] Fix | Delete
markedContentData.level++;
[36783] Fix | Delete
let mcid = null;
[36784] Fix | Delete
if (args[1] instanceof Dict) {
[36785] Fix | Delete
mcid = args[1].get("MCID");
[36786] Fix | Delete
}
[36787] Fix | Delete
textContent.items.push({
[36788] Fix | Delete
type: "beginMarkedContentProps",
[36789] Fix | Delete
id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mc${mcid}` : null,
[36790] Fix | Delete
tag: args[0] instanceof Name ? args[0].name : null
[36791] Fix | Delete
});
[36792] Fix | Delete
}
[36793] Fix | Delete
break;
[36794] Fix | Delete
case OPS.endMarkedContent:
[36795] Fix | Delete
flushTextContentItem();
[36796] Fix | Delete
if (includeMarkedContent) {
[36797] Fix | Delete
if (markedContentData.level === 0) {
[36798] Fix | Delete
break;
[36799] Fix | Delete
}
[36800] Fix | Delete
markedContentData.level--;
[36801] Fix | Delete
textContent.items.push({
[36802] Fix | Delete
type: "endMarkedContent"
[36803] Fix | Delete
});
[36804] Fix | Delete
}
[36805] Fix | Delete
break;
[36806] Fix | Delete
case OPS.restore:
[36807] Fix | Delete
if (previousState && (previousState.font !== textState.font || previousState.fontSize !== textState.fontSize || previousState.fontName !== textState.fontName)) {
[36808] Fix | Delete
flushTextContentItem();
[36809] Fix | Delete
}
[36810] Fix | Delete
break;
[36811] Fix | Delete
}
[36812] Fix | Delete
if (textContent.items.length >= sink.desiredSize) {
[36813] Fix | Delete
stop = true;
[36814] Fix | Delete
break;
[36815] Fix | Delete
}
[36816] Fix | Delete
}
[36817] Fix | Delete
if (stop) {
[36818] Fix | Delete
next(deferred);
[36819] Fix | Delete
return;
[36820] Fix | Delete
}
[36821] Fix | Delete
flushTextContentItem();
[36822] Fix | Delete
enqueueChunk();
[36823] Fix | Delete
resolve();
[36824] Fix | Delete
}).catch(reason => {
[36825] Fix | Delete
if (reason instanceof AbortException) {
[36826] Fix | Delete
return;
[36827] Fix | Delete
}
[36828] Fix | Delete
if (this.options.ignoreErrors) {
[36829] Fix | Delete
warn(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
[36830] Fix | Delete
flushTextContentItem();
[36831] Fix | Delete
enqueueChunk();
[36832] Fix | Delete
return;
[36833] Fix | Delete
}
[36834] Fix | Delete
throw reason;
[36835] Fix | Delete
});
[36836] Fix | Delete
}
[36837] Fix | Delete
async extractDataStructures(dict, properties) {
[36838] Fix | Delete
const xref = this.xref;
[36839] Fix | Delete
let cidToGidBytes;
[36840] Fix | Delete
const toUnicodePromise = this.readToUnicode(properties.toUnicode);
[36841] Fix | Delete
if (properties.composite) {
[36842] Fix | Delete
const cidSystemInfo = dict.get("CIDSystemInfo");
[36843] Fix | Delete
if (cidSystemInfo instanceof Dict) {
[36844] Fix | Delete
properties.cidSystemInfo = {
[36845] Fix | Delete
registry: stringToPDFString(cidSystemInfo.get("Registry")),
[36846] Fix | Delete
ordering: stringToPDFString(cidSystemInfo.get("Ordering")),
[36847] Fix | Delete
supplement: cidSystemInfo.get("Supplement")
[36848] Fix | Delete
};
[36849] Fix | Delete
}
[36850] Fix | Delete
try {
[36851] Fix | Delete
const cidToGidMap = dict.get("CIDToGIDMap");
[36852] Fix | Delete
if (cidToGidMap instanceof BaseStream) {
[36853] Fix | Delete
cidToGidBytes = cidToGidMap.getBytes();
[36854] Fix | Delete
}
[36855] Fix | Delete
} catch (ex) {
[36856] Fix | Delete
if (!this.options.ignoreErrors) {
[36857] Fix | Delete
throw ex;
[36858] Fix | Delete
}
[36859] Fix | Delete
warn(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
[36860] Fix | Delete
}
[36861] Fix | Delete
}
[36862] Fix | Delete
const differences = [];
[36863] Fix | Delete
let baseEncodingName = null;
[36864] Fix | Delete
let encoding;
[36865] Fix | Delete
if (dict.has("Encoding")) {
[36866] Fix | Delete
encoding = dict.get("Encoding");
[36867] Fix | Delete
if (encoding instanceof Dict) {
[36868] Fix | Delete
baseEncodingName = encoding.get("BaseEncoding");
[36869] Fix | Delete
baseEncodingName = baseEncodingName instanceof Name ? baseEncodingName.name : null;
[36870] Fix | Delete
if (encoding.has("Differences")) {
[36871] Fix | Delete
const diffEncoding = encoding.get("Differences");
[36872] Fix | Delete
let index = 0;
[36873] Fix | Delete
for (const entry of diffEncoding) {
[36874] Fix | Delete
const data = xref.fetchIfRef(entry);
[36875] Fix | Delete
if (typeof data === "number") {
[36876] Fix | Delete
index = data;
[36877] Fix | Delete
} else if (data instanceof Name) {
[36878] Fix | Delete
differences[index++] = data.name;
[36879] Fix | Delete
} else {
[36880] Fix | Delete
throw new FormatError(`Invalid entry in 'Differences' array: ${data}`);
[36881] Fix | Delete
}
[36882] Fix | Delete
}
[36883] Fix | Delete
}
[36884] Fix | Delete
} else if (encoding instanceof Name) {
[36885] Fix | Delete
baseEncodingName = encoding.name;
[36886] Fix | Delete
} else {
[36887] Fix | Delete
const msg = "Encoding is not a Name nor a Dict";
[36888] Fix | Delete
if (!this.options.ignoreErrors) {
[36889] Fix | Delete
throw new FormatError(msg);
[36890] Fix | Delete
}
[36891] Fix | Delete
warn(msg);
[36892] Fix | Delete
}
[36893] Fix | Delete
if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
[36894] Fix | Delete
baseEncodingName = null;
[36895] Fix | Delete
}
[36896] Fix | Delete
}
[36897] Fix | Delete
const nonEmbeddedFont = !properties.file || properties.isInternalFont,
[36898] Fix | Delete
isSymbolsFontName = getSymbolsFonts()[properties.name];
[36899] Fix | Delete
if (baseEncodingName && nonEmbeddedFont && isSymbolsFontName) {
[36900] Fix | Delete
baseEncodingName = null;
[36901] Fix | Delete
}
[36902] Fix | Delete
if (baseEncodingName) {
[36903] Fix | Delete
properties.defaultEncoding = getEncoding(baseEncodingName);
[36904] Fix | Delete
} else {
[36905] Fix | Delete
const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
[36906] Fix | Delete
const isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
[36907] Fix | Delete
encoding = StandardEncoding;
[36908] Fix | Delete
if (properties.type === "TrueType" && !isNonsymbolicFont) {
[36909] Fix | Delete
encoding = WinAnsiEncoding;
[36910] Fix | Delete
}
[36911] Fix | Delete
if (isSymbolicFont || isSymbolsFontName) {
[36912] Fix | Delete
encoding = MacRomanEncoding;
[36913] Fix | Delete
if (nonEmbeddedFont) {
[36914] Fix | Delete
if (/Symbol/i.test(properties.name)) {
[36915] Fix | Delete
encoding = SymbolSetEncoding;
[36916] Fix | Delete
} else if (/Dingbats/i.test(properties.name)) {
[36917] Fix | Delete
encoding = ZapfDingbatsEncoding;
[36918] Fix | Delete
} else if (/Wingdings/i.test(properties.name)) {
[36919] Fix | Delete
encoding = WinAnsiEncoding;
[36920] Fix | Delete
}
[36921] Fix | Delete
}
[36922] Fix | Delete
}
[36923] Fix | Delete
properties.defaultEncoding = encoding;
[36924] Fix | Delete
}
[36925] Fix | Delete
properties.differences = differences;
[36926] Fix | Delete
properties.baseEncodingName = baseEncodingName;
[36927] Fix | Delete
properties.hasEncoding = !!baseEncodingName || differences.length > 0;
[36928] Fix | Delete
properties.dict = dict;
[36929] Fix | Delete
properties.toUnicode = await toUnicodePromise;
[36930] Fix | Delete
const builtToUnicode = await this.buildToUnicode(properties);
[36931] Fix | Delete
properties.toUnicode = builtToUnicode;
[36932] Fix | Delete
if (cidToGidBytes) {
[36933] Fix | Delete
properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
[36934] Fix | Delete
}
[36935] Fix | Delete
return properties;
[36936] Fix | Delete
}
[36937] Fix | Delete
_simpleFontToUnicode(properties, forceGlyphs = false) {
[36938] Fix | Delete
assert(!properties.composite, "Must be a simple font.");
[36939] Fix | Delete
const toUnicode = [];
[36940] Fix | Delete
const encoding = properties.defaultEncoding.slice();
[36941] Fix | Delete
const baseEncodingName = properties.baseEncodingName;
[36942] Fix | Delete
const differences = properties.differences;
[36943] Fix | Delete
for (const charcode in differences) {
[36944] Fix | Delete
const glyphName = differences[charcode];
[36945] Fix | Delete
if (glyphName === ".notdef") {
[36946] Fix | Delete
continue;
[36947] Fix | Delete
}
[36948] Fix | Delete
encoding[charcode] = glyphName;
[36949] Fix | Delete
}
[36950] Fix | Delete
const glyphsUnicodeMap = getGlyphsUnicode();
[36951] Fix | Delete
for (const charcode in encoding) {
[36952] Fix | Delete
let glyphName = encoding[charcode];
[36953] Fix | Delete
if (glyphName === "") {
[36954] Fix | Delete
continue;
[36955] Fix | Delete
}
[36956] Fix | Delete
let unicode = glyphsUnicodeMap[glyphName];
[36957] Fix | Delete
if (unicode !== undefined) {
[36958] Fix | Delete
toUnicode[charcode] = String.fromCharCode(unicode);
[36959] Fix | Delete
continue;
[36960] Fix | Delete
}
[36961] Fix | Delete
let code = 0;
[36962] Fix | Delete
switch (glyphName[0]) {
[36963] Fix | Delete
case "G":
[36964] Fix | Delete
if (glyphName.length === 3) {
[36965] Fix | Delete
code = parseInt(glyphName.substring(1), 16);
[36966] Fix | Delete
}
[36967] Fix | Delete
break;
[36968] Fix | Delete
case "g":
[36969] Fix | Delete
if (glyphName.length === 5) {
[36970] Fix | Delete
code = parseInt(glyphName.substring(1), 16);
[36971] Fix | Delete
}
[36972] Fix | Delete
break;
[36973] Fix | Delete
case "C":
[36974] Fix | Delete
case "c":
[36975] Fix | Delete
if (glyphName.length >= 3 && glyphName.length <= 4) {
[36976] Fix | Delete
const codeStr = glyphName.substring(1);
[36977] Fix | Delete
if (forceGlyphs) {
[36978] Fix | Delete
code = parseInt(codeStr, 16);
[36979] Fix | Delete
break;
[36980] Fix | Delete
}
[36981] Fix | Delete
code = +codeStr;
[36982] Fix | Delete
if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
[36983] Fix | Delete
return this._simpleFontToUnicode(properties, true);
[36984] Fix | Delete
}
[36985] Fix | Delete
}
[36986] Fix | Delete
break;
[36987] Fix | Delete
case "u":
[36988] Fix | Delete
unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
[36989] Fix | Delete
if (unicode !== -1) {
[36990] Fix | Delete
code = unicode;
[36991] Fix | Delete
}
[36992] Fix | Delete
break;
[36993] Fix | Delete
default:
[36994] Fix | Delete
switch (glyphName) {
[36995] Fix | Delete
case "f_h":
[36996] Fix | Delete
case "f_t":
[36997] Fix | Delete
case "T_h":
[36998] Fix | Delete
toUnicode[charcode] = glyphName.replaceAll("_", "");
[36999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function