From 98a8de78b00646eb1674620e22becd243412d17c Mon Sep 17 00:00:00 2001
From: divverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Sat, 22 Dec 2007 09:34:52 +0000
Subject: [PATCH] this may fix the word wrap issue, hopefully

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7835 d7cf8633-e32d-0410-b094-e92efae38249
---
 console.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/console.c b/console.c
index 82c35dd6..a3d7bb5c 100644
--- a/console.c
+++ b/console.c
@@ -1180,7 +1180,16 @@ float Con_WordWidthFunc(void *passthrough, const char *w, size_t *length, float
 		ti->colorindex = -1;
 		return ti->fontsize * ti->font->width_of[0];
 	}
-	return DrawQ_TextWidth_Font_UntilWidth(w, length, false, ti->font, maxWidth) * ti->fontsize;
+	if(maxWidth >= 0)
+		return DrawQ_TextWidth_Font_UntilWidth(w, length, false, ti->font, maxWidth / ti->fontsize) * ti->fontsize;
+	else if(maxWidth == -1)
+		return DrawQ_TextWidth_Font(w, *length, false, ti->font) * ti->fontsize;
+	else
+	{
+		printf("Con_WordWidthFunc: can't get here (maxWidth should never be %f)\n", maxWidth);
+		// Note: this is NOT a Con_Printf, as it could print recursively
+		return 0;
+	}
 }
 
 int Con_CountLineFunc(void *passthrough, const char *line, size_t length, float width, qboolean isContinuation)
-- 
2.39.5