Navinv789

Need help in Pixi to draw text vertically.

Recommended Posts

Hi!

CSS has that property (text-orientation:upright), but its not possible to use in canvas2d text, so , pixi naturally doesnt support it. 

Two ways to do that

1. Make a text per each character. Manually position it. Say goodbye to performance if there are more than 200 characters.
2. Copy pixi text source and make your class that  works vertically.

Edited by ivan.popelyshev

Share this post


Link to post
Share on other sites

To make your text appear as in the sample image, you can rotate the textfield.

myTextField.rotation=-Math.PI/2;

Alternatively, to make your text appear as in Ex1, you can start a new line after each character with \n 

myTextField.text='N\nA\nM\nE'

Edited by opd

Share this post


Link to post
Share on other sites
On 7/15/2020 at 10:15 AM, opd said:

To make your text appear as in the sample image, you can rotate the textfield.

myTextField.rotation=-Math.PI/2;

Alternatively, to make your text appear as in Ex1, you can start a new line after each character with \n 

myTextField.text='N\nA\nM\nE'

I am using PIXI.TextMetrics.measureText to check whethe the text will be accomodated in the given area or not. Based on the result I am changing the font size and performing word wrap operations.

But with this solution both will fail. And Example 2 will not be working

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.