[Request] SRichTextBlock in UMG's TextBlock?

Hello,
First thing i’ll say is sorry if i selected thw wrong section when asking but i thought it’s related to c++.

Well let me explain. I’d like to get some rich text features inside umg: like different colors in the same text or different font sizes, or even fonts. I found that some people already asked for this but got low importance (looks like people think this is an strange feature to have). This is a feature that almost every RPG have, at least the different colors in a text.
It can be used for importance terms such as Names, Items, Important Locations, etc and so on.

This said i’ve been messing around with what Michael Noland said me in the Extending The Editor Topic in the Forums:

Check out SRichTextBlock, which lets
you define different styles and
alternate between them in a text
string. There are a bunch of examples
in STestSuite.cpp

static FText GetAroundTheWorldIn80Days_Rainbow()
	{
		return FText::FromString(
			TEXT("<Rainbow.Text.Red>\"</><Rainbow.Text.Orange>I</> <Rainbow.Text.Yellow>know</> <Rainbow.Text.Green>it;</> <Rainbow.Text.Blue>I</> <Rainbow.Text.Red>don't</> <Rainbow.Text.Orange>blame</> <Rainbow.Text.Yellow>you.</>  <Rainbow.Text.Green>We</> <Rainbow.Text.Blue>start</> <Rainbow.Text.Red>for</> <Rainbow.Text.Orange>Dover</> <Rainbow.Text.Yellow>and</> <Rainbow.Text.Green>Calais</> <Rainbow.Text.Blue>in</> <Rainbow.Text.Red>ten</> <Rainbow.Text.Orange>minutes.</>\"")
			TEXT("\n\n")
			TEXT("<Rainbow.Text.Yellow>A</> <Rainbow.Text.Green>puzzled</> <Rainbow.Text.Blue>grin</> <Rainbow.Text.Red>overspread</> <Rainbow.Text.Orange>Passepartout's</> <Rainbow.Text.Yellow>round</> <Rainbow.Text.Green>face;</> <Rainbow.Text.Blue>clearly</> <Rainbow.Text.Red>he</> <Rainbow.Text.Orange>had</> <Rainbow.Text.Yellow>not</> <Rainbow.Text.Green>comprehended</> <Rainbow.Text.Blue>his</> <Rainbow.Text.Red>master.</>")
			TEXT("\n\n")


...

SNew( SRichTextBlock)
.Text( RichTextHelper::GetAroundTheWorldIn80Days_Rainbow() )
.TextStyle( FTestStyle::Get(), "Rainbow.Text" )
.DecoratorStyleSet( &FTestStyle::Get() )
.WrapTextAt( 600 )

I’ve been trying to replicate what’s inside STestSuite.cpp in the Rainbow.Text part with no luck. Looks like my C++ skills are too bad yet to get on this level.
So What i’m asking is could anyone please tell me how can i add that kind of features to the UMG’s TextBlock? Let say i add the Textblock in a widget to show up some dialogue. The text could look like this:
“Hello, my name is Alan, bring me some Potion and I’ll tell you how you can go to the Capital.”
In this case just the word right beside the gets the color specified. Or rather:
“Hello, my name is Alan, bring me some Potion and I’ll tell you how you can go to the Capital.”
In this case everytime you set the color is changed for the rest of the text.

Is this possible at all? (In some other low-engines like RPGMaker or GameMaker this is really easy to achieve).

For me it looks strange after so much time noone did something like this even for the marketplace :stuck_out_tongue: (i’d like to do it if i had the knowledge).

Thank you very much for your time and for your help in advance.

id also like to see a way to add button icons into the text, like (A) (B) (<) (>), and insert variable names, like the player’s name or important game items.

in zelda games, they even have text formatting options for some text to be skippable, or typewrite slowly, or wait for player input, or yes/no choices. it doesn’t have to go that far, but having a multicolored typewriting text with input icons built in would be awesome.

http://www.zeldalegends.net/files/emulation/dumps/zelda64/usa/z64dump(usa).html
http://www.zeldalegends.net/files/emulation/dumps/zelda64/z64dump(table).txt

If you sync mainline an experimental bit of work has been started to expose the SRichTextBlock to UMG as a new Widget. There’s no timeline for finishing it, it’s purely an as I have time bit of research.

Indeed that is another feature that most of the rpg’s texboxes have. For the game items or player’s names would be a matter of using some similar input to FText: {var} (at least that is how it works in bps)

Thank you for letting me know Nick!
Based on what you said i suposse we can’t expect it to be implemented in 4.8 yet right?
It’s a shame because i really gonna need it soon (Tbh i need it already but i decided to work in others aspects of the game to see if in the meantime any solution is found but i’m getting closer to the moment when i need it)

No, it wont be anywhere near done in 4.8. It’s extremely bare-bones. I’d recommend looking at the code and cloning it and making your own version. Don’t wait for us to finish something your game depends on :slight_smile:

All right, i’ll try. Could you please point me to where exactly is that new code? (file/folder)

Engine\Source\Runtime\UMG\Private\Components\RichTextBlock.cpp
Engine\Source\Runtime\UMG\Private\Components\RichTextBlockDecorator.cpp

Oh there! thank you very much Nick! :slight_smile:

Any progress on this widget?
2 years have passed and it’s still not part of the defaul Unreal Engine installation :-/ (4.16)