]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
now PROPERLY apply draw_fontscale in TextWidth
authorRudolf Polzer <divverent@alientrap.org>
Thu, 24 Jun 2010 08:04:33 +0000 (10:04 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Thu, 24 Jun 2010 08:04:33 +0000 (10:04 +0200)
qcsrc/menu/draw.qc
qcsrc/menu/item/label.c

index 9e722cb12a89f1cfe4b2de43f87c0a046dd3f2d7..cec73d6c0a2f146d89b9298e21723d0976694442 100644 (file)
@@ -233,11 +233,9 @@ void draw_Text(vector theOrigin, string theText, vector theSize, vector theColor
        if(theSize_x <= 0 || theSize_y <= 0)
                error("Drawing zero size text?\n");
 
-       /*
-       float wi;
-       wi = draw_TextWidth(theText, ICanHasKallerz, theSize);
-       draw_Fill(theOrigin, '1 0 0' * wi + '0 1 0' * theSize_y, '1 0 0', 0.3);
-       */
+       //float wi;
+       //wi = draw_TextWidth(theText, ICanHasKallerz, theSize);
+       //draw_Fill(theOrigin, '1 0 0' * wi + '0 1 0' * theSize_y, '1 0 0', 0.3);
 
        if(ICanHasKallerz)
                drawcolorcodedstring(boxToGlobal(theOrigin, draw_shift, draw_scale), theText, globalToBoxSize(boxToGlobalSize(theSize, draw_scale), draw_fontscale), theAlpha * draw_alpha, 0);
@@ -257,7 +255,7 @@ float draw_TextWidth(string theText, float ICanHasKallerz, vector SizeThxBye)
        vector v;
        v = '0 0 0';
        //float r;
-       v_x = stringwidth(theText, ICanHasKallerz, boxToGlobalSize(SizeThxBye, draw_scale));
+       v_x = stringwidth(theText, ICanHasKallerz, globalToBoxSize(boxToGlobalSize(SizeThxBye, draw_scale), draw_fontscale));
        v = globalToBoxSize(v, draw_scale);
        return v_x;
 }
index 67db22a1b4e8896b4f9711c00ec36c7aa0638fa0..7ed6e4f68ef82daf3b33821aba270e691eba3a18 100644 (file)
@@ -74,6 +74,9 @@ void Label_draw(entity me)
        if(me.recalcPos)
                me.realOrigin_x = me.align * (1 - me.keepspaceLeft - me.keepspaceRight - min(draw_TextWidth(t, me.allowColors, me.realFontSize), (1 - me.keepspaceLeft - me.keepspaceRight))) + me.keepspaceLeft;
        me.recalcPos = 0;
+
+       //if(me.text == "Bookmark")
+       //      draw_Fill(me.realOrigin, '0 1 0' + '1 0 0' * draw_TextWidth(t, me.allowColors, me.realFontSize), '1 0 1', 1);
        
        if(me.fontSize)
                if(t)