You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EDIT: half of this issue is my limited Phaser knowledge. Sorry about that. I suggest to read it anyways, and perhaps a workaround i suggest at the end of the report can be made into a 'feature request' instead (thanks to @Antriel )
After a textfield is created and we want to set a different TextStyle, specifically with different TextMetrics, using myText.setStyle(myCompoundStyle) sets all the styling (like color,..) except the TextMetrics object/values - these stay the same. Setting TextMetrics during textfield initialization works as expected.
Example Test Code
Im pasting off the top of my head (can contain typos). Following code assumes that the textfield has been created prior:
EDIT1:
I was made to understand current 'best practice' solution to this: the fact that myText.setStyle recalculates the style metrics, but myText.style.setStyle does not:
Feature Request
I'd like to change this report to be a feature request, that if a text style that is being set contains metrics object, it will not recalculate text metrics, but use those provided. Sorry for the contrived nature of this report.
The text was updated successfully, but these errors were encountered:
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.
Version
3.24.1
win10
any
Description
EDIT: half of this issue is my limited Phaser knowledge. Sorry about that. I suggest to read it anyways, and perhaps a workaround i suggest at the end of the report can be made into a 'feature request' instead (thanks to @Antriel )
After a textfield is created and we want to set a different TextStyle, specifically with different TextMetrics, using
myText.setStyle(myCompoundStyle)
sets all the styling (like color,..) except the TextMetrics object/values - these stay the same. Setting TextMetrics during textfield initialization works as expected.Example Test Code
Im pasting off the top of my head (can contain typos). Following code assumes that the textfield has been created prior:
The above does set the color, but not the new TextMetrics object values.
What seems like even stranger behavior (tested on: Firefox, Chrome), using and modifying existing example at:
https://labs.phaser.io/edit.html?src=src/game%20objects\text\text%20metrics.js
Replace second half of code starting with
function create() ...
with:EDIT1:
I was made to understand current 'best practice' solution to this: the fact that
myText.setStyle
recalculates the style metrics, butmyText.style.setStyle
does not:Feature Request
I'd like to change this report to be a feature request, that if a text style that is being set contains
metrics
object, it will not recalculate text metrics, but use those provided. Sorry for the contrived nature of this report.The text was updated successfully, but these errors were encountered: