add save_sheet rtl option for duplex printing
parent
a55300f844
commit
695bd8fb77
|
|
@ -51,5 +51,10 @@ trim
|
||||||
|
|
||||||
the space around the edge of each card to trim (e.g. to cut off the bleed margin for print-and-play). Supports :doc:`/units`.
|
the space around the edge of each card to trim (e.g. to cut off the bleed margin for print-and-play). Supports :doc:`/units`.
|
||||||
|
|
||||||
|
rtl
|
||||||
|
default ``false``
|
||||||
|
|
||||||
|
whether to render columns right to left, used for duplex printing of card backs
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
--------
|
--------
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ module Squib
|
||||||
trim_radius: 38,
|
trim_radius: 38,
|
||||||
trim: 0,
|
trim: 0,
|
||||||
width: 3300,
|
width: 3300,
|
||||||
|
rtl: false,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@ module Squib
|
||||||
cc = Cairo::Context.new(Cairo::ImageSurface.new(sheet_width, sheet_height))
|
cc = Cairo::Context.new(Cairo::ImageSurface.new(sheet_width, sheet_height))
|
||||||
num_this_sheet = 0
|
num_this_sheet = 0
|
||||||
sheet_num = 0
|
sheet_num = 0
|
||||||
x, y = sheet.margin, sheet.margin
|
y = sheet.margin
|
||||||
|
x = sheet.rtl ? (sheet_width - sheet.margin - sheet.gap - @width) : sheet.margin
|
||||||
@progress_bar.start("Saving PNG sheet to #{batch.summary}", @cards.size + 1) do |bar|
|
@progress_bar.start("Saving PNG sheet to #{batch.summary}", @cards.size + 1) do |bar|
|
||||||
range.each do |i|
|
range.each do |i|
|
||||||
if num_this_sheet >= (sheet.columns * sheet.rows) # new sheet
|
if num_this_sheet >= (sheet.columns * sheet.rows) # new sheet
|
||||||
|
|
@ -18,16 +19,17 @@ module Squib
|
||||||
new_sheet = false
|
new_sheet = false
|
||||||
num_this_sheet = 0
|
num_this_sheet = 0
|
||||||
sheet_num += 1
|
sheet_num += 1
|
||||||
x, y = sheet.margin, sheet.margin
|
y = sheet.margin
|
||||||
|
x = sheet.rtl ? (sheet_width - sheet.margin - sheet.gap - @width) : sheet.margin
|
||||||
cc = Cairo::Context.new(Cairo::ImageSurface.new(sheet_width, sheet_height))
|
cc = Cairo::Context.new(Cairo::ImageSurface.new(sheet_width, sheet_height))
|
||||||
end
|
end
|
||||||
surface = trim(@cards[i].cairo_surface, sheet.trim, @width, @height)
|
surface = trim(@cards[i].cairo_surface, sheet.trim, @width, @height)
|
||||||
cc.set_source(surface, x, y)
|
cc.set_source(surface, x, y)
|
||||||
cc.paint
|
cc.paint
|
||||||
num_this_sheet += 1
|
num_this_sheet += 1
|
||||||
x += surface.width + sheet.gap
|
x += (surface.width + sheet.gap) * (sheet.rtl ? -1 : 1)
|
||||||
if num_this_sheet % sheet.columns == 0 # new row
|
if num_this_sheet % sheet.columns == 0 # new row
|
||||||
x = sheet.margin
|
x = sheet.rtl ? (sheet_width - sheet.margin - sheet.gap - @width) : sheet.margin
|
||||||
y += surface.height + sheet.gap
|
y += surface.height + sheet.gap
|
||||||
end
|
end
|
||||||
bar.increment
|
bar.increment
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue