[UMG] How can I change the font at run ?

I’ve seen a few posts about this topic, but they were specific to font size and were never resolved. I would like to change the font size, bold, italic, and font-face at runtime (without C++).

I aim to make a dialogue system that parses text strings for font tags (eg. This isBold).
Is this possible or at least a planned feature? Thanks in advance :slight_smile:

Edit: This is for a Text Widget

1 Like

I’m still trying to get this working, has anyone attempted this?

Same here…

Same here! Epic, What’s up?

Could you not set up an Array of different Fonts and call the one you need?

Unfortunately, I haven’t found a way to change the font on a text widget in blueprint. Some things in UMG can be ‘binded’ to a getter function to change the brush settings, but text widget fonts don’t have this flexibility. There’s also now ‘setter’ exposed to blueprint, so I wouldn’t be able to apply the font to the text item.

Am really wating for this important thing!

Late reply, but this AnswerHub question was the first hit result on searching for it. I was searching for the same thing.

In UE4.15 (and likely any prior version) there is no specific property to set the font style (such as “Set Font Bold”). However, using the node “Set Font” of a (Text) Widget lets you enter a font name. This font name is exactly the name of the dropdown you specificy in the details panel. A bit irritating but that’s how it works. “Set Font” shouldn’t be confused with the actually font family. The Font Info structure has a Font and Font Family property.

For applying a bold and italic style of a font family having these fonts (such as Roboto):

You can receive the name of the desired font by opening the font asset or by copying the property in the details panel, right-click and choose copy. Paste it into a text editor, the content will have a sting of TypefaceFontName specificing the name. This is generally the same as the dropdown display but just in case it differs.

(FontObject=Font’/Engine/EngineFonts/Roboto.Roboto’,FontMaterial=None,OutlineSettings=(OutlineSize=0,OutlineMaterial=None,OutlineColor=(R=0.000000,G=0.000000,B=0.000000,A=1.000000),bSeparateFillAlpha=False),TypefaceFontName=“Italic”,Size=18,FontName=“”,Hinting=Default)

The standard names for the Roboto font are:

  • Bold
  • Bold Italic
  • Italic
  • Light
  • Regular

These styles are setup in the actual font asset and may differ from font to font.

I aim to make a dialogue system that parses text strings for font tags (eg. This isBold).

I don’t think the UMG widget text renderers (or Slate) does allow such thing. It was possible in UE3 but I haven’t found a documentation about a similar feature in UE4.

What you can do as a workaround. Parse the text and split it into chunks. Each chunk will be dynamically converted into single separate text widget (created on runtime) and added to a Wrap box.

So a text of “This text has a bold segment.” become:
<TextWidget>This text has a </TextWidget><TextWidget Font=“Bold”>bold</TextWidget><TextWidget> segment.</TextWidget>

Result:
This text has a bold segment.

3 Likes

In unreal engine 5.3 Set Font is not working.

2 Likes