mwatt Posted October 21, 2013 Share Posted October 21, 2013 When I read the width of a Text object it consistently reads the same, no matter what scaling is applied. Is this normal? I am trying to center a Text object within a canvas that is itself being centered and also scaled, and having difficulty. I believe I recall reading that Text objects needed one frame of animation to run before their width property is correct. Is this true? If so, what technique is good to deal with this? Also, any idea when the next version of Pixi.js will be released? Quote Link to comment Share on other sites More sharing options...
Mat Groves Posted October 21, 2013 Share Posted October 21, 2013 Howdy, Ah yes I remember this issue. It basically to do with text not getting rendered until its actually added to the stage. Because of that it means the width is not calculated until updateTransform has been called. This is definitely something that needs looking into. I do have a fix in mind - it will involve overriding the width / height getter setters to see if the text is "dirty" or not. If it is then updateText() will be called. That should then set width and height to be correct. For now I think calling updateTexture() manually should set width and height to be correct for you. With regards to the next pixi release, we are working on webGL filters at the moment. Fun Fun! Quote Link to comment Share on other sites More sharing options...
mwatt Posted October 22, 2013 Author Share Posted October 22, 2013 Mat, Thank you so much for taking the time to reply. Unfortunately neither updateText() nor updateTexture() of the PIXI.Text object (I wasn't sure which was right, so I tried both -singly and in conjunction) had any apparent affect on the reported width. I tried adding these calls both before and after I added the Text object to the DisplayObjectContainer that handles my scaling. But perhaps I labor under a misapprehension. Maybe the reported width is, and should be, disconnected from the scaling? Quote Link to comment Share on other sites More sharing options...
1-800-STAR-WARS Posted December 16, 2013 Share Posted December 16, 2013 Hey guys, did you ever figure this out? Quote Link to comment Share on other sites More sharing options...
mwatt Posted December 17, 2013 Author Share Posted December 17, 2013 Lewis, I never did. Shortly after this exchange on the board I switched to using sprites, because I was getting some dithering I did not like when scaling. Quote Link to comment Share on other sites More sharing options...
1-800-STAR-WARS Posted December 20, 2013 Share Posted December 20, 2013 I wonder, do bitmap fonts give a more accurate width? It seems like regular fonts give an approximately right value but never quite accurate enough. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.