Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TrimTextIfNeeded()

static void Terraria.Utils.TrimTextIfNeeded ( ref string text,
DynamicSpriteFont font,
float scale,
float maxWidth )
inlinestatic

Definition at line 723 of file Utils.cs.

724 {
725 int num = 0;
726 Vector2 vector = font.MeasureString(text) * scale;
727 while (vector.X > maxWidth)
728 {
729 text = text.Substring(0, text.Length - 1);
730 num++;
731 vector = font.MeasureString(text) * scale;
732 }
733 if (num > 0)
734 {
735 text = text.Substring(0, text.Length - 1) + "…";
736 }
737 }

References System.text.

Referenced by Terraria.UI.InGamePopups.PlayerWantsToJoinGamePopup.DrawInNotificationsArea().