UMG TextBlock: Font won't scale.

Hi everyone,
I’ve set a TextBlock widget so it automatically scales according to the size of the viewport:

…as you can see, the boundaries of the widget appear to scale correctly, but the drawing scale of the font inside the TextBox does not :

I have noticed already that when using DrawText on Canvas, Runtime fonts wouldn’t scale, so in that case, I switched back to Offline fonts.

Unfortunately, UMG Textboxes only use Runtime fonts…

Am I missing something, here ?

Does anybody knows a workaround?

Is this issue fixed in 4.7 ? (I’m still using 4.6.1, here)

Thanks in advance, Have a nice day.

Hey,

How are you scaling your widget? Text in Slate will be scaled based on the widget scale when drawing, however if you’re just constricting the widget size, the text will start to clip (like what you’re seeing there).

With regards to Canvas - the Canvas scaling issue is fixed in 4.7 (scaling for runtime fonts just wasn’t implemented for 4.6), however Canvas just scales the rendered glyph texture rather than re-drawing the glyph at the newly scaled size (which is what Slate does). We did this as it matched the older offline (bitmap) font way of scaling fonts in Canvas, and avoids potentially spamming the font cache when drawing animating text (for which texture scaling is acceptable).

Thanks,
Jamie.

Wow Jamie, thanks for the hyper quick answer.
Glad to read that 4.7 fixes the Canvas DrawText scale issue.

About my UMG issue, I relied on the anchor to scale the widget, hoping that the content of the box would scale accordingly, which seems to be a very dumb thing to do.
I just figured out that the problem came from the project’s DPI scale curve.
I set it to “Horizontal” and made it linear. Now, it natively achieves the rescaling effect I expected without any additional awkward anchor tweaking.

Sorry for the noob question and thanks again for the answer.

Hey Jamie,
I just stepped to 4.7 today. I checked the FCanvasTextItem::DrawStringInternal_RuntimeCache() but I can’t see any code for scaling displayed text (Scale does about nothing in that function).
It is well implemented in FCanvasTextItem::DrawStringInternal_OfflineCache() though, for instance, you have :

float SizeX			= Char.USize * Scale.X;
const float SizeY	= Char.VSize * Scale.Y;

Am I missing something here ?

I’ve just checked my version of 4.7 and I’m seeing Scale used in FCanvasTextItem::DrawStringInternal_RuntimeCache:

const float X = DrawPos.X + LineX + (Entry.HorizontalOffset * Scale.X);
const float Y = DrawPos.Y + PosY - (Entry.VerticalOffset * Scale.Y) + (Entry.GlobalDescender * Scale.Y) + ScaledMaxHeight;
// ...
const float SizeX = Entry.USize * Scale.X;
const float SizeY = Entry.VSize * Scale.Y;
// ...

Ok, I see it when I get the 4.7 code from GitHub but it’s not in the release branch.
Also, when you simply install the 4.7 version from the launcher, you don’t see it.
Is that normal ?

I’ve just checked the file history, and it seems that this was only merged into 4.7 two days ago.

That explains why we can see it in the GitHub checkout, but not the 4.7 binary release. It will be part of the 4.7.1 release.

I see. Thanks for the answer.

I’ve tried it and it works fine, except that the mesh generated in the BatchElements are not displayed with linear smoothing. Those with offline fonts are.
So the display gets jaggy
as you scale down the text.
I posted a question on that matter : link here
Thanks already.