Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BitmapText doesn't work in worker #8901

Closed
ImAwesome opened this issue Nov 29, 2022 · 2 comments · Fixed by #8904
Closed

BitmapText doesn't work in worker #8901

ImAwesome opened this issue Nov 29, 2022 · 2 comments · Fixed by #8904
Assignees
Labels
🕷 Bug Verified that it’s actually a legit bug that exists in the current release.

Comments

@ImAwesome
Copy link

Problem is that PIXI.Assets.load for fonts fnt and xml uses globalThis.DOMParser() inside, which does not exist in worker's context

class XMLStringFormat {
    static test(data) {
      if (typeof data === "string" && data.includes("<font>")) {
        const xml = new globalThis.DOMParser().parseFromString(data, "text/xml");
        return XMLFormat.test(xml);
      }
      return false;
    }
    static parse(xmlTxt) {
      const xml = new globalThis.DOMParser().parseFromString(xmlTxt, "text/xml");
      return XMLFormat.parse(xml);
    }
  }
  • webworker.js version: 7.0.4
  • Browser & Version: all
  • OS & Version: _e.g. all
@bigtimebuddy
Copy link
Member

My suggestion is that we add a new DOMParser entry to the ADAPTER. For webworker and node bundles and use xmldom package instead of window.DOMParser. These things should be roughly equivalent.

@bigtimebuddy bigtimebuddy self-assigned this Nov 29, 2022
@bigtimebuddy bigtimebuddy added the 🕷 Bug Verified that it’s actually a legit bug that exists in the current release. label Nov 29, 2022
@ImAwesome
Copy link
Author

Thank you for fast response, you are georgeous!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕷 Bug Verified that it’s actually a legit bug that exists in the current release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants