sprues: polishing up the feature

Lots of examples, some better checking, lots of documentation, sanity tests. Lots of little stuff.
This commit is contained in:
Andy Meneely
2017-10-05 15:48:57 -04:00
parent 3ccc6432ab
commit 06970b77a6
19 changed files with 208 additions and 170 deletions
+6 -5
View File
@@ -1,18 +1,19 @@
require 'squib'
Squib::Deck.new(cards: 8) do
Squib::Deck.new(width: '50mm', height: '70mm', cards: 9) do
background color: :white
rect stroke_width: 5, stroke_dash: '7 7'
text str: %w(First Second Third Fourth Fifth Sixth Seventh Eighth),
rect stroke_width: 5, stroke_color: :red
text str: (0..9).map{ |i| "Card! #{i}\n50x77mm" },
font: 'Sans 96', align: :center, valign: :middle,
height: :deck, width: :deck
%w(
a4_euro_card.yml
a4_poker_card_8up.yml
a4_euro_card.yml
a4_poker_card_9up.yml
a4_usa_card.yml
letter_poker_card_9up.yml
).each do |builtin|
save_sheet sprue: builtin, prefix: "sprue_#{builtin}_", dir: '.'
save_sheet sprue: builtin, prefix: "sprue_#{builtin}_"
end
end
+24 -8
View File
@@ -1,11 +1,27 @@
require 'squib'
Squib::Deck.new(width: '63mm', height: '88mm', cards: 8) do
rect fill_color: :gray
text(
str: %w[Front_1 Front_2 Front_3 Front_4 Back_1 Back_2 Back_3 Back_4],
x: '3mm', y: '3mm'
)
save_pdf file: 'fold_sheet.pdf',
sprue: 'my_sprues/fold_sheet.yml'
# Note that this sample has no bleed - you might want to have bleed
# but tighter than usual: 0.1 instead of 0.125in since this sprue is
# crowded horizontally on US letter
Squib::Deck.new(width: '2.5in', height: '3.5in', cards: 8) do
background color: :white
rect stroke_width: 5, stroke_color: :red
# Note that we are interleaving strings
# This could be used as a secondary Squib script that loads
# Squib-generated individual images
strings = [
"Front 1",
"Back 1",
"Front 2",
"Back 2",
"Front 3",
"Back 3",
"Front 4",
"Back 4",
]
text str: strings,font: 'Sans 96', align: :center, valign: :middle,
height: :deck, width: :deck
save_sheet prefix: 'foldable_',
sprue: 'letter_poker_foldable_8up.yml'
end
+11
View File
@@ -0,0 +1,11 @@
require 'squib'
Squib::Deck.new(cards: 9) do
background color: :white
rect stroke_width: 5, stroke_color: :red
text str: (0..9).map{ |i| "Card #{i}\n2.5x3.5in" },
font: 'Sans 96', align: :center, valign: :middle,
height: :deck, width: :deck
save_sheet sprue: 'letter_poker_card_9up.yml',
prefix: "sprue_example_"
end
-9
View File
@@ -1,9 +0,0 @@
require 'squib'
Squib::Deck.new(width: '63mm', height: '88mm', cards: 9) do
text(
str: %w[One Two Three Four Five Six Seven Eight Nine], x: '3mm', y: '3mm'
)
save_pdf file: 'use_package_tmpl.pdf',
sprue: 'a4_poker_card_9up.yml'
end
Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

-57
View File
@@ -1,57 +0,0 @@
---
sheet_width: 297mm
sheet_height: 210mm
card_width: 63.0mm
card_height: 88.0mm
cards:
- x: 16.5mm
y: 13.0mm
- x: 83.5mm
y: 13.0mm
- x: 150.5mm
y: 13.0mm
- x: 217.5mm
y: 13.0mm
- x: 16.5mm
y: 109.0mm
rotate: :turnaround
- x: 83.5mm
y: 109.0mm
rotate: :turnaround
- x: 150.5mm
y: 109.0mm
rotate: :turnaround
- x: 217.5mm
y: 109.0mm
rotate: :turnaround
crop_line:
lines:
- type: :vertical
position: 16.5mm
- type: :vertical
position: 79.5mm
- type: :vertical
position: 83.5mm
- type: :vertical
position: 146.5mm
- type: :vertical
position: 150.5mm
- type: :vertical
position: 213.5mm
- type: :vertical
position: 217.5mm
- type: :vertical
position: 280.5mm
- type: :horizontal
position: 13.0mm
- type: :horizontal
position: 101.0mm
- type: :horizontal
position: 109.0mm
- type: :horizontal
position: 197.0mm
- type: :horizontal
position: 105.0mm
style: :dashed
color: :red
overlay_on_cards: true
-42
View File
@@ -1,42 +0,0 @@
---
sheet_width: 8.5in
sheet_height: 11in
card_width: 2.5in
card_height: 3.5in
cards:
- x: 0.5in
y: 0.125in
- x: 3.0in
y: 0.125in
- x: 5.5in
y: 0.125in
- x: 0.5in
y: 3.625in
- x: 3.0in
y: 3.625in
- x: 5.5in
y: 3.625in
- x: 0.5in
y: 7.125in
- x: 3.0in
y: 7.125in
- x: 5.5in
y: 7.125in
crop_line:
lines:
- type: :vertical
position: 0.5in
- type: :vertical
position: 3.0in
- type: :vertical
position: 5.5in
- type: :vertical
position: 8.0in
- type: :horizontal
position: 0.125in
- type: :horizontal
position: 3.625in
- type: :horizontal
position: 7.125in
- type: :horizontal
position: 10.625in
Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB