question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bitmap font is shaking/jittering on newer pixi versions

See original GitHub issue

Expected Behavior

I expect for bitmap text to be rendered without shaking, as in previous pixi versions (e.g. 5.3.12). The bitmap font is guaranteed to be monospaced since every glyph has the same xadvance.

Current Behavior

The text appears to be slightly shaking when changing the value. In the demo I provided, I used the version 6.4.2 as a reference, but I believe that the issues started appearing from the version 6.3.0.

This is possibly related to #8246.

Steps to Reproduce

The demo code can be found here: https://drive.google.com/file/d/1IVs3gt8ImxiDDhxTLMRyzzx56nr0SXIa/view?usp=sharing You can toggle pixijs version in the index.html.

Environment

  • pixi.js version: 6.3.0 – 6.4.2

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
bigtimebuddycommented, Jul 13, 2022

Thank you for the example @tsopeh and for the visual reference.

This seems to be happening because of an incorrect calculation when setting anchor to anything other than 0 (although setting to 0 seemed fine). It could be a rounding issue or incorrect math or poor implementation of xOffset.

As a temporary workaround, if you set xOffset for each character to be the same thing, that helps.

const { chars } = PIXI.BitmapFont.available.MyMono;
Object.keys(chars).forEach(code => chars[code].xOffset = 0);
1reaction
tsopehcommented, Jul 11, 2022

Here’s some video samples that illustrate the issue in a real application:

  1. Without jittering (good behaviour on older versions)

https://user-images.githubusercontent.com/37545996/178275581-7b8d2c0e-0976-41d2-bb16-0ea89d2c816d.mp4

  1. With jittering (bad behaviour on newer versions)

https://user-images.githubusercontent.com/37545996/178275651-32038511-f1e1-472e-8903-d87ede9a22bf.mp4

Read more comments on GitHub >

github_iconTop Results From Across the Web

PIXI.BitmapFont - PixiJS API Documentation
BitmapFont represents a typeface available for use with the BitmapText class. Use the install method for adding a font to be used. new...
Read more >
PIXI V3 Bitmapfont problem! - Pixi.js - HTML5 Game Devs Forum
I'm in the process of turning my current project into V3, when I get this error regarding my bitmap text: "Uncaught TypeError: Cannot...
Read more >
Bitmap font is shaking/jittering on newer pixi versions
Bitmap font is shaking/jittering on newer pixi versions · Expected Behavior. I expect for bitmap text to be rendered without shaking, as in...
Read more >
Making and Using a Bitmap Font in PIXI.js v5 | AMW Blog
png file to our PIXI.Loader as this will be automatically brought in when loading the .fnt file. const loader = new PIXI ......
Read more >
pixi-tagged-text - npm
TaggedText for pixi.js. Latest version: 3.10.0, last published: 19 days ago. Start using pixi-tagged-text in your project by running `npm i ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found