From d4cd7897ab5f4eab249040a558359a68e32212ed Mon Sep 17 00:00:00 2001 From: Andy Meneely Date: Wed, 1 Apr 2015 10:12:16 -0400 Subject: [PATCH] Catching the error and printing the current cairo matrix --- lib/squib/graphics/text.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/squib/graphics/text.rb b/lib/squib/graphics/text.rb index 2422b10..ce489d2 100644 --- a/lib/squib/graphics/text.rb +++ b/lib/squib/graphics/text.rb @@ -161,10 +161,15 @@ module Squib cc.move_to(0, vertical_start) cc.update_pango_layout(layout) - cc.save cc.show_pango_layout(layout) - cc.restore - embed_draws.each { |ed| ed[:draw].call(self, ed[:x], ed[:y] + vertical_start) } + begin + embed_draws.each { |ed| ed[:draw].call(self, ed[:x], ed[:y] + vertical_start) } + rescue Exception => e + puts "====EXCEPTION!====" + puts "Cairo matrix: #{cc.get_matrix}" + puts e + puts "==================" + end draw_text_hint(cc, x, y, layout, hint, angle) extents = { width: layout.extents[1].width / Pango::SCALE, height: layout.extents[1].height / Pango::SCALE }