allaboutgame Posted September 19, 2017 Share Posted September 19, 2017 I added text into a sprite as child. My text could not show font correctly. Anybody could help me? My code is as follows: this.style = { font: "30px Arial", fill: "#000", boundsAlignH: "center", boundsAlignV: "top" }; ... this.textContent = this.add.text( -30, -60, "test content", this.style); ... However, what I got on test webpage was not Arial font, but as shown in attached image. Why is that? Link to comment Share on other sites More sharing options...
allaboutgame Posted September 19, 2017 Author Share Posted September 19, 2017 I found out that, if I add a style to a text that's shown directly in a group, the style will appear. However, if the text is added as a child to a sprite (e.g. the backgroud card in my case), the style wasn't apply to the text properly. Any suggestions? Link to comment Share on other sites More sharing options...
allaboutgame Posted September 22, 2017 Author Share Posted September 22, 2017 I'd like to update on my status to my question, in case anyone read this post. My codes were correct. When I enlarged the fonts, I could see the correct display. The only problem was that, the font seemed like 8 bit fonts, for some reason. Link to comment Share on other sites More sharing options...
Recommended Posts