squib 0.13.4 → 0.14.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -4
- data/CHANGELOG.md +19 -3
- data/README.md +1 -1
- data/bin/squib +1 -16
- data/lib/squib.rb +1 -1
- data/lib/squib/api/data.rb +29 -0
- data/lib/squib/api/save.rb +23 -2
- data/lib/squib/api/shapes.rb +37 -0
- data/lib/squib/api/text.rb +1 -1
- data/lib/squib/api/units.rb +5 -0
- data/lib/squib/args/arg_loader.rb +1 -1
- data/lib/squib/args/coords.rb +3 -1
- data/lib/squib/args/dir_validator.rb +1 -1
- data/lib/squib/args/sheet.rb +9 -2
- data/lib/squib/args/sprue_file.rb +44 -0
- data/lib/squib/args/unit_conversion.rb +2 -0
- data/lib/squib/{layouts → builtin/layouts}/economy.yml +5 -5
- data/lib/squib/{layouts → builtin/layouts}/fantasy.yml +4 -4
- data/lib/squib/{layouts → builtin/layouts}/hand.yml +0 -0
- data/lib/squib/builtin/layouts/party.yml +94 -0
- data/lib/squib/{layouts → builtin/layouts}/playing-card.yml +0 -0
- data/lib/squib/{layouts → builtin/layouts}/tuck_box.yml +1 -1
- data/lib/squib/{project_template → builtin/projects/advanced}/.gitignore +0 -0
- data/lib/squib/{project_template → builtin/projects/advanced}/ABOUT.md +0 -0
- data/lib/squib/builtin/projects/advanced/Gemfile +11 -0
- data/lib/squib/builtin/projects/advanced/Guardfile +21 -0
- data/lib/squib/{project_template → builtin/projects/advanced}/IDEAS.md +0 -0
- data/lib/squib/{project_template → builtin/projects/advanced}/PLAYTESTING.md +0 -0
- data/lib/squib/builtin/projects/advanced/Rakefile +27 -0
- data/lib/squib/{project_template → builtin/projects/advanced}/_output/gitkeep.txt +0 -0
- data/lib/squib/builtin/projects/advanced/config.yml +49 -0
- data/lib/squib/builtin/projects/advanced/data/game.xlsx +0 -0
- data/lib/squib/project_template/PNP NOTES.md b/data/lib/squib/builtin/projects/advanced/docs/PNP → NOTES.md +0 -0
- data/lib/squib/{project_template → builtin/projects/advanced/docs}/RULES.md +0 -0
- data/lib/squib/builtin/projects/advanced/img/example.svg +60 -0
- data/lib/squib/builtin/projects/advanced/layouts/deck.yml +27 -0
- data/lib/squib/builtin/projects/advanced/src/deck.rb +34 -0
- data/lib/squib/builtin/projects/advanced/src/version.rb +3 -0
- data/lib/squib/builtin/projects/basic/.gitignore +4 -0
- data/lib/squib/builtin/projects/basic/ABOUT.md +19 -0
- data/lib/squib/{project_template → builtin/projects/basic}/Gemfile +0 -0
- data/lib/squib/builtin/projects/basic/IDEAS.md +22 -0
- data/lib/squib/builtin/projects/basic/PLAYTESTING.md +26 -0
- data/lib/squib/builtin/projects/basic/PNP NOTES.md +4 -0
- data/lib/squib/builtin/projects/basic/RULES.md +21 -0
- data/lib/squib/{project_template → builtin/projects/basic}/Rakefile +0 -0
- data/lib/squib/builtin/projects/basic/_output/gitkeep.txt +1 -0
- data/lib/squib/{project_template → builtin/projects/basic}/config.yml +0 -0
- data/lib/squib/{project_template → builtin/projects/basic}/deck.rb +0 -0
- data/lib/squib/{project_template → builtin/projects/basic}/layout.yml +0 -0
- data/lib/squib/builtin/sprues/a4_euro_card.yml +42 -0
- data/lib/squib/builtin/sprues/a4_poker_card_8up.yml +40 -0
- data/lib/squib/builtin/sprues/a4_poker_card_9up.yml +42 -0
- data/lib/squib/builtin/sprues/a4_usa_card.yml +42 -0
- data/lib/squib/builtin/sprues/letter_poker_card_9up.yml +25 -0
- data/lib/squib/builtin/sprues/letter_poker_foldable_8up.yml +52 -0
- data/lib/squib/card.rb +1 -1
- data/lib/squib/commands/cli.rb +39 -0
- data/lib/squib/commands/data/template_option.rb +109 -0
- data/lib/squib/commands/make_sprue.rb +275 -0
- data/lib/squib/commands/new.rb +37 -4
- data/lib/squib/constants.rb +6 -1
- data/lib/squib/graphics/cairo_context_wrapper.rb +1 -1
- data/lib/squib/graphics/image.rb +6 -1
- data/lib/squib/graphics/save_doc.rb +6 -4
- data/lib/squib/graphics/save_pdf.rb +13 -8
- data/lib/squib/graphics/save_sprue.rb +228 -0
- data/lib/squib/graphics/shapes.rb +8 -2
- data/lib/squib/graphics/text.rb +4 -3
- data/lib/squib/layout_parser.rb +17 -1
- data/lib/squib/sample_helpers.rb +1 -1
- data/lib/squib/sprues/crop_line.rb +28 -0
- data/lib/squib/sprues/crop_line_dash.rb +35 -0
- data/lib/squib/sprues/invalid_sprue_definition.rb +9 -0
- data/lib/squib/sprues/sprue.rb +203 -0
- data/lib/squib/sprues/sprue_schema.rb +48 -0
- data/lib/squib/version.rb +1 -1
- data/samples/autoscale_font/_autoscale_font.rb +3 -3
- data/samples/backend/_backend.rb +1 -1
- data/samples/basic.rb +2 -2
- data/samples/colors/_colors.rb +1 -1
- data/samples/colors/_gradients.rb +1 -1
- data/samples/config/config_text_markup.rb +3 -3
- data/samples/config/custom_config.rb +1 -1
- data/samples/data/_csv.rb +3 -3
- data/samples/data/_excel.rb +4 -4
- data/samples/data/_yaml.rb +12 -0
- data/samples/images/_images.rb +2 -2
- data/samples/images/_more_load_images.rb +3 -0
- data/samples/images/_unicode.rb +2 -2
- data/samples/intro/02_options.rb +2 -2
- data/samples/layouts/builtin_layouts.rb +27 -4
- data/samples/layouts/layouts.rb +2 -2
- data/samples/proofs/_tgc_proofs.rb +2 -2
- data/samples/ranges/_ranges.rb +3 -3
- data/samples/saves/_hand.rb +1 -1
- data/samples/saves/_save_pdf.rb +4 -0
- data/samples/saves/_saves.rb +7 -1
- data/samples/saves/_showcase.rb +1 -1
- data/samples/shapes/_draw_shapes.rb +5 -1
- data/samples/shapes/_proofs.rb +22 -0
- data/samples/sprues/_builtin_sprues.rb +19 -0
- data/samples/sprues/_fold_sheet.rb +27 -0
- data/samples/sprues/_hex_tiles.rb +15 -0
- data/samples/sprues/_mints.rb +11 -0
- data/samples/sprues/_sprue_example.rb +11 -0
- data/samples/text/_embed_text.rb +14 -14
- data/samples/text/_text.rb +8 -8
- data/samples/text/_text_options.rb +17 -17
- data/squib.gemspec +18 -17
- metadata +126 -44
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Squib
|
|
2
|
+
module Sprues
|
|
3
|
+
UNIT_REGEX = /^(\d*[.])?\d+(in|cm|mm)$/
|
|
4
|
+
ROTATE_REGEX = /^(\d*[.])?\d+(deg|rad)?$/
|
|
5
|
+
SCHEMA = {
|
|
6
|
+
'sheet_width' => UNIT_REGEX,
|
|
7
|
+
'sheet_height' => UNIT_REGEX,
|
|
8
|
+
'card_width' => UNIT_REGEX,
|
|
9
|
+
'card_height' => UNIT_REGEX,
|
|
10
|
+
'position_reference' => ClassyHash::G.enum(:topleft, :center),
|
|
11
|
+
'rotate' => [
|
|
12
|
+
:optional, Numeric,
|
|
13
|
+
ClassyHash::G.enum(:clockwise, :counterclockwise, :turnaround),
|
|
14
|
+
ROTATE_REGEX
|
|
15
|
+
],
|
|
16
|
+
'crop_line' => {
|
|
17
|
+
'style' => [
|
|
18
|
+
ClassyHash::G.enum(:solid, :dotted, :dashed),
|
|
19
|
+
Sprues::CropLineDash::VALIDATION_REGEX
|
|
20
|
+
],
|
|
21
|
+
'width' => UNIT_REGEX,
|
|
22
|
+
'color' => [String, Symbol],
|
|
23
|
+
'overlay' => ClassyHash::G.enum(
|
|
24
|
+
:on_margin, :overlay_on_cards, :beneath_cards
|
|
25
|
+
),
|
|
26
|
+
'lines' => [[{
|
|
27
|
+
'type' => ClassyHash::G.enum(:horizontal, :vertical),
|
|
28
|
+
'position' => UNIT_REGEX,
|
|
29
|
+
'style' => [
|
|
30
|
+
:optional, ClassyHash::G.enum(:solid, :dotted, :dashed)
|
|
31
|
+
],
|
|
32
|
+
'width' => [:optional, UNIT_REGEX],
|
|
33
|
+
'color' => [:optional, String, Symbol],
|
|
34
|
+
'overlay_on_cards' => [:optional, TrueClass]
|
|
35
|
+
}]]
|
|
36
|
+
},
|
|
37
|
+
'cards' => [[{
|
|
38
|
+
'x' => UNIT_REGEX,
|
|
39
|
+
'y' => UNIT_REGEX,
|
|
40
|
+
'rotate' => [
|
|
41
|
+
:optional, Numeric,
|
|
42
|
+
ClassyHash::G.enum(:clockwise, :counterclockwise, :turnaround),
|
|
43
|
+
ROTATE_REGEX
|
|
44
|
+
]
|
|
45
|
+
}]]
|
|
46
|
+
}.freeze
|
|
47
|
+
end
|
|
48
|
+
end
|
data/lib/squib/version.rb
CHANGED
data/samples/backend/_backend.rb
CHANGED
|
@@ -5,7 +5,7 @@ Squib::Deck.new(cards: 2, config: '_backend-config.yml') do
|
|
|
5
5
|
|
|
6
6
|
# These are all supported by the SVG backend
|
|
7
7
|
background color: :gray
|
|
8
|
-
text str: 'Hello, world!', y: 500, width: 825, font: 'Sans bold
|
|
8
|
+
text str: 'Hello, world!', y: 500, width: 825, font: 'Sans bold 24', align: :center
|
|
9
9
|
rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38
|
|
10
10
|
circle x: 100, y: 400, radius: 25
|
|
11
11
|
triangle x1: 100, y1: 425, x2: 125, y2: 475, x3: 75, y3: 475
|
data/samples/basic.rb
CHANGED
|
@@ -8,9 +8,9 @@ Squib::Deck.new(width: 825, height: 1125, cards: 3) do
|
|
|
8
8
|
rect x: 38, y: 38, width: 750, height: 1050, radius: 38
|
|
9
9
|
rect x: 75, y: 75, width: 128, height: 128, radius: 25
|
|
10
10
|
|
|
11
|
-
text str: data['name'], x: 220, y: 78, font: 'Arial
|
|
11
|
+
text str: data['name'], x: 220, y: 78, font: 'Arial 18'
|
|
12
12
|
text str: data['level'], x: 75, y: 85, width: 128,
|
|
13
|
-
font: 'Arial
|
|
13
|
+
font: 'Arial 24', align: :center
|
|
14
14
|
|
|
15
15
|
png range: [0, 2], file: 'shiny-purse.png', x: 620, y: 75
|
|
16
16
|
svg range: 1..2, file: 'spanner.svg', x: 620, y: 218
|
data/samples/colors/_colors.rb
CHANGED
|
@@ -26,7 +26,7 @@ Squib::Deck.new(width: 3000, height: 1500) do
|
|
|
26
26
|
x, y, w, h = 0, 0, 300, 50
|
|
27
27
|
colors.each_with_index do |color, i|
|
|
28
28
|
rect x: x, y: y, width: w, height: h, fill_color: color
|
|
29
|
-
text str: color.to_s, x: x + 5, y: y + 13, font: 'Sans Bold
|
|
29
|
+
text str: color.to_s, x: x + 5, y: y + 13, font: 'Sans Bold 5',
|
|
30
30
|
color: (Cairo::Color.parse(color).to_hsv.v > 0.9) ? '#000' : '#fff'
|
|
31
31
|
y += h
|
|
32
32
|
if y > @height
|
|
@@ -27,7 +27,7 @@ Squib::Deck.new do
|
|
|
27
27
|
radius: 15, stroke_color: '#0000'
|
|
28
28
|
|
|
29
29
|
# Alpha transparency can be used too
|
|
30
|
-
text str: 'Hello, world!', x: 75, y: 700, font: 'Sans Bold
|
|
30
|
+
text str: 'Hello, world!', x: 75, y: 700, font: 'Sans Bold 24',
|
|
31
31
|
color: '(0,0)(825,0) #000f@0.0 #0000@1.0'
|
|
32
32
|
|
|
33
33
|
save_png prefix: 'gradient_'
|
|
@@ -3,18 +3,18 @@ require 'squib'
|
|
|
3
3
|
Squib::Deck.new(config: 'config_text_markup.yml') do
|
|
4
4
|
background color: :white
|
|
5
5
|
text str: %{"'Yaml ain't markup', he says"},
|
|
6
|
-
x: 10, y: 10, width: 300, height: 200, font: 'Serif
|
|
6
|
+
x: 10, y: 10, width: 300, height: 200, font: 'Serif 7',
|
|
7
7
|
markup: true, hint: :cyan
|
|
8
8
|
|
|
9
9
|
text str: 'Notice also the antialiasing method.',
|
|
10
|
-
x: 320, y: 10, width: 300, height: 200, font: 'Arial Bold
|
|
10
|
+
x: 320, y: 10, width: 300, height: 200, font: 'Arial Bold 7'
|
|
11
11
|
|
|
12
12
|
save_png prefix: 'config_text_'
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
Squib::Deck.new(config: 'config_disable_quotes.yml') do
|
|
16
16
|
text str: %{This has typographic sugar --- and ``explicit'' quotes --- but the quotes are "dumb"},
|
|
17
|
-
x: 10, y: 10, width: 300, height: 200, font: 'Serif
|
|
17
|
+
x: 10, y: 10, width: 300, height: 200, font: 'Serif 7',
|
|
18
18
|
markup: true, hint: :cyan
|
|
19
19
|
save_png prefix: 'config_disable_text_'
|
|
20
20
|
end
|
|
@@ -6,7 +6,7 @@ Squib::Deck.new(config: 'custom-config.yml') do
|
|
|
6
6
|
|
|
7
7
|
# Hints can be turned on in the config file
|
|
8
8
|
text str: 'The Title', x: 0, y: 78, width: 825,
|
|
9
|
-
font: 'Arial
|
|
9
|
+
font: 'Arial 24', align: :center
|
|
10
10
|
|
|
11
11
|
# Progress bars are shown for these commands
|
|
12
12
|
# And images are taken from img_dir, not the cwd.
|
data/samples/data/_csv.rb
CHANGED
|
@@ -5,8 +5,8 @@ Squib::Deck.new(cards: 2) do
|
|
|
5
5
|
|
|
6
6
|
# Outputs a hash of arrays with the header names as keys
|
|
7
7
|
data = csv file: 'sample.csv'
|
|
8
|
-
text str: data['Type'], x: 250, y: 55, font: 'Arial
|
|
9
|
-
text str: data['Level'], x: 65, y: 65, font: 'Arial
|
|
8
|
+
text str: data['Type'], x: 250, y: 55, font: 'Arial 18'
|
|
9
|
+
text str: data['Level'], x: 65, y: 65, font: 'Arial 24'
|
|
10
10
|
|
|
11
11
|
save format: :png, prefix: 'sample_csv_'
|
|
12
12
|
|
|
@@ -21,7 +21,7 @@ num_cards = data['Name'].size # ...but 4 cards!
|
|
|
21
21
|
Squib::Deck.new(cards: num_cards) do
|
|
22
22
|
background color: :white
|
|
23
23
|
rect # card border
|
|
24
|
-
text str: data['Name'], font: 'Arial
|
|
24
|
+
text str: data['Name'], font: 'Arial 18'
|
|
25
25
|
save_sheet prefix: 'sample_csv_qty_', columns: 4
|
|
26
26
|
end
|
|
27
27
|
|
data/samples/data/_excel.rb
CHANGED
|
@@ -7,9 +7,9 @@ Squib::Deck.new(cards: 3) do
|
|
|
7
7
|
# Outputs a hash of arrays with the header names as keys
|
|
8
8
|
data = xlsx file: 'sample.xlsx'
|
|
9
9
|
|
|
10
|
-
text str: data['Name'], x: 250, y: 55, font: 'Arial
|
|
11
|
-
text str: data['Level'], x: 65, y: 65, font: 'Arial
|
|
12
|
-
text str: data['Description'], x: 65, y: 600, font: 'Arial
|
|
10
|
+
text str: data['Name'], x: 250, y: 55, font: 'Arial 18'
|
|
11
|
+
text str: data['Level'], x: 65, y: 65, font: 'Arial 24'
|
|
12
|
+
text str: data['Description'], x: 65, y: 600, font: 'Arial 12'
|
|
13
13
|
|
|
14
14
|
save format: :png, prefix: 'sample_excel_' # save to individual pngs
|
|
15
15
|
end
|
|
@@ -21,7 +21,7 @@ num_cards = data['Name'].size # ...but 4 cards
|
|
|
21
21
|
Squib::Deck.new(cards: num_cards) do
|
|
22
22
|
background color: :white
|
|
23
23
|
rect # card border
|
|
24
|
-
text str: data['Name'], font: 'Arial
|
|
24
|
+
text str: data['Name'], font: 'Arial 18'
|
|
25
25
|
save_sheet prefix: 'sample_xlsx_qty_', columns: 4
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'squib'
|
|
2
|
+
|
|
3
|
+
Squib::Deck.new(cards: 2) do
|
|
4
|
+
background color: :white
|
|
5
|
+
|
|
6
|
+
# Outputs a hash of arrays with the header names as keys
|
|
7
|
+
data = yaml file: 'sample.yaml'
|
|
8
|
+
text str: data['Type'], x: 250, y: 55, font: 'Arial 18'
|
|
9
|
+
text str: data['Level'], x: 65, y: 65, font: 'Arial 24'
|
|
10
|
+
|
|
11
|
+
save format: :png, prefix: 'sample_yaml_'
|
|
12
|
+
end
|
data/samples/images/_images.rb
CHANGED
|
@@ -30,7 +30,7 @@ Squib::Deck.new(width: 1000, height: 3000) do
|
|
|
30
30
|
png file: 'sprites.png', x: x - 50, y: y - 50 # entire sprite sheet
|
|
31
31
|
rect x: x - 50, y: y - 50, width: 100, height: 100, # draw the crop line
|
|
32
32
|
radius: 15, dash: '3 3', stroke_color: 'red', stroke_width: 3
|
|
33
|
-
text str: '➜', font: 'Sans Bold
|
|
33
|
+
text str: '➜', font: 'Sans Bold 12', x: x + 150, y: y - 35
|
|
34
34
|
png file: 'sprites.png', x: x + 200, y: y - 50, # just the robot golem image
|
|
35
35
|
crop_x: 0, crop_y: 0, crop_corner_radius: 15,
|
|
36
36
|
crop_width: 100, crop_height: 100
|
|
@@ -38,7 +38,7 @@ Squib::Deck.new(width: 1000, height: 3000) do
|
|
|
38
38
|
png file: 'sprites.png', x: x - 50, y: y + 50 # entire sprite sheet again
|
|
39
39
|
rect x: x + 14, y: y + 50, width: 65, height: 65, # highlight the crop
|
|
40
40
|
radius: 25, dash: '3 3', stroke_color: 'red', stroke_width: 3
|
|
41
|
-
text str: '➜', font: 'Sans Bold
|
|
41
|
+
text str: '➜', font: 'Sans Bold 12', x: x + 150, y: y + 50
|
|
42
42
|
png file: 'sprites.png', x: x + 225, y: y + 50, # just the drakkar ship image, rotated
|
|
43
43
|
crop_x: 64, crop_y: 0, crop_corner_x_radius: 25, crop_corner_y_radius: 25,
|
|
44
44
|
crop_width: 64, crop_height: 64, angle: Math::PI / 6
|
|
@@ -95,5 +95,8 @@ Squib::Deck.new(width: 825, height: 1125, cards: 1, config: 'load_images_config.
|
|
|
95
95
|
svg file: 'spanner.svg', width: :deck, height: :deck,
|
|
96
96
|
force_id: true, id: '' # <-- the important part
|
|
97
97
|
|
|
98
|
+
# Squib can handle incorrectly formatted svg files
|
|
99
|
+
svg file: 'bad-svg.svg'
|
|
100
|
+
|
|
98
101
|
save prefix: 'load_images_', format: :png
|
|
99
102
|
end
|
data/samples/images/_unicode.rb
CHANGED
|
@@ -15,8 +15,8 @@ Squib::Deck.new(height: (game_chars.size / cols + 1) * cell_height,
|
|
|
15
15
|
game_chars.each_with_index do |c, i|
|
|
16
16
|
rect fill_color: %w(#eeee #ffff)[i % 2],
|
|
17
17
|
width: cell_width, height: cell_height, x: x, y: y
|
|
18
|
-
text str: c.inspect, font: 'Sans
|
|
19
|
-
text str: c, font: 'Sans,Segoe UI Symbol
|
|
18
|
+
text str: c.inspect, font: 'Sans 14', x: x, y: y
|
|
19
|
+
text str: c, font: 'Sans,Segoe UI Symbol 14', x: x + 300, y: y
|
|
20
20
|
x += cell_width
|
|
21
21
|
if i % cols == cols - 1
|
|
22
22
|
x = 1
|
data/samples/intro/02_options.rb
CHANGED
|
@@ -4,11 +4,11 @@ Squib::Deck.new cards: 1 do
|
|
|
4
4
|
background color: '#252322'
|
|
5
5
|
rect fill_color: '#0B3736',
|
|
6
6
|
x: 38, y: 38, width: 750, height: 1050, radius: 38
|
|
7
|
-
text str: 'Robot Golem', font: 'True Crimes, Sans
|
|
7
|
+
text str: 'Robot Golem', font: 'True Crimes, Sans 24',
|
|
8
8
|
align: :center, x: 75, width: :deck, color: '#DFDFE1', y: 90
|
|
9
9
|
svg file: 'auto-repair.svg', x: 75, y: 75, width: 100, height: :scale
|
|
10
10
|
svg file: 'robot-golem.svg', x: 75, y: 300, width: 675, height: :scale
|
|
11
|
-
text str: 'Draw two cards', font: 'Serif
|
|
11
|
+
text str: 'Draw two cards', font: 'Serif 12',
|
|
12
12
|
align: :center, width: :deck, color: '#DFDFE1', y: 1000
|
|
13
13
|
save_png prefix: 'part2_'
|
|
14
14
|
end
|
|
@@ -5,7 +5,7 @@ require 'squib'
|
|
|
5
5
|
Squib::Deck.new(layout: 'fantasy.yml') do
|
|
6
6
|
background color: 'white'
|
|
7
7
|
|
|
8
|
-
set font: 'Times New Roman,Serif
|
|
8
|
+
set font: 'Times New Roman,Serif 10.5'
|
|
9
9
|
hint text: '#333' # show extents of text boxes to demo the layout
|
|
10
10
|
|
|
11
11
|
text str: 'fantasy.yml', layout: :title
|
|
@@ -26,7 +26,7 @@ end
|
|
|
26
26
|
Squib::Deck.new(layout: 'economy.yml') do
|
|
27
27
|
background color: 'white'
|
|
28
28
|
|
|
29
|
-
set font: 'Times New Roman,Serif
|
|
29
|
+
set font: 'Times New Roman,Serif 10.5'
|
|
30
30
|
hint text: '#333' # show extents of text boxes to demo the layout
|
|
31
31
|
|
|
32
32
|
text str: 'economy.yml', layout: :title
|
|
@@ -54,8 +54,8 @@ end
|
|
|
54
54
|
|
|
55
55
|
Squib::Deck.new(layout: 'playing-card.yml') do
|
|
56
56
|
background color: 'white'
|
|
57
|
-
text str: "A\u2660", layout: :bonus_ul, font: 'Sans bold
|
|
58
|
-
text str: "A\u2660", layout: :bonus_lr, font: 'Sans bold
|
|
57
|
+
text str: "A\u2660", layout: :bonus_ul, font: 'Sans bold 33', hint: :red
|
|
58
|
+
text str: "A\u2660", layout: :bonus_lr, font: 'Sans bold 33', hint: :red
|
|
59
59
|
text str: 'artwork here', layout: :art, hint: :red
|
|
60
60
|
save_png prefix: 'layouts_builtin_playing_card_'
|
|
61
61
|
end
|
|
@@ -72,3 +72,26 @@ Squib::Deck.new(layout: 'tuck_box.yml', width: 2325, height: 1950) do
|
|
|
72
72
|
|
|
73
73
|
save_png prefix: 'layouts_builtin_tuck_box_'
|
|
74
74
|
end
|
|
75
|
+
|
|
76
|
+
Squib::Deck.new(layout: 'party.yml') do
|
|
77
|
+
background color: 'white'
|
|
78
|
+
# hint text: :black # uncomment to see the text box boundaries
|
|
79
|
+
|
|
80
|
+
rect layout: :title_box,
|
|
81
|
+
fill_color: :deep_sky_blue, stroke_width: 0
|
|
82
|
+
text str: "A SILLY NAME", layout: :title
|
|
83
|
+
text str: '✔', layout: :type_icon
|
|
84
|
+
text str: 'TYPE', layout: :type
|
|
85
|
+
text str: 'A Silly Name', layout: :title_middle
|
|
86
|
+
rect fill_color: :black, layout: :middle_rect
|
|
87
|
+
|
|
88
|
+
str = 'Rule or story text. Be funny ha ha ha this is a party.'
|
|
89
|
+
text str: str, layout: :rule_top
|
|
90
|
+
text str: str, layout: :rule_bottom
|
|
91
|
+
|
|
92
|
+
text str: 'Tiny text', layout: :copyright
|
|
93
|
+
|
|
94
|
+
rect layout: :safe
|
|
95
|
+
rect layout: :cut
|
|
96
|
+
save_png prefix: 'layouts_builtin_party_'
|
|
97
|
+
end
|
data/samples/layouts/layouts.rb
CHANGED
|
@@ -44,8 +44,8 @@ end
|
|
|
44
44
|
|
|
45
45
|
# Built-in layouts are easy to use and extend
|
|
46
46
|
Squib::Deck.new(layout: 'playing-card.yml') do
|
|
47
|
-
text str: "A\u2660", layout: :bonus_ul, font: 'Sans bold
|
|
48
|
-
text str: "A\u2660", layout: :bonus_lr, font: 'Sans bold
|
|
47
|
+
text str: "A\u2660", layout: :bonus_ul, font: 'Sans bold 33', hint: :red
|
|
48
|
+
text str: "A\u2660", layout: :bonus_lr, font: 'Sans bold 33', hint: :red
|
|
49
49
|
text str: 'artwork here', layout: :art, hint: :red
|
|
50
50
|
save_png prefix: 'layout_builtin_playing_card_'
|
|
51
51
|
end
|
|
@@ -6,8 +6,8 @@ Squib::Deck.new(width: 825, height: 1125, cards: 1) do
|
|
|
6
6
|
rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38
|
|
7
7
|
rect x: 75, y: 75, width: 128, height: 128, x_radius: 25, y_radius: 25
|
|
8
8
|
|
|
9
|
-
text str: 'Mastermind', x: 220, y: 78, font: 'Arial
|
|
10
|
-
text str: 3, x: 75, y: 85, width: 128, font: 'Arial
|
|
9
|
+
text str: 'Mastermind', x: 220, y: 78, font: 'Arial 18'
|
|
10
|
+
text str: 3, x: 75, y: 85, width: 128, font: 'Arial 24', align: :center
|
|
11
11
|
|
|
12
12
|
# TGC proof overlay (using alpha-transparency)
|
|
13
13
|
png file: 'pokercard.png', x:0, y:0, alpha: 0.5
|
data/samples/ranges/_ranges.rb
CHANGED
|
@@ -7,12 +7,12 @@ data = { 'name' => ['Thief', 'Grifter', 'Mastermind'],
|
|
|
7
7
|
Squib::Deck.new(width: 825, height: 1125, cards: 3) do
|
|
8
8
|
# Default range is :all
|
|
9
9
|
background color: :white
|
|
10
|
-
text str: data['name'], x: 250, y: 55, font: 'Arial
|
|
11
|
-
text str: data['level'], x: 65, y: 40, font: 'Arial
|
|
10
|
+
text str: data['name'], x: 250, y: 55, font: 'Arial 18'
|
|
11
|
+
text str: data['level'], x: 65, y: 40, font: 'Arial 24'
|
|
12
12
|
|
|
13
13
|
# Could be explicit about using :all, too
|
|
14
14
|
text range: :all,
|
|
15
|
-
str: data['type'], x: 40, y: 128, font: 'Arial
|
|
15
|
+
str: data['type'], x: 40, y: 128, font: 'Arial 6',
|
|
16
16
|
width: 100, align: :center
|
|
17
17
|
|
|
18
18
|
# Ranges are inclusive, zero-based
|
data/samples/saves/_hand.rb
CHANGED
|
@@ -4,7 +4,7 @@ Squib::Deck.new(cards: 8, layout: 'playing-card.yml') do
|
|
|
4
4
|
background color: :cyan
|
|
5
5
|
rect x: 37, y: 37, width: 750, height: 1050, fill_color: :black, radius: 25
|
|
6
6
|
rect x: 75, y: 75, width: 675, height: 975, fill_color: :white, radius: 20
|
|
7
|
-
text str: ('A'..'Z').to_a, layout: :bonus_ul, font: 'Sans bold
|
|
7
|
+
text str: ('A'..'Z').to_a, layout: :bonus_ul, font: 'Sans bold 33'
|
|
8
8
|
|
|
9
9
|
# Defaults are sensible
|
|
10
10
|
hand # saves to _output/hand.png
|
data/samples/saves/_save_pdf.rb
CHANGED
|
@@ -22,4 +22,8 @@ Squib::Deck.new(cards: 8) do
|
|
|
22
22
|
crop_stroke_dash: '5 5', crop_stroke_color: :red, crop_stroke_width: 4.0,
|
|
23
23
|
crop_margin_left: '0.3in', crop_margin_right: '0.45in',
|
|
24
24
|
crop_margin_top: '0.4in', crop_margin_bottom: '0.85in'
|
|
25
|
+
|
|
26
|
+
# Right to left printing for duplex
|
|
27
|
+
save_pdf file: 'save_pdf-crops-rtl.pdf', crop_marks: true, rtl: true
|
|
28
|
+
|
|
25
29
|
end
|
data/samples/saves/_saves.rb
CHANGED
|
@@ -7,7 +7,7 @@ Squib::Deck.new(width: 825, height: 1125, cards: 16) do
|
|
|
7
7
|
rect x: 38, y: 38, width: 750, height: 1050,
|
|
8
8
|
x_radius: 38, y_radius: 38, stroke: 3.0, dash: '4 4'
|
|
9
9
|
|
|
10
|
-
text str: (1..16).to_a, x: 220, y: 78, font: 'Arial
|
|
10
|
+
text str: (1..16).to_a, x: 220, y: 78, font: 'Arial 18'
|
|
11
11
|
|
|
12
12
|
# Here's what a regular save_png looks like for just the first card
|
|
13
13
|
save_png range: 0, prefix: 'save_png_'
|
|
@@ -42,4 +42,10 @@ Squib::Deck.new(width: 825, height: 1125, cards: 16) do
|
|
|
42
42
|
range: 0..5,
|
|
43
43
|
columns: 2, rows: 2,
|
|
44
44
|
margin: 75, gap: 5, trim: 37
|
|
45
|
+
|
|
46
|
+
# Sheets can arrange left-to-right and right-to-left
|
|
47
|
+
save_sheet prefix: 'save_sheet_rtl_',
|
|
48
|
+
range: 0..1, rtl: true,
|
|
49
|
+
columns: 2, rows: 1,
|
|
50
|
+
margin: 75, gap: 5, trim: 37
|
|
45
51
|
end
|
data/samples/saves/_showcase.rb
CHANGED
|
@@ -7,7 +7,7 @@ Squib::Deck.new(cards: 4) do
|
|
|
7
7
|
rect fill_color: '#DED4B9', x: 78, y: 78,
|
|
8
8
|
width: '2.25in', height: '3.25in', radius: 32
|
|
9
9
|
text str: %w(Grifter Thief Thug Kingpin),
|
|
10
|
-
font: 'Helvetica,Sans weight=800
|
|
10
|
+
font: 'Helvetica,Sans weight=800 40',
|
|
11
11
|
x: 78, y: 78, width: '2.25in', align: :center
|
|
12
12
|
svg file: 'spanner.svg', x: (825 - 500) / 2, y: 500, width: 500, height: 500
|
|
13
13
|
|
|
@@ -18,7 +18,11 @@ Squib::Deck.new do
|
|
|
18
18
|
ellipse x: 675, y: 105, width: 65, height: 100,
|
|
19
19
|
stroke_width: 5, stroke_color: :orange, angle: -0.2
|
|
20
20
|
|
|
21
|
-
circle x:
|
|
21
|
+
circle x: 450, y: 600, radius: 75,
|
|
22
|
+
fill_color: :gray, stroke_color: :green, stroke_width: 8.0
|
|
23
|
+
|
|
24
|
+
circle x: 600, y: 600, radius: 75, # partial circle
|
|
25
|
+
arc_start: 1, arc_end: 4, arc_direction: :counter_clockwise,
|
|
22
26
|
fill_color: :gray, stroke_color: :green, stroke_width: 8.0
|
|
23
27
|
|
|
24
28
|
triangle x1: 50, y1: 50,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'squib'
|
|
2
|
+
|
|
3
|
+
Squib::Deck.new do
|
|
4
|
+
background color: :white
|
|
5
|
+
safe_zone # defaults TheGameCrafter 0.25in around the edge, rounded corners
|
|
6
|
+
cut_zone # defaults TheGameCrafter 0.125in around the edge
|
|
7
|
+
|
|
8
|
+
text str: 'Poker card with proof lines', x: '0.25in', y: '0.25in'
|
|
9
|
+
save_png prefix: 'proof_poker_'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Squib::Deck.new(width:'2in', height: '1in')do
|
|
14
|
+
background color: :white
|
|
15
|
+
safe_zone stroke_color: :purple, margin: '0.1in'
|
|
16
|
+
cut_zone stroke_color: :purple, margin: '0.05in'
|
|
17
|
+
|
|
18
|
+
text str: 'Small card with proof lines', x: '0.1in', y: '0.1in',
|
|
19
|
+
font: 'Arial 10'
|
|
20
|
+
|
|
21
|
+
save_png prefix: 'proof_tiny_'
|
|
22
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'squib'
|
|
2
|
+
|
|
3
|
+
Squib::Deck.new(width: '50mm', height: '70mm', cards: 9) do
|
|
4
|
+
background color: :white
|
|
5
|
+
rect stroke_width: 5, stroke_color: :red
|
|
6
|
+
text str: (0..9).map{ |i| "Card! #{i}\n50x77mm" },
|
|
7
|
+
font: 'Sans 32', align: :center, valign: :middle,
|
|
8
|
+
height: :deck, width: :deck
|
|
9
|
+
|
|
10
|
+
%w(
|
|
11
|
+
a4_poker_card_8up.yml
|
|
12
|
+
a4_euro_card.yml
|
|
13
|
+
a4_poker_card_9up.yml
|
|
14
|
+
a4_usa_card.yml
|
|
15
|
+
letter_poker_card_9up.yml
|
|
16
|
+
).each do |builtin|
|
|
17
|
+
save_sheet sprue: builtin, prefix: "sprue_#{builtin}_"
|
|
18
|
+
end
|
|
19
|
+
end
|