[4.6.0]Change UMG text font size in-game

Got the same trouble and a workaround recently…

Which “kind” of widget is KeypadRef?

"IF" the text you’ll change the font for is a TextBlock you’ll need to create a new CustomTextBlock class (on C++) in such way you could access/change the Font variable after the widget get constructed, because until 4.6 it’s not exposed on post default editing situations.

If you get interested, go to “Add Code To Project”, pick the “UTextBlock” as base class and give a name as “TextBlockPlus”, when the engine offer to you the option to edit the class, accept.

on the .h file make something as this:

#pragma once

#include "Components/TextBlock.h"
#include "Runtime/SlateCore/Public/Fonts/SlateFontInfo.h"
#include "TextBlockPlus.generated.h"

/**
 * 
 */
UCLASS(BlueprintType)
class UTextBlockPlus : public UTextBlock
{
	GENERATED_BODY()
public:
	UTextBlockPlus(const FObjectInitializer&);
	

	UFUNCTION(BlueprintCallable, Category = "Customization")
	void SetANewFont(FSlateFontInfo NewFontInfo);	
};

after, make the .cpp as this:

#include "TextBlockPlus.h"

UTextBlockPlus::UTextBlockPlus(const class FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{

}

void UTextBlockPlus::SetANewFont(FSlateFontInfo NewFontInfo)
{
	Font = NewFontInfo;
	SynchronizeProperties();
}

Compile, go back to the editor…

If you replace your Standard TextBlocks on your widgets by your new TextBlockPlus they’ll have now a new Function that will allow you to change font and size at your will.

Hope this helps.