Browse Source

Deal with extra/no page issue with sprues

Also rename things so we number at zero.

Fixes #320
dev
Andy Meneely 5 years ago
parent
commit
0de6b31ad7
  1. 17
      CHANGELOG.md
  2. 16
      lib/squib/graphics/save_sprue.rb
  3. BIN
      samples/saves/save_sheet_rtl_01_expected.png
  4. 1
      samples/sprues/_builtin_sprues.rb
  5. 5
      samples/sprues/_fold_sheet.rb
  6. 0
      samples/sprues/advanced_sprues_00_expected.png
  7. 0
      samples/sprues/foldable_00_expected.png
  8. 0
      samples/sprues/sprue_a4_euro_card.yml_00_expected.png
  9. BIN
      samples/sprues/sprue_a4_poker_card_8up.yml_00_expected.png
  10. BIN
      samples/sprues/sprue_a4_poker_card_8up.yml_01_expected.png
  11. BIN
      samples/sprues/sprue_a4_poker_card_8up.yml_02_expected.png
  12. 0
      samples/sprues/sprue_a4_poker_card_9up.yml_00_expected.png
  13. 0
      samples/sprues/sprue_a4_usa_card.yml_00_expected.png
  14. 0
      samples/sprues/sprue_drivethrucards_1up.yml_00_expected.png
  15. 0
      samples/sprues/sprue_letter_poker_card_9up.yml_00_expected.png
  16. 1
      spec/samples/samples_regression_spec.rb

17
CHANGELOG.md

@ -4,7 +4,22 @@ Squib follows [semantic versioning](http://semver.org).
## v0.16.0 / Unreleased
Features:
* Autscaling text! `ellipsize: :autoscale` will now downscale your `font_size` if the text ellipsized. Thanks @Qgel! (#288, #111).
* Autoscaling text! `ellipsize: :autoscale` will now downscale your `font_size` if the text ellipsized. Thanks @Qgel! (#288, #111).
* Option checking!! Completely reworked the way we handle arguments in Squib internally (no external behavioral differences). Now, when you give an option to Squib that is not expected. Since every DSL method "knows" what options it takes, that also means we have EVERY option properly documented (missed a few...) AND we have an automated test that will tell us if we forget to document it.
Compatibility:
* When saving PNGs with sprues, outputs start counting at zero - which is more consistent with the rest of Squib.
Bugs:
* Extra page/no page issue with sprues (#320)
* Fix Ruby 2.7+ deprecations with CSV arguments (#303)
Chores:
* Reorganized the code internally. (#298) Every DSL method now has its own file.
* Moved to Github Actions
* Bump pango et al
## v0.15.3 / 2019-10-17

16
lib/squib/graphics/save_sprue.rb

@ -5,7 +5,7 @@ module Squib
def initialize(deck, tmpl, sheet_args)
@deck = deck
@tmpl = tmpl
@page_number = 1
@page_number = 0
@sheet_args = sheet_args # might be Args::Sheet or Args::SaveBatch
@overlay_lines = @tmpl.crop_lines.select do |line|
line['overlay_on_cards']
@ -39,7 +39,7 @@ module Squib
end
draw_overlay_above_cards cc
cc.target.finish
draw_final_page cc # See bug #320
end
end
@ -190,6 +190,11 @@ module Squib
cc
end
def draw_final_page(cc)
# PDF doesn't need to create a last page. See bug #320
cc.target.finish
end
def full_filename
@sheet_args.full_filename
end
@ -211,6 +216,13 @@ module Squib
cc
end
# The last page always gets written out for PNGs because they are separate
# files and don't get "flushed" automatically. See bug #320.
def draw_final_page(cc)
draw_page cc
cc.target.finish
end
def full_filename
@sheet_args.full_filename @page_number
end

BIN
samples/saves/save_sheet_rtl_01_expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

1
samples/sprues/_builtin_sprues.rb

@ -17,5 +17,6 @@ Squib::Deck.new(width: '50mm', height: '70mm', cards: 9) do
drivethrucards_1up.yml
).each do |builtin|
save_sheet sprue: builtin, prefix: "sprue_#{builtin}_"
save_pdf sprue: builtin, file: "sprue_#{builtin}_"
end
end

5
samples/sprues/_fold_sheet.rb

@ -22,6 +22,9 @@ Squib::Deck.new(width: '2.5in', height: '3.5in', cards: 8) do
text str: strings,font: 'Sans 32', align: :center, valign: :middle,
height: :deck, width: :deck
save_sheet prefix: 'foldable_',
sprue: 'letter_poker_foldable_8up.yml'
sprue: 'letter_poker_foldable_8up.yml' # built-in sprue
save_pdf file: 'foldable.pdf',
sprue: 'letter_poker_foldable_8up.yml' # built-in sprue
end

0
samples/sprues/advanced_sprues_01_expected.png → samples/sprues/advanced_sprues_00_expected.png

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

0
samples/sprues/foldable_01_expected.png → samples/sprues/foldable_00_expected.png

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

0
samples/sprues/sprue_a4_euro_card.yml_01_expected.png → samples/sprues/sprue_a4_euro_card.yml_00_expected.png

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 204 KiB

BIN
samples/sprues/sprue_a4_poker_card_8up.yml_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

BIN
samples/sprues/sprue_a4_poker_card_8up.yml_01_expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 KiB

After

Width:  |  Height:  |  Size: 53 KiB

BIN
samples/sprues/sprue_a4_poker_card_8up.yml_02_expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

0
samples/sprues/sprue_a4_poker_card_9up.yml_01_expected.png → samples/sprues/sprue_a4_poker_card_9up.yml_00_expected.png

Before

Width:  |  Height:  |  Size: 196 KiB

After

Width:  |  Height:  |  Size: 196 KiB

0
samples/sprues/sprue_a4_usa_card.yml_01_expected.png → samples/sprues/sprue_a4_usa_card.yml_00_expected.png

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 200 KiB

0
samples/sprues/sprue_drivethrucards_1up.yml_01_expected.png → samples/sprues/sprue_drivethrucards_1up.yml_00_expected.png

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

0
samples/sprues/sprue_letter_poker_card_9up.yml_01_expected.png → samples/sprues/sprue_letter_poker_card_9up.yml_00_expected.png

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

1
spec/samples/samples_regression_spec.rb

@ -68,5 +68,4 @@ describe 'Squib samples' do
expect(log.string).to eq(test_file_str)
end
end
end

Loading…
Cancel
Save