Jump to content

Center text in container


Vizcur
 Share

Recommended Posts

Hi,
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
image.png.8b909302b01f923fd1bbe7a8656f3fd5.png
 
Phaser:
image.png.8c5ac2d0d352af61357ced18f4516f3a.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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