Browse Source

Fix extra page for PDF sprues

Fixes #246
dev
Andy Meneely 7 years ago
parent
commit
3d1f1ff989
  1. 1
      CHANGELOG.md
  2. 9
      lib/squib/graphics/save_sprue.rb
  3. 2
      samples/sprues/_hex_tiles.rb

1
CHANGELOG.md

@ -7,6 +7,7 @@ Squib follows [semantic versioning](http://semver.org).
Bugs:
* Fixed bug on circle and other shapes that had an extra stroke from a previous text call (#248)
* Fixed extra page on all sprue saves (#246)
Chores:
* Bumped deps: Pango et al. to 3.2.7, Cairo to 1.15.13.

9
lib/squib/graphics/save_sprue.rb

@ -29,16 +29,15 @@ module Squib
card = @deck.cards[i]
slot = slots[i % per_sheet]
draw_card cc, card,
slot['x'], slot['y'],
slot['rotate'],
draw_card cc, card,
slot['x'], slot['y'],
slot['rotate'],
@sheet_args.trim, @sheet_args.trim_radius
bar.increment
end
draw_overlay_above_cards cc
cc = draw_page cc
cc.target.finish
end
end
@ -61,7 +60,7 @@ module Squib
private
def next_page_if_needed(cc, i, per_sheet)
return cc unless (i != 0) && (i % per_sheet).zero?
return cc unless (i != 0) && (i % per_sheet) == 0
draw_overlay_above_cards cc
cc = draw_page cc

2
samples/sprues/_hex_tiles.rb

@ -7,7 +7,7 @@ Squib::Deck.new(width: '65.8mm', height: '76mm', cards: 9) do
)
text(
str: %w[One Two Three Four Five Six Seven Eight Nine],
x: '27mm', y: '35mm', width: '11.8mm', height: '6mm',
x: '22mm', y: '35mm', width: '21.8mm', height: '6mm',
align: :center, valign: :middle
)
save_pdf file: 'hex_tiles.pdf',

Loading…
Cancel
Save