BitmapText text width calculation incorrect
See original GitHub issueBitmapText 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
pixi.js
version: > 6.0.4- Browser & Version: Chrome/FF
- OS & Version: Windows
- How is it supposed to work (pixi 6.0.4): https://jsfiddle.net/etrc786d/
- How does it work now (pixi 6.1.3): https://jsfiddle.net/u38gvtqy/
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:7 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.