1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Remove the ignoreErrors option from the FontFaceObject class

- The `stopAtErrors` API option, which is the inverse of the "internal" `ignoreErrors` option, is explicitly documented as applying to *parsing* (i.e. the worker-thread) while the `FontFaceObject` class is used during rendering (i.e. the main-thread); see b6765403a1/src/display/api.js (L164-L167)

 - A glyph that fails in the `FontRendererFactory`, on the worker-thread, will already cause (overall) parsing to stop when `ignoreErrors === false` hence checking the option on the main-thread as well seems redundant; see b6765403a1/src/core/evaluator.js (L4527-L4533)

 - Removing this option simplifies the code, and slightly reduces the number of options that we need to handle in the main-thread code.
This commit is contained in:
Jonas Jenwald 2024-05-11 09:56:15 +02:00
parent 5e50479ac6
commit 5f6f1686b5
2 changed files with 2 additions and 12 deletions

View file

@ -383,7 +383,6 @@ function getDocument(src) {
},
};
const transportParams = {
ignoreErrors,
disableFontFace,
fontExtraProperties,
enableXfa,
@ -2750,8 +2749,7 @@ class WorkerTransport {
switch (type) {
case "Font":
const { disableFontFace, fontExtraProperties, ignoreErrors, pdfBug } =
this._params;
const { disableFontFace, fontExtraProperties, pdfBug } = this._params;
if ("error" in exportedData) {
const exportedError = exportedData.error;
@ -2766,7 +2764,6 @@ class WorkerTransport {
: null;
const font = new FontFaceObject(exportedData, {
disableFontFace,
ignoreErrors,
inspectFont,
});

View file

@ -360,17 +360,13 @@ class FontLoader {
}
class FontFaceObject {
constructor(
translatedData,
{ disableFontFace = false, ignoreErrors = false, inspectFont = null }
) {
constructor(translatedData, { disableFontFace = false, inspectFont = null }) {
this.compiledGlyphs = Object.create(null);
// importing translated data
for (const i in translatedData) {
this[i] = translatedData[i];
}
this.disableFontFace = disableFontFace === true;
this.ignoreErrors = ignoreErrors === true;
this._inspectFont = inspectFont;
}
@ -430,9 +426,6 @@ class FontFaceObject {
try {
cmds = objs.get(this.loadedName + "_path_" + character);
} catch (ex) {
if (!this.ignoreErrors) {
throw ex;
}
warn(`getPathGenerator - ignoring character: "${ex}".`);
}