How to change Slate default font

How can we make all STextBlock widgets use a default Font Asset (not Roboto)? We want to use built-in Slate editor widget classes like SHeaderRow, but many do not accept font or style attributes that can be passed down to the STextBlocks inside.

Picture1

(This is inside SHeaderRow.cpp, showing that there is no font given to the STextBlock label.)
Further, it would be impractical to add a “.Font(fontInfo)” every place we create STextBlocks. As far as I can trace it, the default font is stored in this write-protected engine file:

Picture2

We are using Unreal Engine 4.26.2, so we can’t use the Common UI plugin as suggested here: https://forums.unrealengine.com/t/how-do-i-change-the-default-roboto-font-across-all-text-in-user-widget/1221172

How can we hook up a Font Asset to these text blocks by default?

The default style is used when there is no valid widget provided to.
You can create your own SHeaderRow instance with your own style and set it as a header in another widget, such as STableView or STreeView,

It is true that SHeaderRow does take a style argument, but it never passes a font to the underlying STextBlock, as shown in my first screenshot. This is why I believe it is impossible to pass a font to SHeaderRow or any class deriving from SHeaderRow.

To clarify, my question is not about SHeaderRow specifically, but about STextBlock. I’m looking for a universal way to change the default font of all STextBlocks everywhere, regardless of the widgets that contain or construct them.

But this TextBlock is only created when no content widget is provided.

I’ve never done that. Have you tried:

  • create own slate style & register it with FSlateStyleRegistry
  • call FAppStyle::SetAppStyleSetName("YourStyleName")
    ?

It looks like FAppStyle is what I was looking for. Unfortunately, my project is in UE 4.26, so FAppStyle is not available.

In 4.26, STextBlock grabs the “NormalText” style from FCoreStyle by default when no custom style is passed:

This “NormalText” style is initialized in FCoreStyle::Create(...). It appears impossible to change this “NormalText” style by any means, since the getter returns a const reference and the setter is private:


I believe that changing the slate font universally in 4.26 is impossible without explicitly passing the style in every place where STextBlock is constructed or making a custom TextBlock widget. I would love to be shown otherwise, though.