From bc61e36ac58f7c0e815a3e8048c833e0713c88f7 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 11 Apr 2020 15:47:33 +0200 Subject: [PATCH] actually append ellipsis to the right end --- MLEM/Font/GenericFont.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/MLEM/Font/GenericFont.cs b/MLEM/Font/GenericFont.cs index 0e82361..51993dd 100644 --- a/MLEM/Font/GenericFont.cs +++ b/MLEM/Font/GenericFont.cs @@ -59,8 +59,13 @@ namespace MLEM.Font { total.Append(text[i]); } - if (this.MeasureString(total).X * scale + ellipsisWidth >= width) - return total.Remove(fromBack ? 0 : total.Length - 1, 1).Append(ellipsis).ToString(); + if (this.MeasureString(total).X * scale + ellipsisWidth >= width) { + if (fromBack) { + return total.Remove(0, 1).Insert(0, ellipsis).ToString(); + } else { + return total.Remove(total.Length - 1, 1).Append(ellipsis).ToString(); + } + } } return total.ToString(); }