Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

ragePowered
Copy link

@ragePowered ragePowered commented Jul 27, 2025

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

  • Lint process passed (npm run lint)
  • Tests passed (npm run test)

- Explicitly sets parser to 'texture' for blob URLs in textureUrls
@ragePowered ragePowered reopened this Jul 27, 2025
Copy link

pkg-pr-new bot commented Jul 27, 2025

pixi.js-basepixi.js-bunny-mark

npm i https://pkg.pr.new/pixijs/pixijs/pixi.js@11585

commit: 9459d25

@@ -96,7 +96,8 @@ export const loadBitmapFont = {

textureUrls.push({
src: imagePath,
data: textureOptions
data: textureOptions,
parser: imagePath.startsWith('blob:') ? 'texture' : undefined
Copy link
Member

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.

Copy link
Member

@bigtimebuddy bigtimebuddy left a 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants