Merge pull request #18066 from Snuffleupagus/rm-FontFaceObject-ignoreErrors
Remove the `ignoreErrors` option from the `FontFaceObject` class
This commit is contained in:
commit
761abc7cc3
@ -383,7 +383,6 @@ function getDocument(src) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
const transportParams = {
|
const transportParams = {
|
||||||
ignoreErrors,
|
|
||||||
disableFontFace,
|
disableFontFace,
|
||||||
fontExtraProperties,
|
fontExtraProperties,
|
||||||
enableXfa,
|
enableXfa,
|
||||||
@ -2756,7 +2755,7 @@ class WorkerTransport {
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "Font":
|
case "Font":
|
||||||
const params = this._params;
|
const { disableFontFace, fontExtraProperties, pdfBug } = this._params;
|
||||||
|
|
||||||
if ("error" in exportedData) {
|
if ("error" in exportedData) {
|
||||||
const exportedError = exportedData.error;
|
const exportedError = exportedData.error;
|
||||||
@ -2766,12 +2765,11 @@ class WorkerTransport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const inspectFont =
|
const inspectFont =
|
||||||
params.pdfBug && globalThis.FontInspector?.enabled
|
pdfBug && globalThis.FontInspector?.enabled
|
||||||
? (font, url) => globalThis.FontInspector.fontAdded(font, url)
|
? (font, url) => globalThis.FontInspector.fontAdded(font, url)
|
||||||
: null;
|
: null;
|
||||||
const font = new FontFaceObject(exportedData, {
|
const font = new FontFaceObject(exportedData, {
|
||||||
disableFontFace: params.disableFontFace,
|
disableFontFace,
|
||||||
ignoreErrors: params.ignoreErrors,
|
|
||||||
inspectFont,
|
inspectFont,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2779,7 +2777,7 @@ class WorkerTransport {
|
|||||||
.bind(font)
|
.bind(font)
|
||||||
.catch(() => messageHandler.sendWithPromise("FontFallback", { id }))
|
.catch(() => messageHandler.sendWithPromise("FontFallback", { id }))
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
if (!params.fontExtraProperties && font.data) {
|
if (!fontExtraProperties && font.data) {
|
||||||
// Immediately release the `font.data` property once the font
|
// Immediately release the `font.data` property once the font
|
||||||
// has been attached to the DOM, since it's no longer needed,
|
// has been attached to the DOM, since it's no longer needed,
|
||||||
// rather than waiting for a `PDFDocumentProxy.cleanup` call.
|
// rather than waiting for a `PDFDocumentProxy.cleanup` call.
|
||||||
|
|||||||
@ -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