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

Bug: BitmapText multiline and missing characters #10135

Open
eXponenta opened this issue Jan 19, 2024 · 0 comments
Open

Bug: BitmapText multiline and missing characters #10135

eXponenta opened this issue Jan 19, 2024 · 0 comments

Comments

@eXponenta
Copy link
Contributor

eXponenta commented Jan 19, 2024

Current Behavior

Text is totally corrupts when a Bitmap Font not include all characters needed for text render.
image

Expected Behavior

Valid text rendering, but with spaces (or any other "unknown" character) as placeholder for missed glyphs.

Like this:

bitmap fonts supported
   1234567890
Woo yay im ubmormal 
bugged this is cool

Steps to Reproduce

Make something like this:

/**
* This is the default playground.
* You should see a bunny spinning in the right preview pane.
* Feel free to use this as a starting point for you own playground!
*/

// Create our application instance
var app = new PIXI.Application({
    width: window.innerWidth,
    height: window.innerHeight,
    backgroundColor: 0x2c3e50
});
document.body.appendChild(app.view);

{
    PIXI.BitmapFont.from("Arial", {
        // no config, use default to emulate missed glyph
    });

    const bitmapFontText = new PIXI.BitmapText(
        ',,,,,,,,,,,bitmap fonts supported ---------  1234567890\nWoo yay im ubmormal bugged,!!!! this is cool!', {
            fontName: 'Arial',
            fontSize: 20,
            maxWidth: 200,
        },
    );

    bitmapFontText.x = 50;
    bitmapFontText.y = 200;

    app.stage.addChild(bitmapFontText);
}

Environment

Possible Solution

No skip character, use DUMMY:

utils.removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos);

Because after that you use relative index and sure that "i" correspond to char array, but because some chars was drops - indices is shifter every line.

Additional Information

No response

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

No branches or pull requests

1 participant