squib 0.18.0 → 0.19.0a

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.
Files changed (202) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +39 -39
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +22 -22
  4. data/.github/ISSUE_TEMPLATE/help-wanted.md +13 -13
  5. data/.github/ISSUE_TEMPLATE/release-todo.md +45 -33
  6. data/.github/PULL_REQUEST_TEMPLATE.md +13 -13
  7. data/.github/workflows/tests.yml +22 -22
  8. data/.gitignore +41 -41
  9. data/.vscode/settings.json +4 -3
  10. data/CHANGELOG.md +460 -460
  11. data/CONTRIBUTING.md +40 -40
  12. data/Dockerfile +27 -27
  13. data/Gemfile +2 -2
  14. data/Guardfile +8 -8
  15. data/LICENSE.txt +22 -22
  16. data/README.md +139 -139
  17. data/Rakefile +51 -51
  18. data/bin/squib +5 -5
  19. data/lib/squib/api/settings.rb +21 -21
  20. data/lib/squib/args/arg_loader.rb +138 -138
  21. data/lib/squib/args/box.rb +59 -59
  22. data/lib/squib/args/card_range.rb +34 -34
  23. data/lib/squib/args/color_validator.rb +7 -7
  24. data/lib/squib/args/coords.rb +49 -49
  25. data/lib/squib/args/csv_opts.rb +22 -22
  26. data/lib/squib/args/dir_validator.rb +11 -11
  27. data/lib/squib/args/draw.rb +93 -93
  28. data/lib/squib/args/drop_shadow.rb +39 -39
  29. data/lib/squib/args/embed_adjust.rb +22 -22
  30. data/lib/squib/args/embed_key.rb +12 -12
  31. data/lib/squib/args/hand_special.rb +37 -37
  32. data/lib/squib/args/import.rb +67 -67
  33. data/lib/squib/args/input_file.rb +55 -55
  34. data/lib/squib/args/paint.rb +43 -43
  35. data/lib/squib/args/paragraph.rb +118 -118
  36. data/lib/squib/args/save_batch.rb +65 -65
  37. data/lib/squib/args/scale_box.rb +57 -57
  38. data/lib/squib/args/sheet.rb +165 -165
  39. data/lib/squib/args/showcase_special.rb +41 -41
  40. data/lib/squib/args/sprue_file.rb +44 -44
  41. data/lib/squib/args/svg_special.rb +37 -37
  42. data/lib/squib/args/transform.rb +55 -55
  43. data/lib/squib/args/typographer.rb +115 -115
  44. data/lib/squib/args/unit_conversion.rb +27 -27
  45. data/lib/squib/args/xywh_shorthands.rb +50 -50
  46. data/lib/squib/builtin/layouts/economy.yml +85 -85
  47. data/lib/squib/builtin/layouts/fantasy.yml +101 -101
  48. data/lib/squib/builtin/layouts/hand.yml +62 -62
  49. data/lib/squib/builtin/layouts/party.yml +94 -94
  50. data/lib/squib/builtin/layouts/playing-card.yml +35 -35
  51. data/lib/squib/builtin/layouts/tuck_box.yml +46 -46
  52. data/lib/squib/builtin/projects/advanced/.gitignore +4 -4
  53. data/lib/squib/builtin/projects/advanced/ABOUT.md +19 -19
  54. data/lib/squib/builtin/projects/advanced/Gemfile +11 -11
  55. data/lib/squib/builtin/projects/advanced/Guardfile +21 -21
  56. data/lib/squib/builtin/projects/advanced/IDEAS.md +22 -22
  57. data/lib/squib/builtin/projects/advanced/PLAYTESTING.md +26 -26
  58. data/lib/squib/builtin/projects/advanced/Rakefile +27 -27
  59. data/lib/squib/builtin/projects/advanced/config.yml +49 -49
  60. data/lib/squib/builtin/projects/advanced/docs/PNP NOTES.md +3 -3
  61. data/lib/squib/builtin/projects/advanced/docs/RULES.md +21 -21
  62. data/lib/squib/builtin/projects/advanced/img/example.svg +60 -60
  63. data/lib/squib/builtin/projects/advanced/layouts/deck.yml +27 -27
  64. data/lib/squib/builtin/projects/advanced/src/deck.rb +34 -34
  65. data/lib/squib/builtin/projects/advanced/src/version.rb +3 -3
  66. data/lib/squib/builtin/projects/basic/.gitignore +4 -4
  67. data/lib/squib/builtin/projects/basic/ABOUT.md +19 -19
  68. data/lib/squib/builtin/projects/basic/Gemfile +3 -3
  69. data/lib/squib/builtin/projects/basic/IDEAS.md +22 -22
  70. data/lib/squib/builtin/projects/basic/PLAYTESTING.md +26 -26
  71. data/lib/squib/builtin/projects/basic/PNP NOTES.md +3 -3
  72. data/lib/squib/builtin/projects/basic/RULES.md +21 -21
  73. data/lib/squib/builtin/projects/basic/Rakefile +7 -7
  74. data/lib/squib/builtin/projects/basic/config.yml +50 -50
  75. data/lib/squib/builtin/projects/basic/deck.rb +6 -6
  76. data/lib/squib/builtin/sprues/a4_euro_card.yml +42 -42
  77. data/lib/squib/builtin/sprues/a4_poker_card_8up.yml +40 -40
  78. data/lib/squib/builtin/sprues/a4_poker_card_9up.yml +42 -42
  79. data/lib/squib/builtin/sprues/a4_usa_card.yml +42 -42
  80. data/lib/squib/builtin/sprues/drivethrucards_1up.yml +10 -10
  81. data/lib/squib/builtin/sprues/letter_poker_card_9up.yml +25 -25
  82. data/lib/squib/builtin/sprues/letter_poker_foldable_8up.yml +52 -52
  83. data/lib/squib/builtin/sprues/printplaygames_18up.yml +68 -68
  84. data/lib/squib/card.rb +75 -75
  85. data/lib/squib/commands/cli.rb +39 -39
  86. data/lib/squib/commands/data/template_option.rb +109 -109
  87. data/lib/squib/commands/make_sprue.rb +277 -277
  88. data/lib/squib/commands/new.rb +77 -77
  89. data/lib/squib/conf.rb +149 -149
  90. data/lib/squib/constants.rb +17 -17
  91. data/lib/squib/deck.rb +138 -138
  92. data/lib/squib/dsl/background.rb +35 -35
  93. data/lib/squib/dsl/circle.rb +39 -39
  94. data/lib/squib/dsl/csv.rb +42 -42
  95. data/lib/squib/dsl/curve.rb +35 -35
  96. data/lib/squib/dsl/cut_zone.rb +47 -47
  97. data/lib/squib/dsl/ellipse.rb +37 -37
  98. data/lib/squib/dsl/grid.rb +35 -35
  99. data/lib/squib/dsl/groups.rb +54 -54
  100. data/lib/squib/dsl/hand.rb +42 -42
  101. data/lib/squib/dsl/line.rb +35 -35
  102. data/lib/squib/dsl/png.rb +57 -57
  103. data/lib/squib/dsl/polygon.rb +36 -36
  104. data/lib/squib/dsl/rect.rb +37 -37
  105. data/lib/squib/dsl/safe_zone.rb +48 -48
  106. data/lib/squib/dsl/save.rb +21 -21
  107. data/lib/squib/dsl/save_pdf.rb +50 -50
  108. data/lib/squib/dsl/save_png.rb +48 -48
  109. data/lib/squib/dsl/save_sheet.rb +53 -53
  110. data/lib/squib/dsl/showcase.rb +43 -43
  111. data/lib/squib/dsl/star.rb +37 -37
  112. data/lib/squib/dsl/svg.rb +63 -63
  113. data/lib/squib/dsl/text.rb +54 -54
  114. data/lib/squib/dsl/text_embed.rb +79 -79
  115. data/lib/squib/dsl/triangle.rb +35 -35
  116. data/lib/squib/dsl/units.rb +37 -37
  117. data/lib/squib/dsl/xlsx.rb +40 -40
  118. data/lib/squib/dsl/yaml.rb +40 -40
  119. data/lib/squib/errors_warnings/warn_unexpected_params.rb +14 -14
  120. data/lib/squib/graphics/background.rb +14 -14
  121. data/lib/squib/graphics/cairo_context_wrapper.rb +115 -115
  122. data/lib/squib/graphics/embedding_utils.rb +28 -28
  123. data/lib/squib/graphics/gradient_regex.rb +47 -47
  124. data/lib/squib/graphics/hand.rb +42 -42
  125. data/lib/squib/graphics/image.rb +123 -123
  126. data/lib/squib/graphics/save_doc.rb +77 -77
  127. data/lib/squib/graphics/save_images.rb +91 -91
  128. data/lib/squib/graphics/save_pdf.rb +90 -90
  129. data/lib/squib/graphics/save_sprue.rb +231 -231
  130. data/lib/squib/graphics/shapes.rb +143 -143
  131. data/lib/squib/graphics/showcase.rb +85 -85
  132. data/lib/squib/graphics/text.rb +202 -202
  133. data/lib/squib/import/csv_importer.rb +45 -45
  134. data/lib/squib/import/data_frame.rb +108 -108
  135. data/lib/squib/import/quantity_exploder.rb +17 -17
  136. data/lib/squib/import/xlsx_importer.rb +28 -28
  137. data/lib/squib/import/yaml_importer.rb +30 -30
  138. data/lib/squib/layout_parser.rb +155 -155
  139. data/lib/squib/progress.rb +38 -38
  140. data/lib/squib/sample_helpers.rb +34 -34
  141. data/lib/squib/sprues/crop_line.rb +28 -28
  142. data/lib/squib/sprues/crop_line_dash.rb +35 -35
  143. data/lib/squib/sprues/invalid_sprue_definition.rb +9 -9
  144. data/lib/squib/sprues/sprue.rb +208 -208
  145. data/lib/squib/sprues/sprue_schema.rb +51 -51
  146. data/lib/squib/system_fonts.rb +16 -16
  147. data/lib/squib/version.rb +11 -11
  148. data/lib/squib.rb +35 -35
  149. data/samples/autoscale_font/_autoscale_font.rb +98 -98
  150. data/samples/backend/_backend.rb +26 -26
  151. data/samples/basic.rb +19 -19
  152. data/samples/build_groups/build_groups.rb +36 -36
  153. data/samples/colors/_colors.rb +44 -44
  154. data/samples/colors/_gradients.rb +34 -34
  155. data/samples/colors/_switch_color.rb +33 -33
  156. data/samples/config/config_text_markup.rb +20 -20
  157. data/samples/config/custom_config.rb +18 -18
  158. data/samples/data/_csv.rb +33 -33
  159. data/samples/data/_excel.rb +55 -55
  160. data/samples/data/_yaml.rb +12 -12
  161. data/samples/hello_world.rb +6 -6
  162. data/samples/images/_cairo_access.rb +39 -39
  163. data/samples/images/_images.rb +104 -104
  164. data/samples/images/_more_load_images.rb +102 -102
  165. data/samples/images/_placeholders.rb +48 -48
  166. data/samples/intro/01_hello.rb +8 -8
  167. data/samples/intro/02_options.rb +14 -14
  168. data/samples/intro/03_layout.rb +11 -11
  169. data/samples/intro/04_arrays.rb +15 -15
  170. data/samples/intro/05_excel.rb +14 -14
  171. data/samples/layouts/builtin_layouts.rb +97 -97
  172. data/samples/layouts/layouts.rb +71 -71
  173. data/samples/project/src/characters.rb +8 -8
  174. data/samples/project/src/skills.rb +7 -7
  175. data/samples/proofs/_tgc_proofs.rb +16 -16
  176. data/samples/ranges/_ranges.rb +64 -64
  177. data/samples/saves/_hand.rb +23 -23
  178. data/samples/saves/_portrait_landscape.rb +23 -23
  179. data/samples/saves/_save_filenames.rb +28 -28
  180. data/samples/saves/_save_pdf.rb +29 -29
  181. data/samples/saves/_saves.rb +75 -75
  182. data/samples/saves/_showcase.rb +25 -25
  183. data/samples/shadows/_shadow.rb +71 -71
  184. data/samples/shapes/_draw_shapes.rb +60 -60
  185. data/samples/shapes/_proofs.rb +22 -22
  186. data/samples/sprues/_advanced_sprues.rb +25 -25
  187. data/samples/sprues/_builtin_sprues.rb +22 -22
  188. data/samples/sprues/_fold_sheet.rb +30 -30
  189. data/samples/sprues/_hex_tiles.rb +15 -15
  190. data/samples/sprues/_mints.rb +11 -11
  191. data/samples/sprues/_negative_coords.rb +6 -6
  192. data/samples/sprues/_sprue_example.rb +11 -11
  193. data/samples/system_font_debug/_list_fonts.rb +14 -14
  194. data/samples/text/_embed_text.rb +128 -128
  195. data/samples/text/_text.rb +52 -52
  196. data/samples/text/_text_options.rb +103 -103
  197. data/samples/text/bug134.rb +14 -14
  198. data/samples/units/_cells.rb +50 -50
  199. data/samples/units/_shorthands.rb +48 -48
  200. data/samples/units/_units.rb +39 -39
  201. data/squib.gemspec +58 -58
  202. metadata +21 -21
@@ -1,103 +1,103 @@
1
- # encoding: UTF-8
2
- # require 'squib'
3
- require_relative '../../lib/squib'
4
-
5
- data = { 'name' => ['Thief', 'Grifter', 'Mastermind'],
6
- 'level' => [1, 2, 3] }
7
- longtext = "This is left-justified text, with newlines.\nWhat do you know about tweetle beetles? well... When tweetle beetles fight, it's called a tweetle beetle battle. And when they battle in a puddle, it's a tweetle beetle puddle battle. AND when tweetle beetles battle with paddles in a puddle, they call it a tweetle beetle puddle paddle battle. AND... When beetles battle beetles in a puddle paddle battle and the beetle battle puddle is a puddle in a bottle... ..they call this a tweetle beetle bottle puddle paddle battle muddle."
8
-
9
- Squib::Deck.new(width: 825, height: 1125, cards: 3) do
10
- background color: :white
11
- rect x: 15, y: 15, width: 795, height: 1095, x_radius: 50, y_radius: 50
12
- rect x: 30, y: 30, width: 128, height: 128, x_radius: 25, y_radius: 25
13
-
14
- # Arrays are rendered over each card
15
- text str: data['name'], x: 250, y: 55, font: 'Arial weight=900 18'
16
- text str: data['level'], x: 65, y: 40, font: 'Arial 24', color: :burnt_orange
17
-
18
- text str: 'Font strings are expressive!', x:65, y: 200,
19
- font: 'Impact bold italic 12'
20
-
21
- text str: 'Font strings are expressive!', x:65, y: 300,
22
- font: 'Arial,Verdana weight=900 style=oblique 12'
23
-
24
- text str: 'Font string sizes can be overridden per card.', x: 65, y: 350,
25
- font: 'Impact 12', font_size: [5, 7, 8]
26
-
27
- text str: 'This text has fixed width, fixed height, center-aligned, middle-valigned, and has a red hint',
28
- hint: :red,
29
- x: 65, y: 400,
30
- width: 300, height: 125,
31
- align: :center, valign: 'MIDDLE', # these can be specified with case-insenstive strings too
32
- font: 'Serif 5'
33
-
34
- extents = text str: 'Ink extent return value',
35
- x: 65, y: 550,
36
- font: 'Sans Bold', font_size: [5, 7, 8]
37
- margin = 10
38
- # Extents come back as an array of hashes, which can get split out like this
39
- ws = extents.inject([]) { |arr, ext| arr << ext[:width] + 10; arr }
40
- hs = extents.inject([]) { |arr, ext| arr << ext[:height] + 10; arr }
41
- rect x: 65 - margin / 2, y: 550 - margin / 2,
42
- width: ws, height: hs,
43
- radius: 10, stroke_color: :black
44
-
45
- # If width & height are defined and the text will overflow the box, we can ellipsize.
46
- text str: "Ellipsization!\nThe ultimate question of life, the universe, and everything to life and everything is 42",
47
- hint: :green, font: 'Arial 7',
48
- x: 450, y: 400,
49
- width: 280, height: 180,
50
- ellipsize: true
51
-
52
- # Text hints are guides for showing you how your text boxes are laid out exactly
53
- hint text: :cyan
54
- set font: 'Serif 7' # Impacts all future text calls (unless they specify differently)
55
- text str: 'Text hints & fonts are globally togglable!', x: 65, y: 625
56
- set font: :default # back to Squib-wide default
57
- hint text: :off
58
- text str: 'See? No hint here.',
59
- x: 565, y: 625,
60
- font: 'Arial 7'
61
-
62
- # Text can be rotated, in radians, about the upper-left corner of the text box.
63
- text str: 'Rotated',
64
- x: 565, y: 675, angle: 0.2,
65
- font: 'Arial 6', hint: :red
66
-
67
- # Text can be justified, and have newlines
68
- text str: longtext, font: 'Arial 5',
69
- x: 65, y: 700,
70
- width: '1.5in', height: inches(1),
71
- justify: true, spacing: -6
72
-
73
- # Here's how you embed images into text.
74
- # Pass a block to the method call and use the given context
75
- embed_text = 'Embedded icons! Take 1 :tool: and gain 2:health:. If Level 2, take 2 :tool:'
76
- text(str: embed_text, font: 'Sans 6',
77
- x: '1.8in', y: '2.5in', width: '0.85in',
78
- align: :left, ellipsize: false) do |embed|
79
- embed.svg key: ':tool:', width: 28, height: 28, file: 'spanner.svg'
80
- embed.svg key: ':health:', width: 28, height: 28, file: 'glass-heart.svg'
81
- end
82
-
83
- text str: 'Fill n <span fgcolor="#ff0000">stroke</span>',
84
- color: :green, stroke_width: 2.0, stroke_color: :blue,
85
- x: '1.8in', y: '2.9in', width: '0.85in', font: 'Sans Bold 9', markup: true
86
-
87
- text str: 'Stroke n <span fgcolor="#ff0000">fill</span>',
88
- color: :green, stroke_width: 2.0, stroke_color: :blue, stroke_strategy: :stroke_first,
89
- x: '1.8in', y: '3.0in', width: '0.85in', font: 'Sans Bold 9', markup: true
90
-
91
- text str: 'Dotted',
92
- color: :white, stroke_width: 2.0, dash: '4 2', stroke_color: :black,
93
- x: '1.8in', y: '3.1in', width: '0.85in', font: 'Sans Bold 9', markup: true
94
- #
95
- text str: "<b>Markup</b> is <i>quite</i> <s>'easy'</s> <span fgcolor=\"\#ff0000\">awesome</span>. Can't beat those \"smart\" 'quotes', now with 10--20% more en-dashes --- and em-dashes --- with explicit ellipses too...",
96
- markup: true,
97
- x: 50, y: 1000,
98
- width: 750, height: 100,
99
- valign: :bottom,
100
- font: 'Serif 6', hint: :cyan
101
-
102
- save prefix: 'text_options_', format: :png
103
- end
1
+ # encoding: UTF-8
2
+ # require 'squib'
3
+ require_relative '../../lib/squib'
4
+
5
+ data = { 'name' => ['Thief', 'Grifter', 'Mastermind'],
6
+ 'level' => [1, 2, 3] }
7
+ longtext = "This is left-justified text, with newlines.\nWhat do you know about tweetle beetles? well... When tweetle beetles fight, it's called a tweetle beetle battle. And when they battle in a puddle, it's a tweetle beetle puddle battle. AND when tweetle beetles battle with paddles in a puddle, they call it a tweetle beetle puddle paddle battle. AND... When beetles battle beetles in a puddle paddle battle and the beetle battle puddle is a puddle in a bottle... ..they call this a tweetle beetle bottle puddle paddle battle muddle."
8
+
9
+ Squib::Deck.new(width: 825, height: 1125, cards: 3) do
10
+ background color: :white
11
+ rect x: 15, y: 15, width: 795, height: 1095, x_radius: 50, y_radius: 50
12
+ rect x: 30, y: 30, width: 128, height: 128, x_radius: 25, y_radius: 25
13
+
14
+ # Arrays are rendered over each card
15
+ text str: data['name'], x: 250, y: 55, font: 'Arial weight=900 18'
16
+ text str: data['level'], x: 65, y: 40, font: 'Arial 24', color: :burnt_orange
17
+
18
+ text str: 'Font strings are expressive!', x:65, y: 200,
19
+ font: 'Impact bold italic 12'
20
+
21
+ text str: 'Font strings are expressive!', x:65, y: 300,
22
+ font: 'Arial,Verdana weight=900 style=oblique 12'
23
+
24
+ text str: 'Font string sizes can be overridden per card.', x: 65, y: 350,
25
+ font: 'Impact 12', font_size: [5, 7, 8]
26
+
27
+ text str: 'This text has fixed width, fixed height, center-aligned, middle-valigned, and has a red hint',
28
+ hint: :red,
29
+ x: 65, y: 400,
30
+ width: 300, height: 125,
31
+ align: :center, valign: 'MIDDLE', # these can be specified with case-insenstive strings too
32
+ font: 'Serif 5'
33
+
34
+ extents = text str: 'Ink extent return value',
35
+ x: 65, y: 550,
36
+ font: 'Sans Bold', font_size: [5, 7, 8]
37
+ margin = 10
38
+ # Extents come back as an array of hashes, which can get split out like this
39
+ ws = extents.inject([]) { |arr, ext| arr << ext[:width] + 10; arr }
40
+ hs = extents.inject([]) { |arr, ext| arr << ext[:height] + 10; arr }
41
+ rect x: 65 - margin / 2, y: 550 - margin / 2,
42
+ width: ws, height: hs,
43
+ radius: 10, stroke_color: :black
44
+
45
+ # If width & height are defined and the text will overflow the box, we can ellipsize.
46
+ text str: "Ellipsization!\nThe ultimate question of life, the universe, and everything to life and everything is 42",
47
+ hint: :green, font: 'Arial 7',
48
+ x: 450, y: 400,
49
+ width: 280, height: 180,
50
+ ellipsize: true
51
+
52
+ # Text hints are guides for showing you how your text boxes are laid out exactly
53
+ hint text: :cyan
54
+ set font: 'Serif 7' # Impacts all future text calls (unless they specify differently)
55
+ text str: 'Text hints & fonts are globally togglable!', x: 65, y: 625
56
+ set font: :default # back to Squib-wide default
57
+ hint text: :off
58
+ text str: 'See? No hint here.',
59
+ x: 565, y: 625,
60
+ font: 'Arial 7'
61
+
62
+ # Text can be rotated, in radians, about the upper-left corner of the text box.
63
+ text str: 'Rotated',
64
+ x: 565, y: 675, angle: 0.2,
65
+ font: 'Arial 6', hint: :red
66
+
67
+ # Text can be justified, and have newlines
68
+ text str: longtext, font: 'Arial 5',
69
+ x: 65, y: 700,
70
+ width: '1.5in', height: inches(1),
71
+ justify: true, spacing: -6
72
+
73
+ # Here's how you embed images into text.
74
+ # Pass a block to the method call and use the given context
75
+ embed_text = 'Embedded icons! Take 1 :tool: and gain 2:health:. If Level 2, take 2 :tool:'
76
+ text(str: embed_text, font: 'Sans 6',
77
+ x: '1.8in', y: '2.5in', width: '0.85in',
78
+ align: :left, ellipsize: false) do |embed|
79
+ embed.svg key: ':tool:', width: 28, height: 28, file: 'spanner.svg'
80
+ embed.svg key: ':health:', width: 28, height: 28, file: 'glass-heart.svg'
81
+ end
82
+
83
+ text str: 'Fill n <span fgcolor="#ff0000">stroke</span>',
84
+ color: :green, stroke_width: 2.0, stroke_color: :blue,
85
+ x: '1.8in', y: '2.9in', width: '0.85in', font: 'Sans Bold 9', markup: true
86
+
87
+ text str: 'Stroke n <span fgcolor="#ff0000">fill</span>',
88
+ color: :green, stroke_width: 2.0, stroke_color: :blue, stroke_strategy: :stroke_first,
89
+ x: '1.8in', y: '3.0in', width: '0.85in', font: 'Sans Bold 9', markup: true
90
+
91
+ text str: 'Dotted',
92
+ color: :white, stroke_width: 2.0, dash: '4 2', stroke_color: :black,
93
+ x: '1.8in', y: '3.1in', width: '0.85in', font: 'Sans Bold 9', markup: true
94
+ #
95
+ text str: "<b>Markup</b> is <i>quite</i> <s>'easy'</s> <span fgcolor=\"\#ff0000\">awesome</span>. Can't beat those \"smart\" 'quotes', now with 10--20% more en-dashes --- and em-dashes --- with explicit ellipses too...",
96
+ markup: true,
97
+ x: 50, y: 1000,
98
+ width: 750, height: 100,
99
+ valign: :bottom,
100
+ font: 'Serif 6', hint: :cyan
101
+
102
+ save prefix: 'text_options_', format: :png
103
+ end
@@ -1,14 +1,14 @@
1
- require 'squib'
2
- require 'game_icons'
3
-
4
- Squib::Deck.new(cards: 1) do
5
- rect
6
- text str: 'foo', x: 275, y: 75, width: 500, height: 500, valign: :middle, hint: :blue
7
- text(str: '(heart)(heart2)',
8
- x: 75, y: 75, width: 500, height: 500,
9
- valign: :middle, hint: :red) do |embed|
10
- embed.svg key: '(heart)', width: 50, height: 50, data: GameIcons.get('glass-heart').string
11
- embed.svg key: '(heart2)', width: 50, height: 50, data: GameIcons.get('glass-heart').string
12
- end
13
- save_png prefix: 'bug_134_'
14
- end
1
+ require 'squib'
2
+ require 'game_icons'
3
+
4
+ Squib::Deck.new(cards: 1) do
5
+ rect
6
+ text str: 'foo', x: 275, y: 75, width: 500, height: 500, valign: :middle, hint: :blue
7
+ text(str: '(heart)(heart2)',
8
+ x: 75, y: 75, width: 500, height: 500,
9
+ valign: :middle, hint: :red) do |embed|
10
+ embed.svg key: '(heart)', width: 50, height: 50, data: GameIcons.get('glass-heart').string
11
+ embed.svg key: '(heart2)', width: 50, height: 50, data: GameIcons.get('glass-heart').string
12
+ end
13
+ save_png prefix: 'bug_134_'
14
+ end
@@ -1,51 +1,51 @@
1
- require 'squib'
2
-
3
- Squib::Deck.new(width: '1.5in', height: '1.5in') do
4
- background color: :white
5
-
6
- # Squib has a custom unit, called "cell"
7
- # A "cell" unit defaults to 37.5px, which at 300dpi is 1/8in or 3.175mm
8
- # This is a very common multiple for layouts.
9
- # This helps us lay things out in grids without doing much math in our heads
10
- # Here's an example... with grid!
11
- grid width: '1 cell', height: '1 cell'
12
-
13
- # Plurals are fine or just 'c' as a unit is fine
14
- # Whitespace is pretty lenient too.
15
- rect fill_color: :blue,
16
- x: '1 cell', y: '2 cells',
17
- width: '1c', height: '1cell '
18
-
19
- # Technically, the "cell" is actually a "unit", so you can even combine
20
- # with xywh shorhands!!
21
- rect fill_color: :red,
22
- x: 'middle + 0.5c', y: 'deck - 1.5c',
23
- width: '1c', height: '1c'
24
-
25
- # And, unlike xywh shorthands, this applies basically everywhere we support
26
- # unit conversion.
27
- circle fill_color: :green,
28
- x: '3c', y: '2c', radius: '1c'
29
- # Decimals are fine too
30
- circle fill_color: :green,
31
- x: '5c', y: '2c', radius: '0.5c'
32
- # Even dashes!
33
- circle fill_color: '#0000', stroke_color: :purple,
34
- x: '1c', y: '4c', radius: '0.5c', dash: '0.25c 0.25c'
35
-
36
- # We can also do stuff in layout. Check out the yml file...
37
- # (even cleaner in Yaml since we don't need quotes!)
38
- use_layout file: 'cells.yml'
39
- rect layout: :example
40
- rect layout: :extends_example
41
-
42
- save_png prefix: 'cells_'
43
- end
44
-
45
-
46
- # You can customize this with the cell_px configuration option
47
- Squib::Deck.new(width: 100, height: 100, config: 'cell_config.yml') do
48
- background color: :white
49
- rect x: '1c', y: '1c', width: '1c', height: '1c', fill_color: :purple
50
- save_png prefix: 'custom_cell_'
1
+ require 'squib'
2
+
3
+ Squib::Deck.new(width: '1.5in', height: '1.5in') do
4
+ background color: :white
5
+
6
+ # Squib has a custom unit, called "cell"
7
+ # A "cell" unit defaults to 37.5px, which at 300dpi is 1/8in or 3.175mm
8
+ # This is a very common multiple for layouts.
9
+ # This helps us lay things out in grids without doing much math in our heads
10
+ # Here's an example... with grid!
11
+ grid width: '1 cell', height: '1 cell'
12
+
13
+ # Plurals are fine or just 'c' as a unit is fine
14
+ # Whitespace is pretty lenient too.
15
+ rect fill_color: :blue,
16
+ x: '1 cell', y: '2 cells',
17
+ width: '1c', height: '1cell '
18
+
19
+ # Technically, the "cell" is actually a "unit", so you can even combine
20
+ # with xywh shorhands!!
21
+ rect fill_color: :red,
22
+ x: 'middle + 0.5c', y: 'deck - 1.5c',
23
+ width: '1c', height: '1c'
24
+
25
+ # And, unlike xywh shorthands, this applies basically everywhere we support
26
+ # unit conversion.
27
+ circle fill_color: :green,
28
+ x: '3c', y: '2c', radius: '1c'
29
+ # Decimals are fine too
30
+ circle fill_color: :green,
31
+ x: '5c', y: '2c', radius: '0.5c'
32
+ # Even dashes!
33
+ circle fill_color: '#0000', stroke_color: :purple,
34
+ x: '1c', y: '4c', radius: '0.5c', dash: '0.25c 0.25c'
35
+
36
+ # We can also do stuff in layout. Check out the yml file...
37
+ # (even cleaner in Yaml since we don't need quotes!)
38
+ use_layout file: 'cells.yml'
39
+ rect layout: :example
40
+ rect layout: :extends_example
41
+
42
+ save_png prefix: 'cells_'
43
+ end
44
+
45
+
46
+ # You can customize this with the cell_px configuration option
47
+ Squib::Deck.new(width: 100, height: 100, config: 'cell_config.yml') do
48
+ background color: :white
49
+ rect x: '1c', y: '1c', width: '1c', height: '1c', fill_color: :purple
50
+ save_png prefix: 'custom_cell_'
51
51
  end
@@ -1,48 +1,48 @@
1
- require_relative '../../lib/squib'
2
-
3
- # Lots of DSL methods have shorthands that are accepted for
4
- # x, y, width, and height parameters.
5
- Squib::Deck.new(width: '0.5in', height: '0.25in') do
6
- background color: :white
7
-
8
- # middle for x and y will resolve to half the height
9
- text str: 'xymiddle', font: 'Sans Bold 3', hint: :red,
10
- x: 'middle', y: :middle
11
-
12
- # 'center' also works
13
- rect width: 30, height: 30,
14
- x: :center, y: 'center'
15
-
16
- # Applies to shapes
17
- triangle x1: 20, y1: 20,
18
- x2: 60, y2: 20,
19
- x3: :middle, y3: :middle
20
-
21
- # We can also do width-, height-, width/, height/
22
- rect x: 20, y: 5, stroke_color: :green,
23
- width: 'deck - 0.1in', height: 10
24
-
25
- rect x: 10, y: 50, width: 10, height: 'deck / 3',
26
- stroke_color: :purple
27
-
28
- # And middle+/-
29
- rect x: 'middle + 0.1in', y: 'center - 0.1in',
30
- width: '0.1in', height: '0.1in', fill_color: :blue
31
-
32
- # Layouts apply this too.
33
- use_layout file: 'shorthands.yml'
34
- rect layout: :example
35
-
36
- # HOWEVER! Shorthands don't combine in an "extends" situation,
37
- # e.g. this won't work:
38
- # parent:
39
- # x: middle
40
- # child:
41
- # extends: parent
42
- # x: += 0.5in
43
-
44
- # These shorthands are not intended for every xywh parameter or
45
- # length parameter, see docs for when they do or do not apply.
46
-
47
- save_png prefix: 'shorthand_'
48
- end
1
+ require_relative '../../lib/squib'
2
+
3
+ # Lots of DSL methods have shorthands that are accepted for
4
+ # x, y, width, and height parameters.
5
+ Squib::Deck.new(width: '0.5in', height: '0.25in') do
6
+ background color: :white
7
+
8
+ # middle for x and y will resolve to half the height
9
+ text str: 'xymiddle', font: 'Sans Bold 3', hint: :red,
10
+ x: 'middle', y: :middle
11
+
12
+ # 'center' also works
13
+ rect width: 30, height: 30,
14
+ x: :center, y: 'center'
15
+
16
+ # Applies to shapes
17
+ triangle x1: 20, y1: 20,
18
+ x2: 60, y2: 20,
19
+ x3: :middle, y3: :middle
20
+
21
+ # We can also do width-, height-, width/, height/
22
+ rect x: 20, y: 5, stroke_color: :green,
23
+ width: 'deck - 0.1in', height: 10
24
+
25
+ rect x: 10, y: 50, width: 10, height: 'deck / 3',
26
+ stroke_color: :purple
27
+
28
+ # And middle+/-
29
+ rect x: 'middle + 0.1in', y: 'center - 0.1in',
30
+ width: '0.1in', height: '0.1in', fill_color: :blue
31
+
32
+ # Layouts apply this too.
33
+ use_layout file: 'shorthands.yml'
34
+ rect layout: :example
35
+
36
+ # HOWEVER! Shorthands don't combine in an "extends" situation,
37
+ # e.g. this won't work:
38
+ # parent:
39
+ # x: middle
40
+ # child:
41
+ # extends: parent
42
+ # x: += 0.5in
43
+
44
+ # These shorthands are not intended for every xywh parameter or
45
+ # length parameter, see docs for when they do or do not apply.
46
+
47
+ save_png prefix: 'shorthand_'
48
+ end
@@ -1,39 +1,39 @@
1
- require 'squib'
2
-
3
- Squib::Deck.new(width: '1.5in', height: '1.5in') do
4
- background color: :white
5
-
6
- # We can use our DSL-method to use inches
7
- # Computed using @dpi (set to 300 by default)
8
- bleed = inches(0.125)
9
- cut = inches(1.25)
10
- rect x: bleed, y: bleed,
11
- width: cut, height: cut,
12
- dash: '0.5mm 0.5mm' # yes, units are in dashes too
13
-
14
- # other units too
15
- cm(2) # We can also use cm this way
16
- cm(2) + inches(2) # We can mix units too
17
-
18
- # Or we can use a string ending with cm or in
19
- safe_margin = '0.25 in' #you can have a space too
20
- safe_width = '1 in'
21
- safe_height = '1.0 in ' # trailing space is ok too
22
- rect x: safe_margin, y: safe_margin,
23
- width: safe_width, height: safe_height,
24
- radius: '2 mm '
25
-
26
- # Angles are also automatically converted to radians if you use deg
27
- svg file: '../spanner.svg',
28
- x: 100, y: 100, width: 40, height: 40, angle: '30deg'
29
-
30
- # We can also do stuff in layout. Check out the yml file...
31
- # (even cleaner in Yaml since we don't need quotes!)
32
- use_layout file: 'using_units.yml'
33
- text str: 'Hello.', layout: :example
34
- svg file: '../spanner.svg', layout: :angled
35
-
36
- save prefix: 'units_', format: :png
37
-
38
- # But wait... there's more! See _shorthands.rb for more fanciness with units
39
- end
1
+ require 'squib'
2
+
3
+ Squib::Deck.new(width: '1.5in', height: '1.5in') do
4
+ background color: :white
5
+
6
+ # We can use our DSL-method to use inches
7
+ # Computed using @dpi (set to 300 by default)
8
+ bleed = inches(0.125)
9
+ cut = inches(1.25)
10
+ rect x: bleed, y: bleed,
11
+ width: cut, height: cut,
12
+ dash: '0.5mm 0.5mm' # yes, units are in dashes too
13
+
14
+ # other units too
15
+ cm(2) # We can also use cm this way
16
+ cm(2) + inches(2) # We can mix units too
17
+
18
+ # Or we can use a string ending with cm or in
19
+ safe_margin = '0.25 in' #you can have a space too
20
+ safe_width = '1 in'
21
+ safe_height = '1.0 in ' # trailing space is ok too
22
+ rect x: safe_margin, y: safe_margin,
23
+ width: safe_width, height: safe_height,
24
+ radius: '2 mm '
25
+
26
+ # Angles are also automatically converted to radians if you use deg
27
+ svg file: '../spanner.svg',
28
+ x: 100, y: 100, width: 40, height: 40, angle: '30deg'
29
+
30
+ # We can also do stuff in layout. Check out the yml file...
31
+ # (even cleaner in Yaml since we don't need quotes!)
32
+ use_layout file: 'using_units.yml'
33
+ text str: 'Hello.', layout: :example
34
+ svg file: '../spanner.svg', layout: :angled
35
+
36
+ save prefix: 'units_', format: :png
37
+
38
+ # But wait... there's more! See _shorthands.rb for more fanciness with units
39
+ end
data/squib.gemspec CHANGED
@@ -1,58 +1,58 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'squib/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.specification_version = 2 if spec.respond_to? :specification_version=
8
- spec.required_rubygems_version = Gem::Requirement.new('>= 0') if spec.respond_to? :required_rubygems_version=
9
- spec.rubygems_version = '2.2.2'
10
- spec.required_ruby_version = '>= 2.7.0'
11
-
12
- spec.name = 'squib'
13
- spec.version = Squib::VERSION
14
- spec.license = 'MIT'
15
-
16
- spec.summary = 'A Ruby DSL for prototyping card games'
17
- spec.description = 'Squib is a Ruby DSL for prototyping card games'
18
- spec.post_install_message = 'Happy Squibbing!'
19
- spec.authors = ['Andy Meneely']
20
- spec.email = 'andy.meneely@gmail.com'
21
- spec.homepage = 'https://github.com/andymeneely/squib'
22
- spec.requirements << 'On Windows, you need the Ruby+DevKit. See https://rubyinstaller.org/downloads'
23
-
24
- spec.rdoc_options = ['--charset=UTF-8']
25
- spec.extra_rdoc_files = Dir['README.md', 'samples/**/*.rb']
26
-
27
- spec.files = `git ls-files -z`.
28
- split("\x0").
29
- reject { |f| f.match(%r{^(spec|samples|docs|benchmarks)/}) }
30
- spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
31
- spec.test_files = spec.files.grep(/^(spec|samples|docs|benchmarks)\//)
32
- spec.require_paths = ['lib']
33
-
34
- spec.add_runtime_dependency 'cairo', '~> 1.17'
35
- spec.add_runtime_dependency 'classy_hash', '1.0.0'
36
- spec.add_runtime_dependency 'gio2', '~> 3.4'
37
- spec.add_runtime_dependency 'gobject-introspection', '~> 3.4'
38
- spec.add_runtime_dependency 'highline', '2.0.3'
39
- spec.add_runtime_dependency 'mercenary', '0.4.0'
40
- spec.add_runtime_dependency 'nokogiri', '~> 1.11'
41
- spec.add_runtime_dependency 'pango', '~> 3.4'
42
- spec.add_runtime_dependency 'rainbow', '~> 3.0'
43
- spec.add_runtime_dependency 'roo', '~> 2.8'
44
- spec.add_runtime_dependency 'rsvg2', '~> 3.4'
45
- spec.add_runtime_dependency 'ruby-progressbar', '~> 1.11'
46
-
47
- spec.add_development_dependency 'activesupport'
48
- spec.add_development_dependency 'bundler'
49
- spec.add_development_dependency 'coveralls', '>= 0.8.21'
50
- spec.add_development_dependency 'guard'
51
- spec.add_development_dependency 'guard-rake'
52
- spec.add_development_dependency 'game_icons'
53
- spec.add_development_dependency 'launchy'
54
- spec.add_development_dependency 'rake'
55
- spec.add_development_dependency 'byebug'
56
- spec.add_development_dependency 'rspec', '~> 3.8'
57
-
58
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'squib/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.specification_version = 2 if spec.respond_to? :specification_version=
8
+ spec.required_rubygems_version = Gem::Requirement.new('>= 0') if spec.respond_to? :required_rubygems_version=
9
+ spec.rubygems_version = '2.2.2'
10
+ spec.required_ruby_version = '>= 2.7.0'
11
+
12
+ spec.name = 'squib'
13
+ spec.version = Squib::VERSION
14
+ spec.license = 'MIT'
15
+
16
+ spec.summary = 'A Ruby DSL for prototyping card games'
17
+ spec.description = 'Squib is a Ruby DSL for prototyping card games'
18
+ spec.post_install_message = 'Happy Squibbing!'
19
+ spec.authors = ['Andy Meneely']
20
+ spec.email = 'andy.meneely@gmail.com'
21
+ spec.homepage = 'https://github.com/andymeneely/squib'
22
+ spec.requirements << 'On Windows, you need the Ruby+DevKit. See https://rubyinstaller.org/downloads'
23
+
24
+ spec.rdoc_options = ['--charset=UTF-8']
25
+ spec.extra_rdoc_files = Dir['README.md', 'samples/**/*.rb']
26
+
27
+ spec.files = `git ls-files -z`.
28
+ split("\x0").
29
+ reject { |f| f.match(%r{^(spec|samples|docs|benchmarks)/}) }
30
+ spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
31
+ spec.test_files = spec.files.grep(/^(spec|samples|docs|benchmarks)\//)
32
+ spec.require_paths = ['lib']
33
+
34
+ spec.add_runtime_dependency 'cairo', '~> 1.17' # https://rubygems.org/gems/cairo/
35
+ spec.add_runtime_dependency 'classy_hash', '1.0.0' # https://rubygems.org/gems/classy_hash
36
+ spec.add_runtime_dependency 'gio2', '~> 4.1' # https://rubygems.org/gems/gio2
37
+ spec.add_runtime_dependency 'gobject-introspection', '~> 4.1' # https://rubygems.org/gems/gobject-introspection
38
+ spec.add_runtime_dependency 'highline', '2.1.0' # https://rubygems.org/gems/highline
39
+ spec.add_runtime_dependency 'mercenary', '0.4.0' # https://rubygems.org/gems/mercenary
40
+ spec.add_runtime_dependency 'nokogiri', '~> 1.14' # https://rubygems.org/gems/nokogiri
41
+ spec.add_runtime_dependency 'pango', '~> 4.1' # https://rubygems.org/gems/pango
42
+ spec.add_runtime_dependency 'rainbow', '~> 3.1' # https://rubygems.org/gems/rainbow
43
+ spec.add_runtime_dependency 'roo', '~> 2.9' # https://rubygems.org/gems/roo
44
+ spec.add_runtime_dependency 'rsvg2', '~> 4.1' # https://rubygems.org/gems/rsvg2
45
+ spec.add_runtime_dependency 'ruby-progressbar', '~> 1.11' # https://rubygems.org/gems/ruby-progressbar
46
+
47
+ spec.add_development_dependency 'activesupport'
48
+ spec.add_development_dependency 'bundler'
49
+ spec.add_development_dependency 'coveralls', '>= 0.8.21'
50
+ spec.add_development_dependency 'guard'
51
+ spec.add_development_dependency 'guard-rake'
52
+ spec.add_development_dependency 'game_icons'
53
+ spec.add_development_dependency 'launchy'
54
+ spec.add_development_dependency 'rake'
55
+ spec.add_development_dependency 'byebug'
56
+ spec.add_development_dependency 'rspec', '~> 3.8'
57
+
58
+ end