single-file-core 1.5.63 → 1.5.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.5.63",
3
+ "version": "1.5.64",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",
@@ -336,12 +336,15 @@
336
336
  }
337
337
 
338
338
  if (globalThis.FontFace) {
339
- const FontFace = globalThis.FontFace;
340
- globalThis.FontFace = function () {
341
- getDetailObject(...arguments).then(detail => document.dispatchEvent(new CustomEvent(NEW_FONT_FACE_EVENT, { detail })));
342
- return new FontFace(...arguments);
339
+ const origFontFace = globalThis.FontFace;
340
+ globalThis.FontFace = function FontFace(family, source, ...args) {
341
+ if (!new.target) {
342
+ return origFontFace();
343
+ }
344
+ getDetailObject(family, source, ...args).then(detail => document.dispatchEvent(new CustomEvent(NEW_FONT_FACE_EVENT, { detail })));
345
+ return new FontFace(family, source, ...args);
343
346
  };
344
- globalThis.FontFace.prototype = FontFace.prototype;
347
+ globalThis.FontFace.prototype = origFontFace.prototype;
345
348
  globalThis.FontFace.toString = function () { return "function FontFace() { [native code] }"; };
346
349
  const deleteFont = document.fonts.delete;
347
350
  document.fonts.delete = function (fontFace) {