Fixed infinite loop in WrapText if the line length is smaller than an individual character, text scale is taken into account in GUITextBlock wrapping

This commit is contained in:
Regalis
2017-03-27 21:08:14 +03:00
parent 9ef069bf61
commit 0e5de469d3
2 changed files with 25 additions and 16 deletions
+5 -5
View File
@@ -187,21 +187,21 @@ namespace Barotrauma
public void SetTextPos()
{
if (text==null) return;
if (text == null) return;
wrappedText = text;
Vector2 size = MeasureText(text);
if (Wrap && rect.Width>0)
if (Wrap && rect.Width > 0)
{
wrappedText = ToolBox.WrapText(text, rect.Width - padding.X - padding.Z, Font);
wrappedText = ToolBox.WrapText(text, rect.Width - padding.X - padding.Z, Font, textScale);
Vector2 newSize = MeasureText(wrappedText);
size = newSize;
}
if (LimitText && text.Length>1 && size.Y > rect.Height)
{
string[] lines = text.Split('\n');