]> de.git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/batch/badges/skin.py
Improved (fixed?) the spacing between differently colored character groups in the...
[xonotic/xonstat.git] / xonstat / batch / badges / skin.py
index 813594df2567cf560231bee4103556474cd991e7..70e6ef38cf4fd03e5ec65d6357ec0c4b1cb0f425 100644 (file)
@@ -275,8 +275,13 @@ class Skin:
             break
 
         # determine width of single whitespace for later use
-        xoff, yoff, tw, th = ctx.text_extents("_")[:4]
+        xoff, yoff, tw, th = ctx.text_extents("_ _")[:4]
         space_w = tw
+        xoff, yoff, tw, th = ctx.text_extents("__")[:4]
+        space_w -= tw
+
+        # this hilarious line should determine the spacing between characters
+        sep_w = int(0.25 * space_w)
 
         # split nick into colored segments
         xoffset = 0
@@ -317,7 +322,7 @@ class Skin:
             ctx.show_text(txt)
 
             tw += (len(txt)-len(txt.strip())) * space_w  # account for lost whitespaces
-            xoffset += tw + 2
+            xoffset += tw + sep_w
 
         ## print elos and ranks