What's the deal with weird text artifacts?

Whenever I import a font it appears normal within the font editor.

The preview window correctly shows “The quick brown fox jumps over the lazy dog”.

However when I use my font in game I get what looks like broken text or symbols. I followed the font guide exactly, and I"m just importing a font from Windows.

Could you post some screenshots how it looks in game?

I know what you mean.
Happens to me also all the times.
When the font gets rendered with the TextRender component it somehow fetches the glyphs from the wrong positions.
If you use offline caching for the font, the nyou can access the glyph location array in the details panel. Just check where UE4 thinks the glyphs are.
So what you are seeing are “random” patches of the font texture, which makes it look like alien sanskrit…
I havent found a solution either :frowning:

KVogler, solution for your issue is quite simple. You need to create your own Material to be used with your font. You may copy DefaultTextMaterialOpaque (it is on your screenshot on TextRenderComponent), rename it and change font it is using to be your font.
This solution was explained here on Answerhub
Hope this will help.

Hmkay will try that :o
… Right after preview 2 finishes updating :stuck_out_tongue:

I modified the material to be Masked Unlit since it’s a 2D game. This seems to work fine for the default robotodistancefield font but when I change to my font the material just shows up as a white circle, and the font itself is a black block when used in viewport.

The only immediate difference I’m noticing between my font and the robotodistancefield is that mine looks normal as shown in the ftFixedsys screencap while robotodistancefield has a blurry outline and has “Use Distance Field Alpha” checked. I’m wondering if that’s part of the issue?

Yeah, that may be a part of the issue. Every time you change something in your Font settings, you have to save and then reimport that asset, so editor will actually regenerate atlas texture.
You also need “Use Distance Field Alpha” enabled on your font to be useable with TextRender component.

Being a 2D game I don’t see why I would need distance field. Is there a better way to display font on my project without having to jump through all these hoops that don’t seem to be working anyway?

There are 2 ways to bring text into your game (actually 3, but using AHUD functions is a bit outdated):
— TextRender component. It can be placed in arbitrary place in your world, so text will be moving on screen as you move the camera. Requires Distance Field Font and a Material to work.
— UMG / Slate widgets. It can be placed in arbitrary place on your screen, so if you need to attach text to some object in world, you’d have to move the widget by yourself. Requires NON Distance Field Font to work.

It’s up to you to determine what better suits your game.

The text will be sliding in and out on occasion so I probably need to use a textrender. I’m not sure that it’s entirely a distance field issue though. Why would the material show up as a white circle instead of as a texture with the font like the built in robotodistancefield text does?

EDIT AGAIN: Think I figured it out, testing and will post solution.

I’m still waiting on some stuff to compile and if it all works out I’ll follow up with pics and steps.

Here’s the steps I took to make this work. I used what Druha said to ultimately figure it out.

You begin by importing your font for Offline use. You can either import it using the content browser or by creating a new Font Asset. See Text Formatting and Fonts in UMG for Unreal Engine | Unreal Engine 5.0 Documentation for information on this.

If you’re first making a Font Asset and importing from your system you will be prompted to choose a font size, type, and the font itself. For a reason unknown to me if I set the size as 22 or higher the font becomes chopped up, but 20 seems safe. Keep in mind the larger you set the font size to the longer it will take to complete the next step. But, larger sizes seem to do better when using larger font size in your game.

After you see your font without any effects scroll down under Offline Font details and click “Use Distance Field Alpha”.
Note: I had already applied the Use Distance Field Alpha effect on the image below. See the image right after this one for what your font should look like right after importing.

Save your font, then click Assets near the top, and Reimport font …

Once the reimport finishes your font should be blurred around the borders of each letter.

Save your font again and now create a new material, or make a duplicate of DefaultTextMaterialOpaque and change the font within it to your own.

For mine I made a Surface, Masked, Unlit material since I’m making a 2D game. I set the font to the font asset I just made.

After saving my material I went to my TextRenderer and set the material to the one I made, and the font to the font asset that was previously imported.