lib/rabbit/renderer/print/cairo.rb in rabbit-2.1.3 vs lib/rabbit/renderer/print/cairo.rb in rabbit-2.1.4
- old
+ new
@@ -13,12 +13,10 @@
module Rabbit
module Renderer
module Print
class Cairo
include Engine::Cairo
- alias_method :cairo_rsvg_available?, :rsvg_available?
- alias_method :cairo_poppler_available?, :poppler_available?
include Base
class << self
def priority
if (::Cairo::VERSION <=> [1, 2, 0]) >= 0
@@ -26,11 +24,11 @@
else
-100
end
end
end
-
+
def initialize(canvas)
super
init_paper
init_color
end
@@ -42,23 +40,23 @@
def post_print(canceled)
return if canceled
@context.target.finish
end
-
+
def pre_parse
end
-
+
def post_parse
end
-
+
def post_apply_theme
end
-
+
def post_move(old_index, index)
end
-
+
def post_move_in_slide(old_index, index)
end
def internal_draw_slide(slide, simulation)
yield
@@ -73,26 +71,18 @@
def internal_draw_background(x=0, y=0, w=width, h=height)
draw_rectangle(true, x, y, w, h, @background)
end
- def rsvg_available?
- cairo_rsvg_available?
- end
-
- def poppler_available?
- cairo_poppler_available?
- end
-
private
def init_paper
default_width_mm = 360
default_height_mm = 270
@page_width = @paper_width || default_width_mm
@page_height = @paper_height || default_height_mm
end
-
+
def init_color
super
@foreground = make_color("black")
@background = make_color(@background_color)
end
@@ -124,9 +114,12 @@
::Cairo::PDFSurface.new(*args)
when /\.svg/i
surface = ::Cairo::SVGSurface.new(*args)
surface.restrict_to_version(::Cairo::SVG_VERSION_1_2)
surface
+ when /\.cs/i
+ args[0] = ::Cairo::ScriptDevice.new(args[0])
+ ::Cairo::ScriptSurface.new(*args)
else
@canvas.logger.warn(_("can't find printer for %s") % filename)
args[0] = "default.ps"
::Cairo::PSSurface.new(*args)
end