DrawText - Font scaling issue

I am using DrawText (within a BP_HUD) to display text on screen.
I would like to display the text at different sizes but this presents a problem.

If I import the font at pt:16 it looks fine, but I cannot scale it up as it becomes blurred.
If I import the font at pt:72 it looks fine but is very big. If I scale it down it looks blurred/distorted.

Is there a way to display text correctly at any size without having to import the font multiple times at different pt sizes?

I have looked at the font details section but don’t know if anything in there can help.

  1. Dont use arial?

  2. Check for “kerning” inside font editor. Kerning is spacing between 2 characters

OR

  1. Use font size between 16 and 72?

“Dont use arial?”

The font type makes no difference, all fonts are either blurred or distored.
Some are worse than others but still noticable.

“Check for “kerning” inside font editor. Kerning is spacing between 2 characters”

Makes no difference. The issue is the character pixellation and not the spacing in between characters.

“Use font size between 16 and 72?”

Originally, I was using pt 36 as a median compromise as the artfacts are slighltly reduced, but there is still either blur or distortion if I try to scale up or down.

I suspect the issue is related to the act of resizing the baked font-to-texture image created after importing a font.

Unless UE staff know otherwise, think the only real solution is to import the actual font pt size required for display and never scale it.
This does mean having font duplicates at different sizes but can’t see another way to keep text crisp.

Also,

Could UE staff tell me the name of the default font (ttf?) used for DrawText when no font asset is specified?

It doesn’t seem to look like any of the fonts found in:

C:/Program Files/Unreal Engine/4.5/Engine/Content/Slate/Fonts

Hey ash22,

This is a known issue and we have it fixed internally (and on the bleeding-edge GitHub build). We’ll be including it in a future release. Thanks for your report!

As for the earlier question, you should always import text in the large form and then resize down to the appropriate size.

Regards,

Jonathan

Thanks. I look forward to the fixed version.

Could you tell me the name of the default font used for DrawText when no font asset is specified?

Have you checked the fonts in C:/Program Files/Unreal Engine/4.5/Engine/Content/EngineFonts ?

Aaah thanks, it is called SmallFont.uasset / TinyFont.uasset.

Unfortunately (as the names imply) they are indeed small/tiny and there is no corresponding ttf so a bigger font size (pt=72) can be created :frowning:

Let me know if I can have the ttf.

(I like the style/form and ‘courier new’ isn’t quite the same).

Can I assume this issue hasn’t been fixed yet?
I just checked UE4.6 and scaled text is still blurred.

The bug was fixed on our internal build when I checked. It may not have been ready and fully tested in time for 4.6.

Just to be sure: This is with downscaling, right? Upscaling (from a small font) will always be blurred - that’s not fixable.

“This is with downscaling, right?”

Yes. (I now use max font size 72 as recommended).

However, at pt72, scaling the font down to 0.25 still looks pretty gnarly.

I thought I could have default font size of 72 and scale down to any size whilst maintaining clarity. If this is not possible I suppose I could have duplicate fonts in several sizes but I was trying to avoid that redundancy if possible.

Let me know if you think pt72 at scale:0.25 should look like it does in the screenshot.

24142-scaledown.jpg

Btw, when Font Cache Type is set to RUNTIME the Legacy Font Size property allows the font to scale beautifully at any size, big or small.

This is exactly what I want but that property is in the font dialog.
As this setting is called ‘RUNTIME’ does that mean it can be also be changed from within a Blueprint?

The documentation on Fonts says that RUNTIME-type caching is a property of a font that you can change from the Font Editor, but it doesn’t mention blueprint accessibility (or any implication that you can change the setting at runtime). Is there a reason you’d need to set it at runtime?

“Is there a reason you’d need to set it at runtime?”

Scaling the RUNTIME font in the Font Editor (whether it be pt.7 or pt.72) does a much better job of preserving the font form/clarity than scaling an OFFLINE font in the DrawText node, which gets distorted as you can see from the screenshot above (though you did say that it may already be fixed but didn’t make it into the 4.6 release).

Nonetheless, if the RUNTIME font size could also be changed using the DrawText-[scale] parameter and scale text as nicely as it does in the font editor then it would solve all the problems.

It is possibe, however, that RUNTIME fonts are ‘supposed’ to scale just like OFFLINE fonts when used with DrawText. (It may simply be broken?).

See my bug report.

Hello ash22,

Here you may find default fonts specified to your project

You may find them in content browser here

Best wishes,

I just noticed that it does appear to be a soft bug.

In 4.6, if I create an Arial font in size pt24 it is:
(a) not crisp as it was in 4.5
(b) is slightly clipped at the bottom which was not the case in 4.5.

If I import the same sized font I previously created (and saved) in 4.5 it is looks ok. So, something about creating new offline fonts in 4.6 is broken.
Hopefully it will be fixed in 4.7 as I don’t want to reinstall 4.5 purely for font creation.

Scaling of runtime cached fonts in Canvas wasn’t hooked up for 4.6, but it should be in for 4.7 (I’ll double check this).

I should point out that scaling in Canvas just scales the rendered glyph texture (which produces poorer results than changing the font size - it’s okay for quick animations though).

I think a good idea here might be to expose the font size to DrawText so that you can override it (you can do this when using C++, so it makes sense to be able to do it via Blueprints too).

Was this resolved in 4.7?

no, same in 4.7 and 4.8.