Merge in PR #272
Fix sheet size for 1-card-per-sheet PDFs and adjust coordinates when using trim #272dev
parent
cb66d7c31d
commit
1accadfc30
|
|
@ -19,7 +19,7 @@ dir
|
||||||
sprue
|
sprue
|
||||||
default: ``nil``
|
default: ``nil``
|
||||||
|
|
||||||
the sprue file to use. If ``nil``, then no sprue is used and the cards are laid out automatically using the parameters below. If non-nil, Squib checks for a built-in sprue file of that name. Otherwise, it attempts to open a file relative to the current directory. For more information on Squib Sprues, see :doc:`/sprues`.
|
the sprue file to use. If ``nil``, then no sprue is used and the cards are laid out automatically using the parameters below. If non-nil, Squib checks for a built-in sprue file of that name. Otherwise, it attempts to open a file relative to the current directory. For more information on Squib Sprues, see :doc:`/sprues`. If you use the trim function (see trim option below) the cards are placed considering coordinates reduced by the trim value. A special case is a sprue file which defines one card per sheet: If you use the trim option then the sheet size will be trimmed as well to remove the otherwise added white border in the PDF.
|
||||||
|
|
||||||
width
|
width
|
||||||
default: ``3300``
|
default: ``3300``
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,11 @@ module Squib
|
||||||
slot = slots[i % per_sheet]
|
slot = slots[i % per_sheet]
|
||||||
|
|
||||||
draw_card cc, card,
|
draw_card cc, card,
|
||||||
slot['x'], slot['y'],
|
slot['x'] - @sheet_args.trim,
|
||||||
|
slot['y'] - @sheet_args.trim,
|
||||||
slot['rotate'],
|
slot['rotate'],
|
||||||
slot['flip_vertical'], slot['flip_horizontal'],
|
slot['flip_vertical'], slot['flip_horizontal'],
|
||||||
@sheet_args.trim, @sheet_args.trim_radius
|
@sheet_args.trim, @sheet_args.trim_radius
|
||||||
|
|
||||||
bar.increment
|
bar.increment
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -160,11 +160,22 @@ module Squib
|
||||||
def init_cc
|
def init_cc
|
||||||
ratio = 72.0 / @deck.dpi
|
ratio = 72.0 / @deck.dpi
|
||||||
|
|
||||||
surface = Cairo::PDFSurface.new(
|
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,
|
full_filename,
|
||||||
@tmpl.sheet_width * ratio,
|
@tmpl.sheet_width * ratio,
|
||||||
@tmpl.sheet_height * ratio
|
@tmpl.sheet_height * ratio
|
||||||
)
|
)
|
||||||
|
end
|
||||||
|
|
||||||
cc = CairoContextWrapper.new(Cairo::Context.new(surface))
|
cc = CairoContextWrapper.new(Cairo::Context.new(surface))
|
||||||
# cc = Cairo::Context.new(surface)
|
# cc = Cairo::Context.new(surface)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue