From e278a828ebb381ba80b3981e4c0818135ede0f1d Mon Sep 17 00:00:00 2001 From: Jan Behrens Date: Sat, 29 Sep 2012 18:15:59 +0200 Subject: [PATCH] Improved (fixed?) the spacing between differently colored character groups in the playernick --- xonstat/batch/badges/skin.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xonstat/batch/badges/skin.py b/xonstat/batch/badges/skin.py index 813594d..70e6ef3 100644 --- a/xonstat/batch/badges/skin.py +++ b/xonstat/batch/badges/skin.py @@ -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 -- 2.39.2