Jump to content

Center text in container


Recommended Posts

My query is this: I use the Cocos creator tool to position a text. When you export the position of this element and then integrate it into my phaser game, it happens that the selected position is slightly different from what is previewed in the Cocos tool.
I suspect it is due to how both tools draw the font in their respective container. As you can see in the attached images, in the tool the text is centered in its container, however, in Phaser, when debugging the edges of the text, you can see that the font is positioned upwards.
In short, both containers are in the same position but the texts are drawn in different positions.
Is there any way to modify how Phaser draws the text in his container?

As additional information, both texts are centered and added to a sprite as a child.
The way the text is positioned varies according to the font used.

Cocos tool

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...