Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tacanvas.py
diff options
context:
space:
mode:
authorPootle daemon <pootle@pootle.sugarlabs.org>2013-12-12 05:30:30 (GMT)
committer Pootle daemon <pootle@pootle.sugarlabs.org>2013-12-12 05:30:30 (GMT)
commit2519aaafcf8346c8154f762bccb71ef249d82b73 (patch)
treec515a19161b88fd6bbec4051a67d5f3410ed1166 /TurtleArt/tacanvas.py
parent0f33843c9de1bcad835e80e896794d21d6e075bf (diff)
parent7fa8f0461713faacb2a54d30d507f65d7fe863f2 (diff)
Merge branch 'master' of git.sugarlabs.org:turtleart/mainline
Diffstat (limited to 'TurtleArt/tacanvas.py')
-rw-r--r--TurtleArt/tacanvas.py6
1 files changed, 5 insertions, 1 deletions
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', ' '))