Jump to content

Multi style text


Digital Ronin
 Share

Recommended Posts

How can I manuly apply two different styles to text?

For example:    Simple Text

 

My code:

const text = new PIXI.Text('Simple Text');
text .style = new PIXI.TextStyle ({
                       fill: 0x2d2c2f,
                       fontSize:20
                   });
Edited by Digital Ronin
Link to comment
Share on other sites

1 hour ago, ivan.popelyshev said:

Same question was asked 2 days ago in https://github.com/pixijs/pixi.js/issues/6323

Thanks for replay. I found that solution with multystyle repo but it is not compatible with pixi v5. Is there a way to do it manualy, without library, I need it only for one line of text. 

Edited by Digital Ronin
Link to comment
Share on other sites

That one? https://github.com/tleunen/pixi-multistyle-text , not compatible with v5? You sure? Because @themoonrat thinks its compatible. Please confirm that  plugin did not work for you and needs to be fixed.

No, there's no packaged solution in pixijs.

Edited by ivan.popelyshev
Link to comment
Share on other sites

6 hours ago, ivan.popelyshev said:

That one? https://github.com/tleunen/pixi-multistyle-text , not compatible with v5? You sure? Because @themoonrat thinks its compatible. Please confirm that  plugin did not work for you and needs to be fixed.

No, there's no packaged solution in pixijs.

I tried to work with that plugin, but couldn't get it work since it required v4. Maybe I did something wrong, since I'm still newbie. Also you can check on this page https://github.com/tleunen/pixi-multistyle-text/issues/83

Edited by Digital Ronin
Link to comment
Share on other sites

2 minutes ago, ivan.popelyshev said:

OK, then it looks like you have to convert one of those two repos or wait while someone else does it.

Or you can do one small string manually.

Yes, I would like to do it manually. I asked in this post how, since I couldn't find it. Can you show me on my code example? I think shoudn't be complicated, but i simply couldnt find it. I found that learning pixi from their documentation is a bit hard, since there is no much explanation. Thanks in advanece

 

Link to comment
Share on other sites

it the good way to do, it will depending of your need.
s1iSEfwq_o.gif
In simple context , if you need something very simple you can use without regex

PIXI.TextMetrics.measureText()

Metric are a pixi tool very powerful and can split for you arrays for you multistyle.


Or in complexe a example, on my side i use regex to split string, and build a container and sprites with multiple text styles and motions worked with wordWrap!
If this can help you to get a idea, here how i proceed on my side.
https://github.com/djmisterjon/ANFT/blob/1bfda5a7a047ee2dcc963c59873f5f0b65b7c24c/js/game/global/texts.js#L239

Edited by jonforum
Link to comment
Share on other sites

22 hours ago, jonforum said:

it the good way to do, it will depending of your need.
s1iSEfwq_o.gif
In simple context , if you need something very simple you can use without regex

PIXI.TextMetrics.measureText()

Metric are a pixi tool very powerful and can split for you arrays for you multistyle.


Or in complexe a example, on my side i use regex to split string, and build a container and sprites with multiple text styles and motions worked with wordWrap!
If this can help you to get a idea, here how i proceed on my side.
https://github.com/djmisterjon/ANFT/blob/1bfda5a7a047ee2dcc963c59873f5f0b65b7c24c/js/game/global/texts.js#L239

Sorry for late response. I needed it for just for one line of text, so I did it manually with relative positioning. Anyway I would like to check and learn other methods, but this link you sent me is not active. Thanks anyway. 

Link to comment
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...
 Share

  • Recently Browsing   0 members

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