I’ve been working on some scalable text for my in game HUD and I’ve run into a strange issue that I can’t source. When the text is drawn to the screen at certain resolutions it gets some weird dots, regardless of the font I use. Has anyone encountered this when using FCanvasTextItem?
.cpp function:
float ACGPlayerHUD::DrawScaledText(const FString & Text, FLinearColor TextColor, float ScreenX, float ScreenY, UFont * Font, float TextHeight, float Anchor)
{
FCanvasTextItem TextItem(FVector2D::ZeroVector, FText::GetEmpty(), Font, TextColor);
TextItem.Text = FText::FromString(Text);
TextItem.EnableShadow(FLinearColor::Black);
// Get the size of the text.
float SizeX, SizeY;
Canvas->StrLen(Font, Text, SizeX, SizeY);
// Compute the scale for the final text.
const float Scale = TextHeight / SizeY;
TextItem.Scale.Set(Scale, Scale);
// Anchor offset.
ScreenX = ScreenX - (SizeX * Scale * Anchor);
Canvas->DrawItem(TextItem, ScreenX, ScreenY);
return SizeX * Scale;
}
Attached is a screen shot of what I’m referring to. Not the white dots below the :.