Lopdo Posted October 1, 2015 Share Posted October 1, 2015 Hey there, I would like to have a single text object with multicolored text and various styles. I want to use it for chat, where name of user who posted message is highlighted with different color. This would be rather easy for single line or if the multiline text could be in separate "column", but since my space is very limited, I need to have the user's name as a part of the text so that new line starts where the name starts. You can see clearly what I mean in following screenshot (the part on the right side): Ideally I would like to be able to achieve the thing on the left as well (multiple styles wherever) The Text object supports only one style AFAIK, is there any workaround I could use (for example rendering DOM element into texture, I could use css to style my text and then render it to texture that would be displayed instead of the Text object)? Link to comment Share on other sites More sharing options...
rich Posted October 1, 2015 Share Posted October 1, 2015 Text objects support per-character colouring, so you could easily replicate what you posted in the screen shot above. Look at Text.addColor for details. in mono 1 Link to comment Share on other sites More sharing options...
Lopdo Posted October 2, 2015 Author Share Posted October 2, 2015 Wow, thanks, I don't know how I could miss that! there is even addFontStyle and addFontWeight, neat! I think I was too focused on setXY methods (habit from other frameworks) Link to comment Share on other sites More sharing options...
Recommended Posts