2956: Errors with GTKPrint on Ubuntu 9.04

svn: r12547
This commit is contained in:
Benny Malengier 2009-05-19 09:00:48 +00:00
parent b5f8ec1717
commit ac6ef2a9bc

View File

@ -589,8 +589,14 @@ class GtkPrint(libcairodoc.CairoDoc):
# give a dummy cairo context to gtk.PrintContext,
# PrintPreview will update it with the real one
try:
width = int(round(context.get_width()))
except ValueError:
width = 0
try:
height = int(round(context.get_height()))
except ValueError:
height = 0
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
cr = cairo.Context(surface)
context.set_cairo_context(cr, PRINTER_DPI, PRINTER_DPI)