From fed2029d1f9b700d81a3ab5a6069312257db9132 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 7 Nov 2015 17:46:13 +0000 Subject: [PATCH] Truncate long player names in lobby. --- OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index a6ac86ca3d..4af9cf8755 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -291,7 +291,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic public static void SetupNameWidget(Widget parent, Session.Slot s, Session.Client c) { var name = parent.Get("NAME"); - name.GetText = () => c.Name; + var font = Game.Renderer.Fonts[name.Font]; + var label = WidgetUtils.TruncateText(c.Name, name.Bounds.Width, font); + name.GetText = () => label; } public static void SetupEditableSlotWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, Ruleset rules)