Merge pull request #11654 from Snuffleupagus/BaseFontLoader-isFontLoadingAPISupported
Simplify the `BaseFontLoader.isFontLoadingAPISupported` getter
This commit is contained in:
commit
8ea8fa5958
@ -113,9 +113,9 @@ class BaseFontLoader {
|
||||
unreachable("Abstract method `_queueLoadingCallback`.");
|
||||
}
|
||||
|
||||
// eslint-disable-next-line getter-return
|
||||
get isFontLoadingAPISupported() {
|
||||
unreachable("Abstract method `isFontLoadingAPISupported`.");
|
||||
const supported = typeof document !== "undefined" && !!document.fonts;
|
||||
return shadow(this, "isFontLoadingAPISupported", supported);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line getter-return
|
||||
@ -136,14 +136,6 @@ class BaseFontLoader {
|
||||
let FontLoader;
|
||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||
FontLoader = class MozcentralFontLoader extends BaseFontLoader {
|
||||
get isFontLoadingAPISupported() {
|
||||
return shadow(
|
||||
this,
|
||||
"isFontLoadingAPISupported",
|
||||
typeof document !== "undefined" && !!document.fonts
|
||||
);
|
||||
}
|
||||
|
||||
get isSyncFontLoadingSupported() {
|
||||
return shadow(this, "isSyncFontLoadingSupported", true);
|
||||
}
|
||||
@ -161,24 +153,6 @@ if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||
this.loadTestFontId = 0;
|
||||
}
|
||||
|
||||
get isFontLoadingAPISupported() {
|
||||
let supported = typeof document !== "undefined" && !!document.fonts;
|
||||
|
||||
if (
|
||||
(typeof PDFJSDev === "undefined" || !PDFJSDev.test("CHROME")) &&
|
||||
supported &&
|
||||
typeof navigator !== "undefined"
|
||||
) {
|
||||
// The Firefox Font Loading API does not work with `mozPrintCallback`
|
||||
// prior to version 63; see https://bugzilla.mozilla.org/show_bug.cgi?id=1473742
|
||||
const m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);
|
||||
if (m && m[1] < 63) {
|
||||
supported = false;
|
||||
}
|
||||
}
|
||||
return shadow(this, "isFontLoadingAPISupported", supported);
|
||||
}
|
||||
|
||||
get isSyncFontLoadingSupported() {
|
||||
let supported = false;
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("CHROME")) {
|
||||
|
Loading…
Reference in New Issue
Block a user