]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
this may fix the word wrap issue, hopefully
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 22 Dec 2007 09:34:52 +0000 (09:34 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 22 Dec 2007 09:34:52 +0000 (09:34 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7835 d7cf8633-e32d-0410-b094-e92efae38249

console.c

index 82c35dd69729cbe91cb4001d5a76534738bd3eb1..a3d7bb5c19a93f1abe30360c4fd8f2ed255a44eb 100644 (file)
--- 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)