I’m getting the length of a string like this:
int32 StringSizeX;
int32 StringSizeY;
UCanvas::ClippedStrLen(Cast<const UFont>(FontToUse), 1.f, 1.f, StringSizeX, StringSizeY, *TextToDraw.ToString());
I then offset the draw position for my string so it’s right aligned and draw it to the screen.
I’m using a run-time font object as I want to support non-English characters so I’m not sure if this problem exists with offline fonts.
This isn’t specific to the font I’m using as this behavior occurs with Roboto and several others I have on hand.
Any small non-alpha-numeric characters like !,.’ etc cause the calculated string length to be longer than it is when it’s actually drawn to screen.
You can see the issue below. All I’ve changed is the text being drawn.
The very odd part is that the string size with these special characters is even larger than when they are replaced with X (the largest character).