mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-16 10:14:03 +02:00
Merge pull request #20836 from Snuffleupagus/FontFaceObject-fix-asserts
Fix the `disableFontFace` and `fontExtraProperties` asserts in the `FontFaceObject` constructor (PR 20197 follow-up)
This commit is contained in:
commit
873378b718
@ -355,19 +355,22 @@ class FontLoader {
|
||||
}
|
||||
|
||||
class FontFaceObject {
|
||||
compiledGlyphs = Object.create(null);
|
||||
|
||||
#fontData;
|
||||
|
||||
constructor(translatedData, inspectFont = null, extra, charProcOperatorList) {
|
||||
this.compiledGlyphs = Object.create(null);
|
||||
this.#fontData = translatedData;
|
||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
||||
if (typeof this.disableFontFace !== "boolean") {
|
||||
unreachable("disableFontFace must be available.");
|
||||
}
|
||||
if (typeof this.fontExtraProperties !== "boolean") {
|
||||
unreachable("fontExtraProperties must be available.");
|
||||
}
|
||||
assert(
|
||||
typeof translatedData.disableFontFace === "boolean",
|
||||
"disableFontFace must be available."
|
||||
);
|
||||
assert(
|
||||
typeof translatedData.fontExtraProperties === "boolean",
|
||||
"fontExtraProperties must be available."
|
||||
);
|
||||
}
|
||||
this.#fontData = translatedData;
|
||||
this._inspectFont = inspectFont;
|
||||
if (extra) {
|
||||
Object.assign(this, extra);
|
||||
@ -453,7 +456,7 @@ class FontFaceObject {
|
||||
}
|
||||
|
||||
get disableFontFace() {
|
||||
return this.#fontData.disableFontFace ?? false;
|
||||
return this.#fontData.disableFontFace;
|
||||
}
|
||||
|
||||
set disableFontFace(value) {
|
||||
@ -461,7 +464,7 @@ class FontFaceObject {
|
||||
}
|
||||
|
||||
get fontExtraProperties() {
|
||||
return this.#fontData.fontExtraProperties ?? false;
|
||||
return this.#fontData.fontExtraProperties;
|
||||
}
|
||||
|
||||
get isInvalidPDFjsFont() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user