squib 0.0.3 → 0.0.4
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/.gitignore +29 -29
- data/.travis.yml +6 -6
- data/.yardopts +7 -7
- data/CHANGELOG.md +19 -0
- data/Gemfile +2 -2
- data/LICENSE.txt +22 -22
- data/README.md +256 -244
- data/Rakefile +11 -11
- data/bin/squib +18 -18
- data/lib/squib.rb +31 -31
- data/lib/squib/api/background.rb +18 -18
- data/lib/squib/api/data.rb +52 -52
- data/lib/squib/api/image.rb +66 -66
- data/lib/squib/api/save.rb +43 -43
- data/lib/squib/api/settings.rb +37 -38
- data/lib/squib/api/shapes.rb +116 -116
- data/lib/squib/api/text.rb +53 -50
- data/lib/squib/api/units.rb +16 -16
- data/lib/squib/card.rb +41 -41
- data/lib/squib/commands/new.rb +43 -43
- data/lib/squib/constants.rb +108 -104
- data/lib/squib/deck.rb +170 -116
- data/lib/squib/graphics/background.rb +13 -13
- data/lib/squib/graphics/image.rb +47 -47
- data/lib/squib/graphics/save_doc.rb +54 -54
- data/lib/squib/graphics/save_images.rb +32 -32
- data/lib/squib/graphics/shapes.rb +59 -59
- data/lib/squib/graphics/text.rb +116 -113
- data/lib/squib/input_helpers.rb +193 -193
- data/lib/squib/progress.rb +37 -37
- data/lib/squib/project_template/.gitignore +4 -4
- data/lib/squib/project_template/ABOUT.md +19 -19
- data/lib/squib/project_template/Gemfile +2 -2
- data/lib/squib/project_template/PNP NOTES.md +3 -3
- data/lib/squib/project_template/config.yml +19 -19
- data/lib/squib/project_template/deck.rb +5 -5
- data/lib/squib/version.rb +6 -6
- data/samples/autoscale_font.rb +27 -0
- data/samples/basic.rb +19 -19
- data/samples/colors.rb +15 -15
- data/samples/custom-config.yml +5 -5
- data/samples/custom-layout.yml +59 -39
- data/samples/custom_config.rb +18 -18
- data/samples/customconfig-imgdir/spanner2.svg +91 -91
- data/samples/draw_shapes.rb +18 -18
- data/samples/excel.rb +19 -19
- data/samples/hello_world.rb +6 -6
- data/samples/load_images.rb +29 -29
- data/samples/offset.svg +71 -71
- data/samples/portrait-landscape.rb +22 -22
- data/samples/ranges.rb +55 -55
- data/samples/save_pdf.rb +14 -14
- data/samples/spanner.svg +91 -91
- data/samples/text_options.rb +67 -60
- data/samples/tgc_proofs.rb +19 -19
- data/samples/units.rb +12 -12
- data/samples/use_layout.rb +33 -28
- data/spec/api/api_text_spec.rb +43 -43
- data/spec/commands/new_spec.rb +47 -47
- data/spec/data/easy-circular-extends.yml +6 -0
- data/spec/data/hard-circular-extends.yml +9 -0
- data/spec/data/multi-extends-single-entry.yml +14 -13
- data/spec/data/multi-level-extends.yml +9 -9
- data/spec/data/no-extends.yml +5 -5
- data/spec/data/pre-extends.yml +7 -0
- data/spec/data/self-circular-extends.yml +3 -0
- data/spec/data/single-extends.yml +7 -7
- data/spec/data/single-level-multi-extends.yml +11 -11
- data/spec/deck_spec.rb +188 -147
- data/spec/input_helpers_spec.rb +116 -116
- data/spec/samples_run_spec.rb +19 -19
- data/squib.gemspec +46 -46
- metadata +17 -7
data/samples/save_pdf.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'squib'
|
3
|
-
|
4
|
-
Squib::Deck.new(width: 825, height: 1125, cards: 16) do
|
5
|
-
background color: :gray
|
6
|
-
rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38
|
7
|
-
|
8
|
-
text str: (1..16).to_a, x: 220, y: 78, font: 'Arial 54'
|
9
|
-
|
10
|
-
save_pdf file: "sample-save-pdf.pdf", margin: 75, gap: 5, trim: 37
|
11
|
-
|
12
|
-
#Note that our PNGs still are not trimmed even though the pdf ones are
|
13
|
-
save_png range: 1, prefix: "save_pdf_"
|
14
|
-
end
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'squib'
|
3
|
+
|
4
|
+
Squib::Deck.new(width: 825, height: 1125, cards: 16) do
|
5
|
+
background color: :gray
|
6
|
+
rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38
|
7
|
+
|
8
|
+
text str: (1..16).to_a, x: 220, y: 78, font: 'Arial 54'
|
9
|
+
|
10
|
+
save_pdf file: "sample-save-pdf.pdf", margin: 75, gap: 5, trim: 37
|
11
|
+
|
12
|
+
#Note that our PNGs still are not trimmed even though the pdf ones are
|
13
|
+
save_png range: 1, prefix: "save_pdf_"
|
14
|
+
end
|
data/samples/spanner.svg
CHANGED
@@ -1,91 +1,91 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<svg
|
3
|
-
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
4
|
-
xmlns:cc="http://creativecommons.org/ns#"
|
5
|
-
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
6
|
-
xmlns:svg="http://www.w3.org/2000/svg"
|
7
|
-
xmlns="http://www.w3.org/2000/svg"
|
8
|
-
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
9
|
-
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
10
|
-
viewBox="0 0 128 128"
|
11
|
-
id="svg2"
|
12
|
-
version="1.1"
|
13
|
-
inkscape:version="0.48.3.1 r9886"
|
14
|
-
width="100%"
|
15
|
-
height="100%"
|
16
|
-
sodipodi:docname="spanner.svg">
|
17
|
-
<metadata
|
18
|
-
id="metadata18">
|
19
|
-
<rdf:RDF>
|
20
|
-
<cc:Work
|
21
|
-
rdf:about="">
|
22
|
-
<dc:format>image/svg+xml</dc:format>
|
23
|
-
<dc:type
|
24
|
-
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
25
|
-
</cc:Work>
|
26
|
-
</rdf:RDF>
|
27
|
-
</metadata>
|
28
|
-
<defs
|
29
|
-
id="defs16" />
|
30
|
-
<sodipodi:namedview
|
31
|
-
pagecolor="#ffffff"
|
32
|
-
bordercolor="#666666"
|
33
|
-
borderopacity="1"
|
34
|
-
objecttolerance="10"
|
35
|
-
gridtolerance="10"
|
36
|
-
guidetolerance="10"
|
37
|
-
inkscape:pageopacity="0"
|
38
|
-
inkscape:pageshadow="2"
|
39
|
-
inkscape:window-width="1280"
|
40
|
-
inkscape:window-height="1002"
|
41
|
-
id="namedview14"
|
42
|
-
showgrid="false"
|
43
|
-
inkscape:zoom="2.8284271"
|
44
|
-
inkscape:cx="98.928938"
|
45
|
-
inkscape:cy="62.194589"
|
46
|
-
inkscape:window-x="1912"
|
47
|
-
inkscape:window-y="-8"
|
48
|
-
inkscape:window-maximized="1"
|
49
|
-
inkscape:current-layer="g3767"
|
50
|
-
inkscape:document-units="in"
|
51
|
-
units="px"
|
52
|
-
showguides="true"
|
53
|
-
inkscape:guide-bbox="true" />
|
54
|
-
<g
|
55
|
-
id="g3767"
|
56
|
-
transform="matrix(0.24961486,0,0,0.24961486,0.197194,96.049335)">
|
57
|
-
<rect
|
58
|
-
ry="67.108368"
|
59
|
-
y="-378.68747"
|
60
|
-
x="5.3126979"
|
61
|
-
height="501.3746"
|
62
|
-
width="501.3746"
|
63
|
-
id="backdrop"
|
64
|
-
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:10.62539577;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
65
|
-
inkscape:label="#rect3765" />
|
66
|
-
<path
|
67
|
-
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
68
|
-
d="M 36.267098,-7.709219 C 16.393265,5.1318032 3.2161811,27.462365 3.2161811,52.884128 c 0,39.825874 32.2852369,72.111092 72.1110909,72.111092 23.870397,0 44.964938,-11.67699 58.089488,-29.545518 -11.26063,7.275808 -24.65607,11.517748 -39.060173,11.517748 -39.825853,0 -72.11109,-32.285221 -72.11109,-72.111095 0,-15.95546 5.248882,-30.6218942 14.021601,-42.565574 z"
|
69
|
-
id="path3790"
|
70
|
-
inkscape:connector-curvature="0" />
|
71
|
-
<g
|
72
|
-
id="g6"
|
73
|
-
transform="matrix(18.68858,0,0,18.68858,-3385.6437,-2608.3849)">
|
74
|
-
<path
|
75
|
-
style="fill:#ffffff"
|
76
|
-
inkscape:connector-curvature="0"
|
77
|
-
id="path8"
|
78
|
-
d="m 192.2325,129.3203 -10,10 v 5.5625 h 5.375 l 10.0938,-10.0938 -5.4688,-5.4688 z" />
|
79
|
-
<path
|
80
|
-
style="fill:#ffffff;stroke:#000000"
|
81
|
-
inkscape:connector-curvature="0"
|
82
|
-
id="path10"
|
83
|
-
d="m 181.7796,141.8591 15.6196,-15.6178 m 3.349,3.3486 -15.8051,15.8032" />
|
84
|
-
<path
|
85
|
-
style="fill:#ffffff"
|
86
|
-
inkscape:connector-curvature="0"
|
87
|
-
id="path12"
|
88
|
-
d="m 201.2023,119.7104 c -2.8283,-0.73 -5.9623,-0.004 -8.1759,2.2097 -3.3293,3.3292 -3.3293,8.7358 -2e-5,12.065 3.32928,3.3292 8.7358,3.3292 12.065,0 2.216,-2.216 2.9436,-5.3452 2.2097,-8.1759 l -5.6348,5.6348 -4.8172,-1.2816 -1.2816,-4.8171 5.6348,-5.6348 z" />
|
89
|
-
</g>
|
90
|
-
</g>
|
91
|
-
</svg>
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<svg
|
3
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
4
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
5
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
6
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
8
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
9
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
10
|
+
viewBox="0 0 128 128"
|
11
|
+
id="svg2"
|
12
|
+
version="1.1"
|
13
|
+
inkscape:version="0.48.3.1 r9886"
|
14
|
+
width="100%"
|
15
|
+
height="100%"
|
16
|
+
sodipodi:docname="spanner.svg">
|
17
|
+
<metadata
|
18
|
+
id="metadata18">
|
19
|
+
<rdf:RDF>
|
20
|
+
<cc:Work
|
21
|
+
rdf:about="">
|
22
|
+
<dc:format>image/svg+xml</dc:format>
|
23
|
+
<dc:type
|
24
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
25
|
+
</cc:Work>
|
26
|
+
</rdf:RDF>
|
27
|
+
</metadata>
|
28
|
+
<defs
|
29
|
+
id="defs16" />
|
30
|
+
<sodipodi:namedview
|
31
|
+
pagecolor="#ffffff"
|
32
|
+
bordercolor="#666666"
|
33
|
+
borderopacity="1"
|
34
|
+
objecttolerance="10"
|
35
|
+
gridtolerance="10"
|
36
|
+
guidetolerance="10"
|
37
|
+
inkscape:pageopacity="0"
|
38
|
+
inkscape:pageshadow="2"
|
39
|
+
inkscape:window-width="1280"
|
40
|
+
inkscape:window-height="1002"
|
41
|
+
id="namedview14"
|
42
|
+
showgrid="false"
|
43
|
+
inkscape:zoom="2.8284271"
|
44
|
+
inkscape:cx="98.928938"
|
45
|
+
inkscape:cy="62.194589"
|
46
|
+
inkscape:window-x="1912"
|
47
|
+
inkscape:window-y="-8"
|
48
|
+
inkscape:window-maximized="1"
|
49
|
+
inkscape:current-layer="g3767"
|
50
|
+
inkscape:document-units="in"
|
51
|
+
units="px"
|
52
|
+
showguides="true"
|
53
|
+
inkscape:guide-bbox="true" />
|
54
|
+
<g
|
55
|
+
id="g3767"
|
56
|
+
transform="matrix(0.24961486,0,0,0.24961486,0.197194,96.049335)">
|
57
|
+
<rect
|
58
|
+
ry="67.108368"
|
59
|
+
y="-378.68747"
|
60
|
+
x="5.3126979"
|
61
|
+
height="501.3746"
|
62
|
+
width="501.3746"
|
63
|
+
id="backdrop"
|
64
|
+
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:10.62539577;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
65
|
+
inkscape:label="#rect3765" />
|
66
|
+
<path
|
67
|
+
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
68
|
+
d="M 36.267098,-7.709219 C 16.393265,5.1318032 3.2161811,27.462365 3.2161811,52.884128 c 0,39.825874 32.2852369,72.111092 72.1110909,72.111092 23.870397,0 44.964938,-11.67699 58.089488,-29.545518 -11.26063,7.275808 -24.65607,11.517748 -39.060173,11.517748 -39.825853,0 -72.11109,-32.285221 -72.11109,-72.111095 0,-15.95546 5.248882,-30.6218942 14.021601,-42.565574 z"
|
69
|
+
id="path3790"
|
70
|
+
inkscape:connector-curvature="0" />
|
71
|
+
<g
|
72
|
+
id="g6"
|
73
|
+
transform="matrix(18.68858,0,0,18.68858,-3385.6437,-2608.3849)">
|
74
|
+
<path
|
75
|
+
style="fill:#ffffff"
|
76
|
+
inkscape:connector-curvature="0"
|
77
|
+
id="path8"
|
78
|
+
d="m 192.2325,129.3203 -10,10 v 5.5625 h 5.375 l 10.0938,-10.0938 -5.4688,-5.4688 z" />
|
79
|
+
<path
|
80
|
+
style="fill:#ffffff;stroke:#000000"
|
81
|
+
inkscape:connector-curvature="0"
|
82
|
+
id="path10"
|
83
|
+
d="m 181.7796,141.8591 15.6196,-15.6178 m 3.349,3.3486 -15.8051,15.8032" />
|
84
|
+
<path
|
85
|
+
style="fill:#ffffff"
|
86
|
+
inkscape:connector-curvature="0"
|
87
|
+
id="path12"
|
88
|
+
d="m 201.2023,119.7104 c -2.8283,-0.73 -5.9623,-0.004 -8.1759,2.2097 -3.3293,3.3292 -3.3293,8.7358 -2e-5,12.065 3.32928,3.3292 8.7358,3.3292 12.065,0 2.216,-2.216 2.9436,-5.3452 2.2097,-8.1759 l -5.6348,5.6348 -4.8172,-1.2816 -1.2816,-4.8171 5.6348,-5.6348 z" />
|
89
|
+
</g>
|
90
|
+
</g>
|
91
|
+
</svg>
|
data/samples/text_options.rb
CHANGED
@@ -1,60 +1,67 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'squib'
|
3
|
-
|
4
|
-
data = {'name' => ['Thief', 'Grifter', 'Mastermind'],
|
5
|
-
'level' => [1,2,3]}
|
6
|
-
longtext = "This is left-justified text.\nWhat do you know about tweetle beetles? well... \nWhen 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. AND... When beetles fight these battles in a bottle with their paddles and the bottle's on a poodle and the poodle's eating noodles... ...they call this a muddle puddle tweetle poodle beetle noodle bottle paddle battle."
|
7
|
-
|
8
|
-
Squib::Deck.new(width: 825, height: 1125, cards: 3) do
|
9
|
-
background color: :white
|
10
|
-
rect x: 15, y: 15, width: 795, height: 1095, x_radius: 50, y_radius: 50
|
11
|
-
rect x: 30, y: 30, width: 128, height: 128, x_radius: 25, y_radius: 25
|
12
|
-
|
13
|
-
# Arrays are rendered over each card
|
14
|
-
text str: data['name'], x: 250, y: 55, font: 'Arial weight=900 54'
|
15
|
-
text str: data['level'], x: 65, y: 40, font: 'Arial 72', color: :burnt_orange
|
16
|
-
|
17
|
-
text str: "UTF-8 \u2663", x: 565, y: 150, font: 'Arial weight=900 36'
|
18
|
-
|
19
|
-
text str: "Font strings are expressive!", x:65, y: 200,
|
20
|
-
font: 'Impact bold italic 36'
|
21
|
-
|
22
|
-
text str: "Font strings are expressive!", x:65, y: 300,
|
23
|
-
font: 'Arial,Verdana weight=900 style=oblique 36'
|
24
|
-
|
25
|
-
text str: "
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'squib'
|
3
|
+
|
4
|
+
data = {'name' => ['Thief', 'Grifter', 'Mastermind'],
|
5
|
+
'level' => [1,2,3]}
|
6
|
+
longtext = "This is left-justified text.\nWhat do you know about tweetle beetles? well... \nWhen 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. AND... When beetles fight these battles in a bottle with their paddles and the bottle's on a poodle and the poodle's eating noodles... ...they call this a muddle puddle tweetle poodle beetle noodle bottle paddle battle."
|
7
|
+
|
8
|
+
Squib::Deck.new(width: 825, height: 1125, cards: 3) do
|
9
|
+
background color: :white
|
10
|
+
rect x: 15, y: 15, width: 795, height: 1095, x_radius: 50, y_radius: 50
|
11
|
+
rect x: 30, y: 30, width: 128, height: 128, x_radius: 25, y_radius: 25
|
12
|
+
|
13
|
+
# Arrays are rendered over each card
|
14
|
+
text str: data['name'], x: 250, y: 55, font: 'Arial weight=900 54'
|
15
|
+
text str: data['level'], x: 65, y: 40, font: 'Arial 72', color: :burnt_orange
|
16
|
+
|
17
|
+
text str: "UTF-8 \u2663", x: 565, y: 150, font: 'Arial weight=900 36'
|
18
|
+
|
19
|
+
text str: "Font strings are expressive!", x:65, y: 200,
|
20
|
+
font: 'Impact bold italic 36'
|
21
|
+
|
22
|
+
text str: "Font strings are expressive!", x:65, y: 300,
|
23
|
+
font: 'Arial,Verdana weight=900 style=oblique 36'
|
24
|
+
|
25
|
+
text str: "Font string sizes can be overridden per card.", x: 65, y: 350,
|
26
|
+
font: 'Impact 36', font_size: [16, 20, 24]
|
27
|
+
|
28
|
+
text str: "This text has fixed width, fixed height, center-aligned, middle-valigned, and has a red hint",
|
29
|
+
hint: :red,
|
30
|
+
x: 65, y: 400,
|
31
|
+
width: 300, height: 200,
|
32
|
+
align: :center, valign: :middle,
|
33
|
+
font: 'Arial 18'
|
34
|
+
|
35
|
+
text str: "Ellipsization!\nThe ultimate question of life, the universe, and everything to life and everything is 42",
|
36
|
+
hint: :green, font: 'Arial 22',
|
37
|
+
x: 450, y: 400,
|
38
|
+
width: 280, height: 180,
|
39
|
+
ellipsize: true
|
40
|
+
|
41
|
+
hint text: :cyan
|
42
|
+
text str: "Text hints are also globally togglable!",
|
43
|
+
x: 65, y: 625,
|
44
|
+
font: 'Arial 22'
|
45
|
+
hint text: :off
|
46
|
+
text str: "See? No hint here.",
|
47
|
+
x: 565, y: 625,
|
48
|
+
font: 'Arial 22'
|
49
|
+
|
50
|
+
text str: "Rotated",
|
51
|
+
x: 565, y: 675, angle: 0.1,
|
52
|
+
font: 'Arial 18'
|
53
|
+
|
54
|
+
text str: longtext, font: 'Arial 16',
|
55
|
+
x: 65, y: 700,
|
56
|
+
width: inches(2.25), height: inches(1),
|
57
|
+
justify: true
|
58
|
+
|
59
|
+
text str: "<b>Markup</b> is also <i>quite</i> <s>easy</s> awesome",
|
60
|
+
markup: true,
|
61
|
+
x: 50, y: 1000,
|
62
|
+
width: 750, height: 100,
|
63
|
+
valign: :bottom,
|
64
|
+
font: 'Arial 32', hint: :cyan
|
65
|
+
|
66
|
+
save prefix: 'text_', format: :png
|
67
|
+
end
|
data/samples/tgc_proofs.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'squib'
|
3
|
-
|
4
|
-
# This sample uses a proof overlay from TheGameCrafter.com to check bleed
|
5
|
-
Squib::Deck.new(width: 825, height: 1125, cards: 1) do
|
6
|
-
background color: :white
|
7
|
-
rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38
|
8
|
-
rect x: 75, y: 75, width: 128, height: 128, x_radius: 25, y_radius: 25
|
9
|
-
|
10
|
-
text str: 'Mastermind', x: 220, y: 78, font: 'Arial 54'
|
11
|
-
text str: 3, x: 75, y: 85, width: 128, font: 'Arial 72', align: :center
|
12
|
-
|
13
|
-
png file: 'shiny-purse.png', x: 620, y: 75
|
14
|
-
svg file: 'spanner.svg', x: 620, y: 218
|
15
|
-
|
16
|
-
# TGC proof overlay
|
17
|
-
png file: 'pokercard.png', x:0, y:0, alpha: 0.5
|
18
|
-
|
19
|
-
save_png prefix: 'tgc_sample_'
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'squib'
|
3
|
+
|
4
|
+
# This sample uses a proof overlay from TheGameCrafter.com to check bleed
|
5
|
+
Squib::Deck.new(width: 825, height: 1125, cards: 1) do
|
6
|
+
background color: :white
|
7
|
+
rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38
|
8
|
+
rect x: 75, y: 75, width: 128, height: 128, x_radius: 25, y_radius: 25
|
9
|
+
|
10
|
+
text str: 'Mastermind', x: 220, y: 78, font: 'Arial 54'
|
11
|
+
text str: 3, x: 75, y: 85, width: 128, font: 'Arial 72', align: :center
|
12
|
+
|
13
|
+
png file: 'shiny-purse.png', x: 620, y: 75
|
14
|
+
svg file: 'spanner.svg', x: 620, y: 218
|
15
|
+
|
16
|
+
# TGC proof overlay
|
17
|
+
png file: 'pokercard.png', x:0, y:0, alpha: 0.5
|
18
|
+
|
19
|
+
save_png prefix: 'tgc_sample_'
|
20
20
|
end
|
data/samples/units.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
require 'squib'
|
2
|
-
|
3
|
-
Squib::Deck.new(width: 825, height: 1125, cards: 3) do
|
4
|
-
background color: :white
|
5
|
-
|
6
|
-
bleed = inches(0.125)
|
7
|
-
cut_width = inches(2.5)
|
8
|
-
cut_height = inches(3.5)
|
9
|
-
rect x: bleed, y: bleed, width: cut_width, height: cut_height, radius: 25
|
10
|
-
|
11
|
-
save prefix: 'units_', format: :png
|
12
|
-
end
|
1
|
+
require 'squib'
|
2
|
+
|
3
|
+
Squib::Deck.new(width: 825, height: 1125, cards: 3) do
|
4
|
+
background color: :white
|
5
|
+
|
6
|
+
bleed = inches(0.125)
|
7
|
+
cut_width = inches(2.5)
|
8
|
+
cut_height = inches(3.5)
|
9
|
+
rect x: bleed, y: bleed, width: cut_width, height: cut_height, radius: 25
|
10
|
+
|
11
|
+
save prefix: 'units_', format: :png
|
12
|
+
end
|
data/samples/use_layout.rb
CHANGED
@@ -1,29 +1,34 @@
|
|
1
|
-
require 'squib'
|
2
|
-
|
3
|
-
Squib::Deck.new(layout: 'custom-layout.yml') do
|
4
|
-
background color: :white
|
5
|
-
hint text: :cyan
|
6
|
-
|
7
|
-
# Layouts are YAML files that specify any option as a default
|
8
|
-
rect layout: :frame
|
9
|
-
|
10
|
-
# You can also override a given layout entry in the command
|
11
|
-
circle layout: :frame, x: 50, y: 50, radius: 25
|
12
|
-
|
13
|
-
# Lots of commands have the :layout option
|
14
|
-
text str: 'The Title', layout: :title
|
15
|
-
|
16
|
-
# Layouts also support
|
17
|
-
svg file: 'spanner.svg', layout: :icon_left
|
18
|
-
png file: 'shiny-purse.png', layout: :icon_middle
|
19
|
-
svg file: 'spanner.svg', layout: :icon_right
|
20
|
-
|
21
|
-
#
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
#
|
27
|
-
|
28
|
-
|
1
|
+
require 'squib'
|
2
|
+
|
3
|
+
Squib::Deck.new(layout: 'custom-layout.yml') do
|
4
|
+
background color: :white
|
5
|
+
hint text: :cyan
|
6
|
+
|
7
|
+
# Layouts are YAML files that specify any option as a default
|
8
|
+
rect layout: :frame
|
9
|
+
|
10
|
+
# You can also override a given layout entry in the command
|
11
|
+
circle layout: :frame, x: 50, y: 50, radius: 25
|
12
|
+
|
13
|
+
# Lots of commands have the :layout option
|
14
|
+
text str: 'The Title', layout: :title
|
15
|
+
|
16
|
+
# Layouts also support YAML merge keys toreuse settings
|
17
|
+
svg file: 'spanner.svg', layout: :icon_left
|
18
|
+
png file: 'shiny-purse.png', layout: :icon_middle
|
19
|
+
svg file: 'spanner.svg', layout: :icon_right
|
20
|
+
|
21
|
+
# Squib has its own, richer merge key: "extends"
|
22
|
+
rect fill_color: :black, layout: :bonus
|
23
|
+
rect fill_color: :white, layout: :bonus_inner
|
24
|
+
text str: 'Extends!', layout: :bonus_text
|
25
|
+
|
26
|
+
# Strings can also be used to specify a layout (e.g. from a data file)
|
27
|
+
text str: 'subtitle', layout: 'subtitle'
|
28
|
+
|
29
|
+
# For debugging purposes, you can always print out the loaded layout
|
30
|
+
#require 'pp'
|
31
|
+
#pp @layout
|
32
|
+
|
33
|
+
save_png prefix: 'layout_'
|
29
34
|
end
|