fantasdic r321 - in trunk: . lib/fantasdic/ui



Author: mblondel
Date: Tue Aug 19 16:16:17 2008
New Revision: 321
URL: http://svn.gnome.org/viewvc/fantasdic?rev=321&view=rev

Log:
    * lib/fantasdic/ui/print.rb: Slice the word in the header if it's too long.
    This can happen when one enters a long sentence to translate with Google
    Translate.


Modified:
   trunk/ChangeLog
   trunk/lib/fantasdic/ui/print.rb

Modified: trunk/lib/fantasdic/ui/print.rb
==============================================================================
--- trunk/lib/fantasdic/ui/print.rb	(original)
+++ trunk/lib/fantasdic/ui/print.rb	Tue Aug 19 16:16:17 2008
@@ -185,7 +185,14 @@
         layout = cr.create_pango_layout
         layout.alignment = Pango::Layout::ALIGN_RIGHT
         layout.font_description = FONT_SMALL
-        layout.text = _("Definitions for %s") % @title + " - " + \
+
+        title = if @title.utf8_length > 30
+            @title.utf8_slice(0..27) + "..."
+        else
+            @title
+        end
+
+        layout.text = _("Definitions for %s") % title + " - " + \
                       _("Page %d/%d") % [nth_page, total_page]
         width, height = layout.size_points
         cr.move_to(page_width - width, height)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]