mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-31 11:27:21 +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); seeb6765403a1/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; seeb6765403a1/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:
parent
5e50479ac6
commit
5f6f1686b5
@ -383,7 +383,6 @@ function getDocument(src) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
const transportParams = {
|
const transportParams = {
|
||||||
ignoreErrors,
|
|
||||||
disableFontFace,
|
disableFontFace,
|
||||||
fontExtraProperties,
|
fontExtraProperties,
|
||||||
enableXfa,
|
enableXfa,
|
||||||
@ -2750,8 +2749,7 @@ class WorkerTransport {
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "Font":
|
case "Font":
|
||||||
const { disableFontFace, fontExtraProperties, ignoreErrors, pdfBug } =
|
const { disableFontFace, fontExtraProperties, pdfBug } = this._params;
|
||||||
this._params;
|
|
||||||
|
|
||||||
if ("error" in exportedData) {
|
if ("error" in exportedData) {
|
||||||
const exportedError = exportedData.error;
|
const exportedError = exportedData.error;
|
||||||
@ -2766,7 +2764,6 @@ class WorkerTransport {
|
|||||||
: null;
|
: null;
|
||||||
const font = new FontFaceObject(exportedData, {
|
const font = new FontFaceObject(exportedData, {
|
||||||
disableFontFace,
|
disableFontFace,
|
||||||
ignoreErrors,
|
|
||||||
inspectFont,
|
inspectFont,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -360,17 +360,13 @@ class FontLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FontFaceObject {
|
class FontFaceObject {
|
||||||
constructor(
|
constructor(translatedData, { disableFontFace = false, inspectFont = null }) {
|
||||||
translatedData,
|
|
||||||
{ disableFontFace = false, ignoreErrors = false, inspectFont = null }
|
|
||||||
) {
|
|
||||||
this.compiledGlyphs = Object.create(null);
|
this.compiledGlyphs = Object.create(null);
|
||||||
// importing translated data
|
// importing translated data
|
||||||
for (const i in translatedData) {
|
for (const i in translatedData) {
|
||||||
this[i] = translatedData[i];
|
this[i] = translatedData[i];
|
||||||
}
|
}
|
||||||
this.disableFontFace = disableFontFace === true;
|
this.disableFontFace = disableFontFace === true;
|
||||||
this.ignoreErrors = ignoreErrors === true;
|
|
||||||
this._inspectFont = inspectFont;
|
this._inspectFont = inspectFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,9 +426,6 @@ class FontFaceObject {
|
|||||||
try {
|
try {
|
||||||
cmds = objs.get(this.loadedName + "_path_" + character);
|
cmds = objs.get(this.loadedName + "_path_" + character);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
if (!this.ignoreErrors) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
warn(`getPathGenerator - ignoring character: "${ex}".`);
|
warn(`getPathGenerator - ignoring character: "${ex}".`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user