-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
fix: ensure correct parser for blob image paths in bitmap font loader #11585
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
base: dev
Are you sure you want to change the base?
Conversation
- Explicitly sets parser to 'texture' for blob URLs in textureUrls
|
pixi.js-base • pixi.js-bunny-mark commit: |
| src: imagePath, | ||
| data: textureOptions | ||
| data: textureOptions, | ||
| parser: imagePath.startsWith('blob:') ? 'texture' : undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be much more useful if users could declare the parser to use rather than assuming every blob is a texture.
Assets.load({ src: "path/to/font.fnt", data: { imageParser: "ktx" } })This way it would easily support ktx, basis and other compressed texture types.
bigtimebuddy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ragePowered thanks so much for this change. Blobs are definitely an area that we could use more support.
The best way for us to solve this one is, like my comment above suggest, to allow the texture parser to be configurable through the asset's data. Is this something that you could look at and maybe create a test for?
Description of change
This pull request extends BitmapFont support in PixiJS 8 to allow using Blob URLs as texture sources.
Previously, loadBitmapFont relied solely on file extensions to determine the appropriate loader, which fails for blob URLs (since they have no extension).
This change assumes that any file referenced within the .fnt file is a texture (e.g. PNG, JPG, WEBP, AVIF, or a Blob representing one of these formats), and treats it accordingly.
Potential impact:
This may affect cases where compressed textures (e.g. .ktx, .basis, etc.) are used as .fnt texture pages. Their handling is not explicitly addressed here and might require additional logic.
Pre-Merge Checklist
npm run lint)npm run test)