Merge in PR #272

Fix sheet size for 1-card-per-sheet PDFs and adjust coordinates when
using trim #272
This commit is contained in:
Andy Meneely
2019-06-07 15:43:40 -04:00
parent cb66d7c31d
commit 1accadfc30
2 changed files with 20 additions and 9 deletions
+19 -8
View File
@@ -30,11 +30,11 @@ module Squib
slot = slots[i % per_sheet]
draw_card cc, card,
slot['x'], slot['y'],
slot['x'] - @sheet_args.trim,
slot['y'] - @sheet_args.trim,
slot['rotate'],
slot['flip_vertical'], slot['flip_horizontal'],
slot['flip_vertical'], slot['flip_horizontal'],
@sheet_args.trim, @sheet_args.trim_radius
bar.increment
end
@@ -160,11 +160,22 @@ module Squib
def init_cc
ratio = 72.0 / @deck.dpi
surface = Cairo::PDFSurface.new(
full_filename,
@tmpl.sheet_width * ratio,
@tmpl.sheet_height * ratio
)
slots = @tmpl.cards
per_sheet = slots.size
surface = if per_sheet == 1
Cairo::PDFSurface.new(
full_filename,
(@tmpl.sheet_width - 2 * @sheet_args.trim) * ratio,
(@tmpl.sheet_height - 2 *@sheet_args.trim) * ratio
)
else
Cairo::PDFSurface.new(
full_filename,
@tmpl.sheet_width * ratio,
@tmpl.sheet_height * ratio
)
end
cc = CairoContextWrapper.new(Cairo::Context.new(surface))
# cc = Cairo::Context.new(surface)