From 3d4c26ccfd8fc851b8dd34dab753d3dc70ea8160 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Fri, 13 Dec 2013 22:51:54 +0000 Subject: 194.4 --- (limited to 'TurtleArt/tacanvas.py') diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py index 4bac442..f37a3a4 100644 --- a/TurtleArt/tacanvas.py +++ b/TurtleArt/tacanvas.py @@ -305,10 +305,14 @@ class TurtleGraphics: ''' Draw text ''' def _draw_text(cr, label, x, y, size, width, scale, heading, rgb): + import textwrap + final_scale = int(size * scale) * pango.SCALE + label = str(label) + label = '\n'.join(textwrap.wrap(label, int(width / scale))) cc = pangocairo.CairoContext(cr) pl = cc.create_layout() fd = pango.FontDescription('Sans') - fd.set_size(int(size * scale) * pango.SCALE) + fd.set_size(final_scale) pl.set_font_description(fd) if isinstance(label, (str, unicode)): pl.set_text(label.replace('\0', ' ')) -- cgit v0.9.1