From 63092758d5d458c69994b18a9e37507a4e98f47d Mon Sep 17 00:00:00 2001 From: "Jan D. Behrens" Date: Tue, 28 Aug 2012 00:38:30 +0200 Subject: [PATCH] Improved handling of whitespace in playernicks --- xonstat/batch/badges/gen_badges.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xonstat/batch/badges/gen_badges.py b/xonstat/batch/badges/gen_badges.py index d554560..efd00f0 100644 --- a/xonstat/batch/badges/gen_badges.py +++ b/xonstat/batch/badges/gen_badges.py @@ -262,6 +262,8 @@ def render_image(data): xoff, yoff, tw, th = ctx.text_extents(stripped_nick)[:4] if tw > NICK_MAXWIDTH: ctx.set_font_size(12) + xoff, yoff, tw, th = ctx.text_extents("_")[:4] + space_w = tw # split up nick into colored segments and draw each of them @@ -306,7 +308,7 @@ def render_image(data): ctx.show_text(txt) xoff, yoff, tw, th = ctx.text_extents(txt)[:4] - tw += (len(txt)-len(txt.strip()))*3 # account for lost whitespaces + tw += (len(txt)-len(txt.strip())) * space_w # account for lost whitespaces xoffset += tw + 2 -- 2.39.2