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.
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.
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.
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.
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?).
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).