Underscores for spaces

Hi there,

This is a longstanding text rendering issue drawing text using UCanvas::DrawItem. At certain screen resolutions I see underscores in spaces. Re-sizing the editor window seems to alter their intensity and can clear them or show them. Perhaps texture mip bleeding?

This has a huge impact on the quality of UI - any suggestions on how to get rid of them once and for all?

This may be due to scaling text during the draw calls. Because I have the same assets for iOS and at the moment the font is a compromise and a bit of scaling goes on to get it to look about right.

The effect is more noticeable with an outline enabled.

I moved this into Bug Reports. It’s still an issue for me - makes scaling text unusable.

Hello ,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Can you reproduce this issue in a clean project?
  2. If so, could you provide a detailed list of steps to reproduce this issue on our end?
  3. Could you provide a screen shot of any blueprints that may be involved?
  4. I notice that you said you are still having this issue, could you provide the engine version that you are using?

I’m on 4.9 but haven’t updated since the first version.

I’ll see if I can create this in a clean project - meanwhile the following code in a HUD derived class DrawHUD function reproduces the problem with a Roboto based 24pt font.

void AMM_HUD::DrawHUD()
{
	Super::DrawHUD();

	if (SmallMenuFont && Canvas)
	{
		FCanvasTextItem lvlLongTxt(FVector2D(10.0f, 10.0f), FText::FromString(_T("This is a test.")), SmallMenuFont, FLinearColor::White);
		lvlLongTxt.EnableShadow(FLinearColor::Black);
		lvlLongTxt.bOutlined = true;
		lvlLongTxt.OutlineColor = FLinearColor::Gray;
		lvlLongTxt.bCentreX = false;
		lvlLongTxt.bCentreY = false;
		lvlLongTxt.Scale.Set(1.0f, 1.0f);

		const float fHeight = UIResources::SmallMenuFont->GetMaxCharHeight();
		for (int i = 0; i < 10; i++)
		{
			lvlLongTxt.Scale *= 1.1f;
			lvlLongTxt.Position.Y += fHeight * lvlLongTxt.Scale.Y;
			Canvas->DrawItem(lvlLongTxt);
		}
      }
}

Here’s a minimal project. To get it up and running:

  1. Right click on the uproject and generate visual studio files

  2. Open the sln and right click on MyProject in the solution Explorer, set it as the Startup Project

  3. F5

  4. When the project is launched press play, the above code will be executed in MyHud.cpp and you’ll see underscores.

link text

Hey -

I tried copying the code you posted into another HUD class pproject to test and continued to get compile errors. Is there anything else that needs to be added to the code for the project to compile?

Sorry - that code won’t work on it’s own you’d need to feed it a font and replace the use of SmallMenuFont. In theory you can expand the zip file in my follow up post and follow the four instructional steps.

I have an example of text that I have added to the viewport using the HUD blueprint. This appears to work fine on my end. Could you try this and let me know if this works for you?

Example:

Hello ,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.

Sorry Rudy - for some reason I didn’t see your response.

My UI is bespoke and mainly in C++.

Pushing my text through blueprint is going to be a considerable refactor. A refactor that I suspect will make my UI slower due to the extra indirection of jumping in and out of script and one that will not address the bug I am seeing so others will likely hit it.

I did add addition information above - look at myproject.zip earlier in the thread.Can you confirm that this does or does not demonstrate the problem?

I was able to reproduce this in the project that was provided. However, I asked that you try the above blueprint to help determine where it is exactly that your issue in occurring. After looking over your issue. We have tried reproducing this issue on our end in a clean project but did not meet when success. Could you provide a detailed set of steps on how to reproduce this issue in a clean project?

Thank you for your response - glad you can at least see the problem!

When you say you tried recreating the problem in a clean project you mean you tried using c++ or blueprint to display text?

I have a workaround. Extending the y padding in the font allow the horizontal lines to be hidden.

They also disappear without antialiasing on however there are other artifacts that appear.