From 72d3f95801f76bb59c26cd9ee86cc9750532ccfe Mon Sep 17 00:00:00 2001 From: Serge Noiraud Date: Sun, 14 Oct 2012 21:12:56 +0000 Subject: [PATCH] Geography : split messages lines at the beginning of a word when resizing. svn: r20555 --- gramps/plugins/lib/maps/messagelayer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gramps/plugins/lib/maps/messagelayer.py b/gramps/plugins/lib/maps/messagelayer.py index f3ef1ba78..bf9146656 100644 --- a/gramps/plugins/lib/maps/messagelayer.py +++ b/gramps/plugins/lib/maps/messagelayer.py @@ -135,7 +135,9 @@ class MessageLayer(GObject.GObject, osmgpsmap.MapLayer): while ( width > d_width ): line_length = len(line_to_print) character_length = int(width/line_length) + 1 - max_length = int(d_width / character_length) - 5 + max_length = int(d_width / character_length) - 1 + while line_to_print[max_length] != ' ': + max_length -= 1 # cut the line at a new word ctx.move_to(coord_x, coord_y) ctx.show_text(line_to_print[:max_length]) line_to_print = line_to_print[max_length:]