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.

BitmapText text width calculation incorrect

See original GitHub issue

BitmapText textWidth have different value for lines with same amount of symbols (used monospace font, xadvance is set to same value), broke after this pr #7479.

Expected Behavior

textWidth for characters ‘1111’ must be same as for ‘3333’ (pixijs 6.0.4 or lower)

Current Behavior

textWidth not same (pixijs 6.1.2)

Possible Solution

i think lastLineWidth calculation is wrong

Environment

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kjarriocommented, Oct 31, 2021

Here is a PR with a fix: #7933

Example: https://codesandbox.io/s/festive-cartwright-7ruly?file=/index.html

@neymanhuska - btw, I had to fix the xadvance/xoffsets in your font to get correct monospacing.

0reactions
stale[bot]commented, Mar 2, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

new PIXI.BitmapText (text, style) - PixiJS
Otherwise, getLocalBounds may calculate incorrect bounds, which makes the container's width and height wrong. To remove a mask, set this property to null...
Read more >
bitmapText.width and textWidth after text change - Phaser 2
Do bitmapText.updateText() and it will calculate the correct textWidth there and then. This calculation is usually deferred until the next ...
Read more >
Phaser 3 API Documentation - Class: BitmapText
new BitmapText(scene, x, y, font [, text] [, size] [, align]) ... values other than 1 are not taken in to consideration when...
Read more >
PIXI.BitmapText
A BitmapText object will create a line or multiple lines of text using bitmap font. ... If undefined, . this will default to...
Read more >
EaselJS v1.0.0 API Documentation : BitmapText - CreateJS
Displays text using bitmap glyphs defined in a sprite sheet. Multi-line text is supported using new line characters, but automatic wrapping is not...
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