squib 0.0.2 → 0.0.3
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 -5
- data/Gemfile +2 -2
- data/LICENSE.txt +22 -22
- data/README.md +245 -92
- data/Rakefile +11 -11
- data/bin/squib +18 -18
- data/lib/squib.rb +31 -18
- data/lib/squib/api/background.rb +18 -16
- data/lib/squib/api/data.rb +52 -52
- data/lib/squib/api/image.rb +66 -48
- data/lib/squib/api/save.rb +43 -37
- data/lib/squib/api/settings.rb +38 -35
- data/lib/squib/api/shapes.rb +116 -106
- data/lib/squib/api/text.rb +50 -45
- data/lib/squib/api/units.rb +16 -16
- data/lib/squib/card.rb +42 -36
- data/lib/squib/commands/new.rb +43 -39
- data/lib/squib/constants.rb +104 -39
- data/lib/squib/deck.rb +116 -113
- data/lib/squib/graphics/background.rb +13 -12
- data/lib/squib/graphics/image.rb +47 -28
- data/lib/squib/graphics/save_doc.rb +54 -50
- data/lib/squib/graphics/save_images.rb +32 -10
- data/lib/squib/graphics/shapes.rb +59 -55
- data/lib/squib/graphics/text.rb +113 -107
- data/lib/squib/input_helpers.rb +193 -139
- data/lib/squib/progress.rb +38 -0
- data/lib/squib/project_template/.gitignore +4 -3
- 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 +20 -2
- data/lib/squib/project_template/deck.rb +5 -5
- data/lib/squib/version.rb +6 -6
- data/samples/ball.png +0 -0
- data/samples/basic.rb +19 -19
- data/samples/colors.rb +15 -16
- data/samples/custom-config.yml +6 -1
- data/samples/custom-layout.yml +39 -34
- data/samples/custom_config.rb +18 -5
- data/samples/customconfig-imgdir/shiny-purse2.png +0 -0
- data/samples/customconfig-imgdir/spanner2.svg +91 -0
- data/samples/draw_shapes.rb +18 -18
- data/samples/excel.rb +19 -19
- data/samples/grit.png +0 -0
- data/samples/hello_world.rb +6 -6
- data/samples/load_images.rb +29 -19
- data/samples/offset.svg +71 -0
- data/samples/portrait-landscape.rb +23 -0
- data/samples/ranges.rb +55 -47
- data/samples/save_pdf.rb +14 -14
- data/samples/shiny-purse.png +0 -0
- data/samples/spanner.svg +91 -91
- data/samples/text_options.rb +60 -58
- data/samples/tgc_proofs.rb +19 -19
- data/samples/units.rb +12 -12
- data/samples/use_layout.rb +28 -28
- data/spec/api/api_text_spec.rb +42 -36
- data/spec/commands/new_spec.rb +47 -47
- data/spec/data/multi-extends-single-entry.yml +13 -0
- data/spec/data/multi-level-extends.yml +10 -0
- data/spec/data/no-extends.yml +5 -0
- data/spec/data/single-extends.yml +7 -0
- data/spec/data/single-level-multi-extends.yml +12 -0
- data/spec/deck_spec.rb +147 -49
- data/spec/input_helpers_spec.rb +117 -0
- data/spec/samples_run_spec.rb +19 -14
- data/spec/spec_helper.rb +3 -0
- data/squib.gemspec +46 -42
- metadata +78 -4
- data/API.md +0 -59
data/samples/offset.svg
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
3
|
+
|
4
|
+
<svg
|
5
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
6
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
7
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
8
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
10
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
11
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
12
|
+
width="747.59235"
|
13
|
+
height="747.39734"
|
14
|
+
id="svg2"
|
15
|
+
version="1.1"
|
16
|
+
inkscape:version="0.48.5 r10040"
|
17
|
+
sodipodi:docname="offset.svg">
|
18
|
+
<defs
|
19
|
+
id="defs4" />
|
20
|
+
<sodipodi:namedview
|
21
|
+
id="base"
|
22
|
+
pagecolor="#ffffff"
|
23
|
+
bordercolor="#666666"
|
24
|
+
borderopacity="1.0"
|
25
|
+
inkscape:pageopacity="0.0"
|
26
|
+
inkscape:pageshadow="2"
|
27
|
+
inkscape:zoom="0.76264655"
|
28
|
+
inkscape:cx="373.79617"
|
29
|
+
inkscape:cy="373.69867"
|
30
|
+
inkscape:document-units="px"
|
31
|
+
inkscape:current-layer="layer1"
|
32
|
+
showgrid="false"
|
33
|
+
inkscape:window-width="1440"
|
34
|
+
inkscape:window-height="776"
|
35
|
+
inkscape:window-x="0"
|
36
|
+
inkscape:window-y="0"
|
37
|
+
inkscape:window-maximized="1"
|
38
|
+
fit-margin-top="0"
|
39
|
+
fit-margin-left="0"
|
40
|
+
fit-margin-right="0"
|
41
|
+
fit-margin-bottom="0" />
|
42
|
+
<metadata
|
43
|
+
id="metadata7">
|
44
|
+
<rdf:RDF>
|
45
|
+
<cc:Work
|
46
|
+
rdf:about="">
|
47
|
+
<dc:format>image/svg+xml</dc:format>
|
48
|
+
<dc:type
|
49
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
50
|
+
<dc:title />
|
51
|
+
</cc:Work>
|
52
|
+
</rdf:RDF>
|
53
|
+
</metadata>
|
54
|
+
<g
|
55
|
+
inkscape:label="Layer 1"
|
56
|
+
inkscape:groupmode="layer"
|
57
|
+
id="layer1"
|
58
|
+
transform="translate(5.1573995,-302.70286)">
|
59
|
+
<path
|
60
|
+
sodipodi:type="arc"
|
61
|
+
style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
62
|
+
id="thing"
|
63
|
+
sodipodi:cx="159.99248"
|
64
|
+
sodipodi:cy="152.67546"
|
65
|
+
sodipodi:rx="59.401001"
|
66
|
+
sodipodi:ry="59.401001"
|
67
|
+
d="m 219.39348,152.67546 c 0,32.80627 -26.59474,59.401 -59.401,59.401 -32.80627,0 -59.401,-26.59473 -59.401,-59.401 0,-32.80627 26.59473,-59.401 59.401,-59.401 32.80626,0 59.401,26.59473 59.401,59.401 z"
|
68
|
+
transform="matrix(0.95784259,0,0,0.95784259,531.73189,844.72627)"
|
69
|
+
inkscape:label="thing" />
|
70
|
+
</g>
|
71
|
+
</svg>
|
@@ -0,0 +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"
|
12
|
+
|
13
|
+
save_png prefix: "portrait_"
|
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"
|
21
|
+
|
22
|
+
save_png prefix: "landscape_", rotate: true
|
23
|
+
end
|
data/samples/ranges.rb
CHANGED
@@ -1,47 +1,55 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'squib'
|
3
|
-
|
4
|
-
data = {'name' => ['Thief', 'Grifter', 'Mastermind'],
|
5
|
-
'type' => ['Thug', 'Thinker', 'Thinker'],
|
6
|
-
'level' => [1,2,3]}
|
7
|
-
|
8
|
-
Squib::Deck.new(width: 825, height: 1125, cards: 3) do
|
9
|
-
# Default range is :all
|
10
|
-
background color: :white
|
11
|
-
text str: data['name'], x: 250, y: 55, font: 'Arial 54'
|
12
|
-
text str: data['level'], x: 65, y: 40, font: 'Arial 72'
|
13
|
-
|
14
|
-
# Could be explicit about using :all, too
|
15
|
-
text range: :all,
|
16
|
-
str: data['type'], x: 40, y: 128, font: 'Arial 18',
|
17
|
-
width: 100, align: :center
|
18
|
-
|
19
|
-
# Ranges are inclusive, zero-based
|
20
|
-
text range: 0..1, str: "Thief and Grifter only!!", x: 25, y:200
|
21
|
-
|
22
|
-
# Integers are also allowed
|
23
|
-
text range: 0, str: "Thief only!", x: 25, y: 250
|
24
|
-
|
25
|
-
# Negatives go from the back of the deck
|
26
|
-
text range: -1, str: "Mastermind only!", x: 25, y: 250
|
27
|
-
text range: -2..-1, str: "Grifter and Mastermind only!", x: 25, y: 650
|
28
|
-
|
29
|
-
# We can use Arrays too!
|
30
|
-
text range: [0,2], str: "Thief and Mastermind only!!", x: 25, y:300
|
31
|
-
|
32
|
-
#
|
33
|
-
#
|
34
|
-
|
35
|
-
text
|
36
|
-
|
37
|
-
x:
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'squib'
|
3
|
+
|
4
|
+
data = {'name' => ['Thief', 'Grifter', 'Mastermind'],
|
5
|
+
'type' => ['Thug', 'Thinker', 'Thinker'],
|
6
|
+
'level' => [1,2,3]}
|
7
|
+
|
8
|
+
Squib::Deck.new(width: 825, height: 1125, cards: 3) do
|
9
|
+
# Default range is :all
|
10
|
+
background color: :white
|
11
|
+
text str: data['name'], x: 250, y: 55, font: 'Arial 54'
|
12
|
+
text str: data['level'], x: 65, y: 40, font: 'Arial 72'
|
13
|
+
|
14
|
+
# Could be explicit about using :all, too
|
15
|
+
text range: :all,
|
16
|
+
str: data['type'], x: 40, y: 128, font: 'Arial 18',
|
17
|
+
width: 100, align: :center
|
18
|
+
|
19
|
+
# Ranges are inclusive, zero-based
|
20
|
+
text range: 0..1, str: "Thief and Grifter only!!", x: 25, y:200
|
21
|
+
|
22
|
+
# Integers are also allowed
|
23
|
+
text range: 0, str: "Thief only!", x: 25, y: 250
|
24
|
+
|
25
|
+
# Negatives go from the back of the deck
|
26
|
+
text range: -1, str: "Mastermind only!", x: 25, y: 250
|
27
|
+
text range: -2..-1, str: "Grifter and Mastermind only!", x: 25, y: 650
|
28
|
+
|
29
|
+
# We can use Arrays too!
|
30
|
+
text range: [0,2], str: "Thief and Mastermind only!!", x: 25, y:300
|
31
|
+
|
32
|
+
# Just about everything in Squib can be given an array that
|
33
|
+
# corresponds to the deck's cards. This allows for each card to be styled differently
|
34
|
+
# This renders three cards, with three strings that had three different colors at three different locations.
|
35
|
+
text str: %w(red green blue),
|
36
|
+
color: [:red, :green, :blue],
|
37
|
+
x: [40, 80, 120],
|
38
|
+
y: [700, 750, 800]
|
39
|
+
|
40
|
+
# Useful idiom: construct a hash from card names back to its index (ID),
|
41
|
+
# then use a range. No need to memorize IDs, and you can add cards easily
|
42
|
+
id = {} ; data['name'].each_with_index{ |name,i| id[name] = i}
|
43
|
+
text range: id['Thief']..id['Grifter'],
|
44
|
+
str: "Thief through Grifter with id lookup!!",
|
45
|
+
x:25, y: 400
|
46
|
+
|
47
|
+
# Useful idiom: generate arrays from a column called 'type'
|
48
|
+
type = {}; data['type'].each_with_index{ |t,i| (type[t] ||= []) << i}
|
49
|
+
text range: type['Thinker'],
|
50
|
+
str: "Only for Thinkers!",
|
51
|
+
x:25, y: 500
|
52
|
+
|
53
|
+
save prefix: 'ranges_', format: :png
|
54
|
+
end
|
55
|
+
|
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/shiny-purse.png
CHANGED
Binary file
|
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,58 +1,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: "This text has fixed width, fixed height, center-aligned, middle-valigned, and has a red hint",
|
26
|
-
hint: :red,
|
27
|
-
x: 65, y: 400,
|
28
|
-
width: 300, height: 200,
|
29
|
-
align: :center, valign: :middle,
|
30
|
-
font: 'Arial 18'
|
31
|
-
|
32
|
-
text str: "Ellipsization!\nThe ultimate question of life, the universe, and everything to life and everything is 42",
|
33
|
-
hint: :green, font: 'Arial 22',
|
34
|
-
x: 450, y: 400,
|
35
|
-
width: 280, height: 180,
|
36
|
-
ellipsize: true
|
37
|
-
|
38
|
-
hint text: :cyan
|
39
|
-
text str: "Text hints are also globally togglable!",
|
40
|
-
x: 65, y: 625,
|
41
|
-
font: 'Arial 22'
|
42
|
-
hint text:
|
43
|
-
text str: "See? No hint here.",
|
44
|
-
x: 565, y: 625,
|
45
|
-
font: 'Arial 22'
|
46
|
-
|
47
|
-
text str: longtext, font: 'Arial 16',
|
48
|
-
x: 65, y: 700,
|
49
|
-
width: inches(2.25), height: inches(1),
|
50
|
-
justify: true
|
51
|
-
|
52
|
-
text str: "<b>Markup</b> is also <i>quite</i> <s>easy</s> awesome",
|
53
|
-
markup: true,
|
54
|
-
x: 50, y: 1000,
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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: "This text has fixed width, fixed height, center-aligned, middle-valigned, and has a red hint",
|
26
|
+
hint: :red,
|
27
|
+
x: 65, y: 400,
|
28
|
+
width: 300, height: 200,
|
29
|
+
align: :center, valign: :middle,
|
30
|
+
font: 'Arial 18'
|
31
|
+
|
32
|
+
text str: "Ellipsization!\nThe ultimate question of life, the universe, and everything to life and everything is 42",
|
33
|
+
hint: :green, font: 'Arial 22',
|
34
|
+
x: 450, y: 400,
|
35
|
+
width: 280, height: 180,
|
36
|
+
ellipsize: true
|
37
|
+
|
38
|
+
hint text: :cyan
|
39
|
+
text str: "Text hints are also globally togglable!",
|
40
|
+
x: 65, y: 625,
|
41
|
+
font: 'Arial 22'
|
42
|
+
hint text: :off
|
43
|
+
text str: "See? No hint here.",
|
44
|
+
x: 565, y: 625,
|
45
|
+
font: 'Arial 22'
|
46
|
+
|
47
|
+
text str: longtext, font: 'Arial 16',
|
48
|
+
x: 65, y: 700,
|
49
|
+
width: inches(2.25), height: inches(1),
|
50
|
+
justify: true
|
51
|
+
|
52
|
+
text str: "<b>Markup</b> is also <i>quite</i> <s>easy</s> awesome",
|
53
|
+
markup: true,
|
54
|
+
x: 50, y: 1000,
|
55
|
+
width: 750, height: 100,
|
56
|
+
valign: :bottom,
|
57
|
+
font: 'Arial 32', hint: :cyan
|
58
|
+
|
59
|
+
save prefix: 'text_', format: :png
|
60
|
+
end
|