X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=xonstat%2Fbatch%2Fbadges%2Fskin.py;h=813594df2567cf560231bee4103556474cd991e7;hb=db7c9b5c125bf7c49a5dec583dd94f066214d8db;hp=40ae0eb3712cf80a09a758f52d608a64d9c6f74e;hpb=0d256103d30baad3e040a7ca8d6e2e92f678a346;p=xonotic%2Fxonstat.git diff --git a/xonstat/batch/badges/skin.py b/xonstat/batch/badges/skin.py index 40ae0eb..813594d 100644 --- a/xonstat/batch/badges/skin.py +++ b/xonstat/batch/badges/skin.py @@ -15,7 +15,7 @@ _dec_colors = [ (0.5,0.5,0.5), (1.0,1.0,0.0), (0.2,0.4,1.0), (0.2,1.0,1.0), - (1.0,0.2,102), + (1.0,0.2,0.4), (1.0,1.0,1.0), (0.6,0.6,0.6), (0.5,0.5,0.5) @@ -266,11 +266,11 @@ class Skin: # fontsize is reduced if width gets too large ctx.select_font_face(self.font, C.FONT_SLANT_NORMAL, C.FONT_WEIGHT_NORMAL) shrinknick = 0 - while shrinknick < 10: + while shrinknick < 0.6 * self.nick_fontsize: ctx.set_font_size(self.nick_fontsize - shrinknick) xoff, yoff, tw, th = ctx.text_extents(stripped_nick)[:4] if tw > self.nick_maxwidth: - shrinknick += 2 + shrinknick += 1 continue break @@ -310,12 +310,12 @@ class Skin: r,g,b = _dec_colors[int(tag[0])] else: r,g,b = _dec_colors[7] - + + xoff, yoff, tw, th = ctx.text_extents(txt)[:4] ctx.set_source_rgb(r, g, b) - ctx.move_to(self.nick_pos[0] + xoffset, self.nick_pos[1]) + ctx.move_to(self.nick_pos[0] + xoffset - xoff, self.nick_pos[1]) ctx.show_text(txt) - xoff, yoff, tw, th = ctx.text_extents(txt)[:4] tw += (len(txt)-len(txt.strip())) * space_w # account for lost whitespaces xoffset += tw + 2