squib 0.14.1 → 0.14.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +41 -41
  3. data/.travis.yml +19 -19
  4. data/CHANGELOG.md +357 -340
  5. data/CONTRIBUTING.md +40 -40
  6. data/Gemfile +2 -2
  7. data/LICENSE.txt +22 -22
  8. data/README.md +121 -121
  9. data/RELEASE TODO.md +21 -21
  10. data/Rakefile +48 -48
  11. data/appveyor.yml +24 -24
  12. data/bin/squib +4 -4
  13. data/lib/squib.rb +32 -32
  14. data/lib/squib/api/background.rb +15 -15
  15. data/lib/squib/api/data.rb +137 -137
  16. data/lib/squib/api/groups.rb +54 -54
  17. data/lib/squib/api/image.rb +49 -49
  18. data/lib/squib/api/save.rb +83 -83
  19. data/lib/squib/api/settings.rb +21 -21
  20. data/lib/squib/api/shapes.rb +124 -124
  21. data/lib/squib/api/text.rb +25 -25
  22. data/lib/squib/api/text_embed.rb +71 -71
  23. data/lib/squib/api/units.rb +27 -27
  24. data/lib/squib/args/arg_loader.rb +126 -126
  25. data/lib/squib/args/box.rb +55 -55
  26. data/lib/squib/args/card_range.rb +32 -32
  27. data/lib/squib/args/color_validator.rb +12 -12
  28. data/lib/squib/args/coords.rb +35 -35
  29. data/lib/squib/args/csv_opts.rb +25 -25
  30. data/lib/squib/args/dir_validator.rb +16 -16
  31. data/lib/squib/args/draw.rb +92 -92
  32. data/lib/squib/args/embed_adjust.rb +25 -25
  33. data/lib/squib/args/embed_key.rb +17 -17
  34. data/lib/squib/args/hand_special.rb +37 -37
  35. data/lib/squib/args/import.rb +40 -40
  36. data/lib/squib/args/input_file.rb +37 -37
  37. data/lib/squib/args/paint.rb +44 -44
  38. data/lib/squib/args/paragraph.rb +116 -116
  39. data/lib/squib/args/save_batch.rb +63 -63
  40. data/lib/squib/args/scale_box.rb +53 -53
  41. data/lib/squib/args/sheet.rb +172 -172
  42. data/lib/squib/args/showcase_special.rb +38 -38
  43. data/lib/squib/args/sprue_file.rb +44 -44
  44. data/lib/squib/args/svg_special.rb +37 -37
  45. data/lib/squib/args/transform.rb +61 -61
  46. data/lib/squib/args/typographer.rb +119 -119
  47. data/lib/squib/args/unit_conversion.rb +29 -29
  48. data/lib/squib/builtin/layouts/economy.yml +85 -85
  49. data/lib/squib/builtin/layouts/fantasy.yml +101 -101
  50. data/lib/squib/builtin/layouts/hand.yml +62 -62
  51. data/lib/squib/builtin/layouts/party.yml +94 -94
  52. data/lib/squib/builtin/layouts/playing-card.yml +35 -35
  53. data/lib/squib/builtin/layouts/tuck_box.yml +46 -46
  54. data/lib/squib/builtin/projects/advanced/.gitignore +4 -4
  55. data/lib/squib/builtin/projects/advanced/ABOUT.md +19 -19
  56. data/lib/squib/builtin/projects/advanced/Gemfile +11 -11
  57. data/lib/squib/builtin/projects/advanced/Guardfile +21 -21
  58. data/lib/squib/builtin/projects/advanced/IDEAS.md +22 -22
  59. data/lib/squib/builtin/projects/advanced/PLAYTESTING.md +26 -26
  60. data/lib/squib/builtin/projects/advanced/Rakefile +27 -27
  61. data/lib/squib/builtin/projects/advanced/config.yml +49 -49
  62. data/lib/squib/builtin/projects/advanced/docs/PNP NOTES.md +3 -3
  63. data/lib/squib/builtin/projects/advanced/docs/RULES.md +21 -21
  64. data/lib/squib/builtin/projects/advanced/img/example.svg +60 -60
  65. data/lib/squib/builtin/projects/advanced/layouts/deck.yml +27 -27
  66. data/lib/squib/builtin/projects/advanced/src/deck.rb +34 -34
  67. data/lib/squib/builtin/projects/advanced/src/version.rb +3 -3
  68. data/lib/squib/builtin/projects/basic/.gitignore +4 -4
  69. data/lib/squib/builtin/projects/basic/ABOUT.md +19 -19
  70. data/lib/squib/builtin/projects/basic/Gemfile +3 -3
  71. data/lib/squib/builtin/projects/basic/IDEAS.md +22 -22
  72. data/lib/squib/builtin/projects/basic/PLAYTESTING.md +26 -26
  73. data/lib/squib/builtin/projects/basic/PNP NOTES.md +3 -3
  74. data/lib/squib/builtin/projects/basic/RULES.md +21 -21
  75. data/lib/squib/builtin/projects/basic/Rakefile +7 -7
  76. data/lib/squib/builtin/projects/basic/config.yml +49 -49
  77. data/lib/squib/builtin/projects/basic/deck.rb +6 -6
  78. data/lib/squib/builtin/sprues/a4_euro_card.yml +42 -42
  79. data/lib/squib/builtin/sprues/a4_poker_card_8up.yml +40 -40
  80. data/lib/squib/builtin/sprues/a4_poker_card_9up.yml +42 -42
  81. data/lib/squib/builtin/sprues/a4_usa_card.yml +42 -42
  82. data/lib/squib/builtin/sprues/drivethrucards_1up.yml +10 -0
  83. data/lib/squib/builtin/sprues/letter_poker_card_9up.yml +25 -25
  84. data/lib/squib/builtin/sprues/letter_poker_foldable_8up.yml +52 -52
  85. data/lib/squib/builtin/sprues/printplaygames_18up.yml +68 -0
  86. data/lib/squib/card.rb +75 -74
  87. data/lib/squib/commands/cli.rb +39 -39
  88. data/lib/squib/commands/data/template_option.rb +109 -109
  89. data/lib/squib/commands/make_sprue.rb +275 -275
  90. data/lib/squib/commands/new.rb +77 -77
  91. data/lib/squib/conf.rb +139 -139
  92. data/lib/squib/constants.rb +17 -17
  93. data/lib/squib/deck.rb +116 -116
  94. data/lib/squib/graphics/background.rb +14 -14
  95. data/lib/squib/graphics/cairo_context_wrapper.rb +113 -113
  96. data/lib/squib/graphics/embedding_utils.rb +28 -28
  97. data/lib/squib/graphics/gradient_regex.rb +47 -47
  98. data/lib/squib/graphics/hand.rb +42 -42
  99. data/lib/squib/graphics/image.rb +108 -108
  100. data/lib/squib/graphics/save_doc.rb +61 -61
  101. data/lib/squib/graphics/save_images.rb +52 -52
  102. data/lib/squib/graphics/save_pdf.rb +90 -90
  103. data/lib/squib/graphics/save_sprue.rb +204 -205
  104. data/lib/squib/graphics/shapes.rb +143 -143
  105. data/lib/squib/graphics/showcase.rb +85 -85
  106. data/lib/squib/graphics/text.rb +174 -174
  107. data/lib/squib/import/data_frame.rb +108 -108
  108. data/lib/squib/layout_parser.rb +138 -126
  109. data/lib/squib/progress.rb +38 -38
  110. data/lib/squib/sample_helpers.rb +34 -34
  111. data/lib/squib/sprues/crop_line.rb +28 -28
  112. data/lib/squib/sprues/crop_line_dash.rb +35 -35
  113. data/lib/squib/sprues/invalid_sprue_definition.rb +9 -9
  114. data/lib/squib/sprues/sprue.rb +203 -203
  115. data/lib/squib/sprues/sprue_schema.rb +48 -48
  116. data/lib/squib/version.rb +10 -10
  117. data/samples/autoscale_font/_autoscale_font.rb +29 -29
  118. data/samples/backend/_backend.rb +26 -26
  119. data/samples/basic.rb +19 -19
  120. data/samples/build_groups/build_groups.rb +36 -36
  121. data/samples/colors/_colors.rb +38 -38
  122. data/samples/colors/_gradients.rb +34 -34
  123. data/samples/config/config_text_markup.rb +20 -20
  124. data/samples/config/custom_config.rb +18 -18
  125. data/samples/data/_csv.rb +33 -33
  126. data/samples/data/_excel.rb +55 -55
  127. data/samples/data/_yaml.rb +12 -12
  128. data/samples/hello_world.rb +6 -6
  129. data/samples/images/_cairo_access.rb +39 -39
  130. data/samples/images/_images.rb +104 -104
  131. data/samples/images/_more_load_images.rb +102 -102
  132. data/samples/intro/01_hello.rb +8 -8
  133. data/samples/intro/02_options.rb +14 -14
  134. data/samples/intro/03_layout.rb +11 -11
  135. data/samples/intro/04_arrays.rb +15 -15
  136. data/samples/intro/05_excel.rb +14 -14
  137. data/samples/layouts/builtin_layouts.rb +97 -97
  138. data/samples/layouts/layouts.rb +71 -71
  139. data/samples/project/src/characters.rb +8 -8
  140. data/samples/project/src/skills.rb +7 -7
  141. data/samples/proofs/_tgc_proofs.rb +16 -16
  142. data/samples/ranges/_ranges.rb +64 -64
  143. data/samples/saves/_hand.rb +23 -23
  144. data/samples/saves/_portrait_landscape.rb +23 -23
  145. data/samples/saves/_save_pdf.rb +29 -29
  146. data/samples/saves/_saves.rb +51 -51
  147. data/samples/saves/_showcase.rb +25 -25
  148. data/samples/shapes/_draw_shapes.rb +60 -58
  149. data/samples/shapes/_proofs.rb +22 -22
  150. data/samples/sprues/_advanced_sprues.rb +24 -24
  151. data/samples/sprues/_builtin_sprues.rb +21 -19
  152. data/samples/sprues/_fold_sheet.rb +27 -27
  153. data/samples/sprues/_hex_tiles.rb +15 -15
  154. data/samples/sprues/_mints.rb +11 -11
  155. data/samples/sprues/_sprue_example.rb +11 -11
  156. data/samples/text/_embed_text.rb +128 -128
  157. data/samples/text/_text.rb +47 -47
  158. data/samples/text/_text_options.rb +102 -102
  159. data/samples/text/bug134.rb +14 -14
  160. data/samples/units/_units.rb +32 -32
  161. data/squib.gemspec +52 -51
  162. metadata +66 -50
@@ -1,71 +1,71 @@
1
- # encoding: utf-8
2
- require 'squib'
3
- require 'pp'
4
-
5
- Squib::Deck.new(layout: 'custom-layout.yml') do
6
- background color: :white
7
- hint text: :cyan
8
-
9
- # Layouts are YAML files that specify any option as a default
10
- rect layout: :frame
11
-
12
- # You can also override a given layout entry in the command
13
- circle layout: :frame, x: 50, y: 50, radius: 25
14
-
15
- # Lots of commands have the :layout option
16
- text str: 'The Title', layout: :title
17
-
18
- # Layouts also support YAML merge keys toreuse settings
19
- svg file: 'spanner.svg', layout: :icon_left
20
- png file: 'shiny-purse.png', layout: :icon_middle
21
- svg file: 'spanner.svg', layout: :icon_right
22
-
23
- # Squib has its own, richer merge key: "extends"
24
- rect fill_color: :black, layout: :bonus
25
- rect fill_color: :white, layout: :bonus_inner
26
- text str: 'Extends!', layout: :bonus_text
27
-
28
- # Strings can also be used to specify a layout (e.g. from a data file)
29
- text str: 'subtitle', layout: 'subtitle'
30
-
31
- # For debugging purposes, you can always print out the loaded layout
32
- # require 'pp'
33
- # pp layout
34
-
35
- save_png prefix: 'layout_'
36
- end
37
-
38
- Squib::Deck.new(layout: ['custom-layout.yml', 'custom-layout2.yml']) do
39
- text str: 'The Title', layout: :title # from custom-layout.yml
40
- text str: 'The Subtitle', layout: :subtitle # redefined in custom-layout2.yml
41
- text str: 'The Description', layout: :description # from custom-layout2.yml
42
- save_png prefix: 'layout2_'
43
- end
44
-
45
- # Built-in layouts are easy to use and extend
46
- Squib::Deck.new(layout: 'playing-card.yml') do
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
- text str: 'artwork here', layout: :art, hint: :red
50
- save_png prefix: 'layout_builtin_playing_card_'
51
- end
52
-
53
- # Built-in layouts are easy to use and extend
54
- Squib::Deck.new(layout: 'hand.yml') do
55
- %w(title bonus1 bonus2 bonus3 bonus4 bonus5
56
- description snark art).each do |icon|
57
- text str: icon.capitalize, layout: icon,
58
- hint: :red, valign: 'middle', align: 'center'
59
- end
60
- save_png prefix: 'layout_builtin_hand_'
61
- end
62
-
63
- # Layouts can also be specified in their own DSL method call
64
- # Each layout call will progressively be merged with the priors
65
- Squib::Deck.new do
66
- use_layout file: 'custom-layout.yml'
67
- use_layout file: 'custom-layout2.yml'
68
- text str: 'The Title', layout: :title # from custom-layout.yml
69
- text str: 'The Subtitle', layout: :subtitle # redefined in custom-layout2.yml
70
- save_png prefix: 'layout3_'
71
- end
1
+ # encoding: utf-8
2
+ require 'squib'
3
+ require 'pp'
4
+
5
+ Squib::Deck.new(layout: 'custom-layout.yml') do
6
+ background color: :white
7
+ hint text: :cyan
8
+
9
+ # Layouts are YAML files that specify any option as a default
10
+ rect layout: :frame
11
+
12
+ # You can also override a given layout entry in the command
13
+ circle layout: :frame, x: 50, y: 50, radius: 25
14
+
15
+ # Lots of commands have the :layout option
16
+ text str: 'The Title', layout: :title
17
+
18
+ # Layouts also support YAML merge keys toreuse settings
19
+ svg file: 'spanner.svg', layout: :icon_left
20
+ png file: 'shiny-purse.png', layout: :icon_middle
21
+ svg file: 'spanner.svg', layout: :icon_right
22
+
23
+ # Squib has its own, richer merge key: "extends"
24
+ rect fill_color: :black, layout: :bonus
25
+ rect fill_color: :white, layout: :bonus_inner
26
+ text str: 'Extends!', layout: :bonus_text
27
+
28
+ # Strings can also be used to specify a layout (e.g. from a data file)
29
+ text str: 'subtitle', layout: 'subtitle'
30
+
31
+ # For debugging purposes, you can always print out the loaded layout
32
+ # require 'pp'
33
+ # pp layout
34
+
35
+ save_png prefix: 'layout_'
36
+ end
37
+
38
+ Squib::Deck.new(layout: ['custom-layout.yml', 'custom-layout2.yml']) do
39
+ text str: 'The Title', layout: :title # from custom-layout.yml
40
+ text str: 'The Subtitle', layout: :subtitle # redefined in custom-layout2.yml
41
+ text str: 'The Description', layout: :description # from custom-layout2.yml
42
+ save_png prefix: 'layout2_'
43
+ end
44
+
45
+ # Built-in layouts are easy to use and extend
46
+ Squib::Deck.new(layout: 'playing-card.yml') do
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
+ text str: 'artwork here', layout: :art, hint: :red
50
+ save_png prefix: 'layout_builtin_playing_card_'
51
+ end
52
+
53
+ # Built-in layouts are easy to use and extend
54
+ Squib::Deck.new(layout: 'hand.yml') do
55
+ %w(title bonus1 bonus2 bonus3 bonus4 bonus5
56
+ description snark art).each do |icon|
57
+ text str: icon.capitalize, layout: icon,
58
+ hint: :red, valign: 'middle', align: 'center'
59
+ end
60
+ save_png prefix: 'layout_builtin_hand_'
61
+ end
62
+
63
+ # Layouts can also be specified in their own DSL method call
64
+ # Each layout call will progressively be merged with the priors
65
+ Squib::Deck.new do
66
+ use_layout file: 'custom-layout.yml'
67
+ use_layout file: 'custom-layout2.yml'
68
+ text str: 'The Title', layout: :title # from custom-layout.yml
69
+ text str: 'The Subtitle', layout: :subtitle # redefined in custom-layout2.yml
70
+ save_png prefix: 'layout3_'
71
+ end
@@ -1,8 +1,8 @@
1
- require 'squib'
2
-
3
- Squib::Deck.new do
4
- background color: :white
5
- text str: "Built at #{Time.now}"
6
- svg file: 'robot-golem.svg'
7
- save_png prefix: 'character_'
8
- end
1
+ require 'squib'
2
+
3
+ Squib::Deck.new do
4
+ background color: :white
5
+ text str: "Built at #{Time.now}"
6
+ svg file: 'robot-golem.svg'
7
+ save_png prefix: 'character_'
8
+ end
@@ -1,7 +1,7 @@
1
- require 'squib'
2
-
3
- Squib::Deck.new do
4
- background color: :white
5
- text str: "Built at #{Time.now}"
6
- save_png prefix: 'skill_'
7
- end
1
+ require 'squib'
2
+
3
+ Squib::Deck.new do
4
+ background color: :white
5
+ text str: "Built at #{Time.now}"
6
+ save_png prefix: 'skill_'
7
+ end
@@ -1,16 +1,16 @@
1
- require 'squib'
2
-
3
- # This sample uses a proof overlay from TheGameCrafter.com to check bleed
4
- Squib::Deck.new(width: 825, height: 1125, cards: 1) do
5
- background color: :white
6
- rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38
7
- rect x: 75, y: 75, width: 128, height: 128, x_radius: 25, y_radius: 25
8
-
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
-
12
- # TGC proof overlay (using alpha-transparency)
13
- png file: 'pokercard.png', x:0, y:0, alpha: 0.5
14
-
15
- save_png prefix: 'tgc_sample_'
16
- end
1
+ require 'squib'
2
+
3
+ # This sample uses a proof overlay from TheGameCrafter.com to check bleed
4
+ Squib::Deck.new(width: 825, height: 1125, cards: 1) do
5
+ background color: :white
6
+ rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38
7
+ rect x: 75, y: 75, width: 128, height: 128, x_radius: 25, y_radius: 25
8
+
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
+
12
+ # TGC proof overlay (using alpha-transparency)
13
+ png file: 'pokercard.png', x:0, y:0, alpha: 0.5
14
+
15
+ save_png prefix: 'tgc_sample_'
16
+ end
@@ -1,64 +1,64 @@
1
- require 'squib'
2
-
3
- data = { 'name' => ['Thief', 'Grifter', 'Mastermind'],
4
- 'type' => ['Thug', 'Thinker', 'Thinker'],
5
- 'level' => [1, 2, 3] }
6
-
7
- Squib::Deck.new(width: 825, height: 1125, cards: 3) do
8
- # Default range is :all
9
- background color: :white
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
-
13
- # Could be explicit about using :all, too
14
- text range: :all,
15
- str: data['type'], x: 40, y: 128, font: 'Arial 6',
16
- width: 100, align: :center
17
-
18
- # Ranges are inclusive, zero-based
19
- text range: 0..1, str: 'Thief and Grifter only!!', x: 25, y:200
20
-
21
- # Integers are also allowed
22
- text range: 0, str: 'Thief only!', x: 25, y: 250
23
-
24
- # Negatives go from the back of the deck
25
- text range: -1, str: 'Mastermind only!', x: 25, y: 250
26
- text range: -2..-1, str: 'Grifter and Mastermind only!', x: 25, y: 650
27
-
28
- # We can use Arrays too!
29
- text range: [0, 2], str: 'Thief and Mastermind only!!', x: 25, y:300
30
-
31
- # Just about everything in Squib can be given an array that
32
- # corresponds to the deck's cards. This allows for each card to be styled differently
33
- # This renders three cards, with three strings that had three different colors at three different locations.
34
- text str: %w(red green blue),
35
- color: [:red, :green, :blue],
36
- x: [40, 80, 120],
37
- y: [700, 750, 800]
38
-
39
- # Useful idiom: construct a hash from card names back to its index (ID),
40
- # then use a range. No need to memorize IDs, and you can add cards easily
41
- id = {} ; data['name'].each_with_index{ |name, i| id[name] = i}
42
- text range: id['Thief']..id['Grifter'],
43
- str: 'Thief through Grifter with id lookup!!',
44
- x:25, y: 400
45
-
46
- # Useful idiom: generate arrays from a column called 'type'
47
- type = {}; data['type'].each_with_index{ |t, i| (type[t] ||= []) << i}
48
- text range: type['Thinker'],
49
- str: 'Only for Thinkers!',
50
- x:25, y: 500
51
-
52
- # Useful idiom: draw a different number of images for different cards
53
- hearts = [nil, 1, 2] # i.e. card 0 has no hearts, card 2 has 2 hearts drawn
54
- 1.upto(2).each do |n|
55
- range = hearts.each_index.select { |i| hearts[i] == n}
56
- n.times do |i|
57
- svg file: 'glass-heart.svg', range: range,
58
- x: 150, y: 55 + i * 42, width: 40, height: 40
59
- end
60
- end
61
-
62
- rect color: 'black' # just a border
63
- save_sheet prefix: 'ranges_', columns: 3
64
- end
1
+ require 'squib'
2
+
3
+ data = { 'name' => ['Thief', 'Grifter', 'Mastermind'],
4
+ 'type' => ['Thug', 'Thinker', 'Thinker'],
5
+ 'level' => [1, 2, 3] }
6
+
7
+ Squib::Deck.new(width: 825, height: 1125, cards: 3) do
8
+ # Default range is :all
9
+ background color: :white
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
+
13
+ # Could be explicit about using :all, too
14
+ text range: :all,
15
+ str: data['type'], x: 40, y: 128, font: 'Arial 6',
16
+ width: 100, align: :center
17
+
18
+ # Ranges are inclusive, zero-based
19
+ text range: 0..1, str: 'Thief and Grifter only!!', x: 25, y:200
20
+
21
+ # Integers are also allowed
22
+ text range: 0, str: 'Thief only!', x: 25, y: 250
23
+
24
+ # Negatives go from the back of the deck
25
+ text range: -1, str: 'Mastermind only!', x: 25, y: 250
26
+ text range: -2..-1, str: 'Grifter and Mastermind only!', x: 25, y: 650
27
+
28
+ # We can use Arrays too!
29
+ text range: [0, 2], str: 'Thief and Mastermind only!!', x: 25, y:300
30
+
31
+ # Just about everything in Squib can be given an array that
32
+ # corresponds to the deck's cards. This allows for each card to be styled differently
33
+ # This renders three cards, with three strings that had three different colors at three different locations.
34
+ text str: %w(red green blue),
35
+ color: [:red, :green, :blue],
36
+ x: [40, 80, 120],
37
+ y: [700, 750, 800]
38
+
39
+ # Useful idiom: construct a hash from card names back to its index (ID),
40
+ # then use a range. No need to memorize IDs, and you can add cards easily
41
+ id = {} ; data['name'].each_with_index{ |name, i| id[name] = i}
42
+ text range: id['Thief']..id['Grifter'],
43
+ str: 'Thief through Grifter with id lookup!!',
44
+ x:25, y: 400
45
+
46
+ # Useful idiom: generate arrays from a column called 'type'
47
+ type = {}; data['type'].each_with_index{ |t, i| (type[t] ||= []) << i}
48
+ text range: type['Thinker'],
49
+ str: 'Only for Thinkers!',
50
+ x:25, y: 500
51
+
52
+ # Useful idiom: draw a different number of images for different cards
53
+ hearts = [nil, 1, 2] # i.e. card 0 has no hearts, card 2 has 2 hearts drawn
54
+ 1.upto(2).each do |n|
55
+ range = hearts.each_index.select { |i| hearts[i] == n}
56
+ n.times do |i|
57
+ svg file: 'glass-heart.svg', range: range,
58
+ x: 150, y: 55 + i * 42, width: 40, height: 40
59
+ end
60
+ end
61
+
62
+ rect color: 'black' # just a border
63
+ save_sheet prefix: 'ranges_', columns: 3
64
+ end
@@ -1,23 +1,23 @@
1
- require 'squib'
2
-
3
- Squib::Deck.new(cards: 8, layout: 'playing-card.yml') do
4
- background color: :cyan
5
- rect x: 37, y: 37, width: 750, height: 1050, fill_color: :black, radius: 25
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 33'
8
-
9
- # Defaults are sensible
10
- hand # saves to _output/hand.png
11
-
12
- # Here's a prettier version:
13
- # - Each card is trimmed with rounded corners
14
- # - Zero radius means cards rotate about the bottom of the card
15
- # - Cards are shown in reverse order
16
- hand trim: 37.5, trim_radius: 25,
17
- radius: 0,
18
- range: 7.downto(0),
19
- file: 'hand_pretty.png'
20
-
21
- # Tip: you can have the top card be on the left by reversing the range
22
- # angle_range: (Math::PI / 4)..(Math::PI / -4)
23
- end
1
+ require 'squib'
2
+
3
+ Squib::Deck.new(cards: 8, layout: 'playing-card.yml') do
4
+ background color: :cyan
5
+ rect x: 37, y: 37, width: 750, height: 1050, fill_color: :black, radius: 25
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 33'
8
+
9
+ # Defaults are sensible
10
+ hand # saves to _output/hand.png
11
+
12
+ # Here's a prettier version:
13
+ # - Each card is trimmed with rounded corners
14
+ # - Zero radius means cards rotate about the bottom of the card
15
+ # - Cards are shown in reverse order
16
+ hand trim: 37.5, trim_radius: 25,
17
+ radius: 0,
18
+ range: 7.downto(0),
19
+ file: 'hand_pretty.png'
20
+
21
+ # Tip: you can have the top card be on the left by reversing the range
22
+ # angle_range: (Math::PI / 4)..(Math::PI / -4)
23
+ end
@@ -1,23 +1,23 @@
1
- require 'squib'
2
-
3
- # For decks with both landscape and portrait orientations,
4
- # we recommend using two separate decks.
5
- # For print-on-demand, we can rotate all of the images in the final step.
6
-
7
- # Normal cards
8
- Squib::Deck.new(width: 825, height: 1125) do
9
- background color: '#aaa'
10
-
11
- text str: 'This is portrait and trimmed'
12
-
13
- save_png prefix: 'portrait_', trim: 10, trim_radius: 15
14
- end
15
-
16
- # Money cards are landscape
17
- Squib::Deck.new(width: 1125, height: 825) do
18
- background color: '#aaa'
19
-
20
- text str: 'This is landscape and trimmed', x: 15, y: 10
21
-
22
- save_png prefix: 'landscape_', rotate: :clockwise, trim: 25, trim_radius: 15
23
- end
1
+ require 'squib'
2
+
3
+ # For decks with both landscape and portrait orientations,
4
+ # we recommend using two separate decks.
5
+ # For print-on-demand, we can rotate all of the images in the final step.
6
+
7
+ # Normal cards
8
+ Squib::Deck.new(width: 825, height: 1125) do
9
+ background color: '#aaa'
10
+
11
+ text str: 'This is portrait and trimmed'
12
+
13
+ save_png prefix: 'portrait_', trim: 10, trim_radius: 15
14
+ end
15
+
16
+ # Money cards are landscape
17
+ Squib::Deck.new(width: 1125, height: 825) do
18
+ background color: '#aaa'
19
+
20
+ text str: 'This is landscape and trimmed', x: 15, y: 10
21
+
22
+ save_png prefix: 'landscape_', rotate: :clockwise, trim: 25, trim_radius: 15
23
+ end
@@ -1,29 +1,29 @@
1
- require 'squib'
2
-
3
- Squib::Deck.new(cards: 8) do
4
- background color: :gray
5
- rect x: 37.5, y: 37.5, width: 750, height: 1050,
6
- x_radius: 37.5, y_radius: 37.5, stroke: 3.0, dash: '4 4'
7
-
8
- # Tests for crop marks
9
- save_pdf file: 'crops-default.pdf', crop_marks: true
10
- save_pdf file: 'crops-gapped.pdf', crop_marks: true, trim: 37.5, gap: 20
11
-
12
- # Test crop marks with all the bells and whistles
13
- rect x: '0.3in', y: '0.4in', width: '2in', height: '2.5in'
14
- save_pdf file: 'crops-custom.pdf', crop_marks: true, trim: 0, gap: 20,
15
- crop_stroke_dash: '5 5', crop_stroke_color: :red, crop_stroke_width: 4.0,
16
- crop_margin_left: '0.3in', crop_margin_right: '0.45in',
17
- crop_margin_top: '0.4in', crop_margin_bottom: '0.85in'
18
-
19
- # Full crop marks
20
- save_pdf file: 'crops-full.pdf', crop_marks: :full,
21
- trim: 0, gap: 20,
22
- crop_stroke_dash: '5 5', crop_stroke_color: :red, crop_stroke_width: 4.0,
23
- crop_margin_left: '0.3in', crop_margin_right: '0.45in',
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
-
29
- end
1
+ require 'squib'
2
+
3
+ Squib::Deck.new(cards: 8) do
4
+ background color: :gray
5
+ rect x: 37.5, y: 37.5, width: 750, height: 1050,
6
+ x_radius: 37.5, y_radius: 37.5, stroke: 3.0, dash: '4 4'
7
+
8
+ # Tests for crop marks
9
+ save_pdf file: 'crops-default.pdf', crop_marks: true
10
+ save_pdf file: 'crops-gapped.pdf', crop_marks: true, trim: 37.5, gap: 20
11
+
12
+ # Test crop marks with all the bells and whistles
13
+ rect x: '0.3in', y: '0.4in', width: '2in', height: '2.5in'
14
+ save_pdf file: 'crops-custom.pdf', crop_marks: true, trim: 0, gap: 20,
15
+ crop_stroke_dash: '5 5', crop_stroke_color: :red, crop_stroke_width: 4.0,
16
+ crop_margin_left: '0.3in', crop_margin_right: '0.45in',
17
+ crop_margin_top: '0.4in', crop_margin_bottom: '0.85in'
18
+
19
+ # Full crop marks
20
+ save_pdf file: 'crops-full.pdf', crop_marks: :full,
21
+ trim: 0, gap: 20,
22
+ crop_stroke_dash: '5 5', crop_stroke_color: :red, crop_stroke_width: 4.0,
23
+ crop_margin_left: '0.3in', crop_margin_right: '0.45in',
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
+
29
+ end