diff --git a/Blish HUD/_Utils/DrawUtil.cs b/Blish HUD/_Utils/DrawUtil.cs index 1233b5823..91e0aff84 100644 --- a/Blish HUD/_Utils/DrawUtil.cs +++ b/Blish HUD/_Utils/DrawUtil.cs @@ -47,17 +47,19 @@ private static string WrapTextSegment(BitmapFont spriteFont, string text, float string[] words = text.Split(' '); var sb = new StringBuilder(); float lineWidth = 0f; - float spaceWidth = spriteFont.MeasureString(" ").Width; + float spaceWidth = spriteFont.MeasureString(" ").Width - spriteFont.MeasureString(" ").Width; + float aWidth = spriteFont.MeasureString("a").Width; foreach (string word in words) { - Vector2 size = spriteFont.MeasureString(word); + float wordWidth = spriteFont.MeasureString("a" + word).Width - aWidth; + wordWidth = Math.Max(wordWidth, spriteFont.MeasureString(word + "a").Width - aWidth); - if (lineWidth + size.X < maxLineWidth) { + if (lineWidth + wordWidth < maxLineWidth) { sb.Append(word + " "); - lineWidth += size.X + spaceWidth; + lineWidth += wordWidth + spaceWidth; } else { sb.Append("\n" + word + " "); - lineWidth = size.X + spaceWidth; + lineWidth = wordWidth + spaceWidth; } }