prawn-svg 0.15.0.0 → 0.16.0
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/README.md +10 -3
- data/lib/prawn-svg.rb +4 -0
- data/lib/prawn/svg/calculators/aspect_ratio.rb +58 -0
- data/lib/prawn/svg/calculators/document_sizing.rb +71 -0
- data/lib/prawn/svg/calculators/pixels.rb +21 -0
- data/lib/prawn/svg/document.rb +15 -44
- data/lib/prawn/svg/element.rb +19 -10
- data/lib/prawn/svg/extension.rb +3 -3
- data/lib/prawn/svg/interface.rb +14 -10
- data/lib/prawn/svg/parser.rb +13 -0
- data/lib/prawn/svg/parser/image.rb +7 -62
- data/lib/prawn/svg/url_loader.rb +34 -0
- data/lib/prawn/svg/version.rb +1 -1
- data/spec/prawn/svg/calculators/aspect_ratio_spec.rb +95 -0
- data/spec/prawn/svg/calculators/document_sizing_spec.rb +73 -0
- data/spec/prawn/svg/document_spec.rb +4 -2
- data/spec/prawn/svg/element_spec.rb +1 -1
- data/spec/{lib/svg_spec.rb → prawn/svg/interface_spec.rb} +7 -2
- data/spec/{lib → prawn/svg/parser}/path_spec.rb +0 -0
- data/spec/{lib → prawn/svg}/parser_spec.rb +0 -0
- data/spec/prawn/svg/url_loader_spec.rb +46 -0
- data/spec/sample_images/mushroom-long.jpg +0 -0
- data/spec/sample_images/mushroom-wide.jpg +0 -0
- data/spec/sample_svg/hidden_paths.svg +6 -0
- data/spec/sample_svg/image01.svg +31 -31
- data/spec/sample_svg/negminy.svg +25 -0
- data/spec/sample_svg/viewbox.svg +4 -0
- data/spec/sample_svg/viewport.svg +23 -0
- metadata +30 -8
@@ -0,0 +1,25 @@
|
|
1
|
+
<svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -1329 4012.5722934428577 1964.1614245832113" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<defs id="MathJax_SVG_glyphs">
|
3
|
+
<path id="STIXWEBSIZE1-221A" stroke-width="10" d="M1089 1552l-562 -1847h-42l-231 751c-14 46 -30 68 -62 68c-19 0 -44 -8 -68 -27l-12 20l164 126h25l227 -737h4l500 1646h57Z"/>
|
4
|
+
<path id="STIXWEBMAINI-78" stroke-width="10" d="M243 355l12 -57c70 107 107 143 151 143c24 0 41 -15 41 -37c0 -21 -14 -36 -34 -36c-19 0 -28 17 -52 17c-18 0 -54 -44 -98 -121c0 -7 2 -21 8 -45l32 -134c7 -28 16 -41 30 -41c13 0 24 10 47 40c9 12 13 18 21 28l15 -9c-58 -90 -84 -114 -122 -114 c-32 0 -47 18 -59 68l-29 119l-88 -119c-44 -59 -64 -68 -95 -68s-50 16 -50 42c0 20 14 36 34 36c9 0 19 -4 32 -11c10 -6 20 -9 26 -9c11 0 30 19 51 49l82 116l-28 124c-14 60 -21 68 -46 68c-8 0 -20 -2 -39 -7l-18 -5l-3 16l11 4c61 22 94 29 117 29 c25 0 37 -18 51 -86Z"/>
|
5
|
+
<path id="STIXWEBMAIN-32" stroke-width="10" d="M474 137l-54 -137h-391v12l178 189c94 99 130 175 130 260c0 91 -54 141 -139 141c-72 0 -107 -32 -147 -130l-21 5c21 117 85 199 208 199c113 0 185 -77 185 -176c0 -79 -39 -154 -128 -248l-165 -176h234c42 0 63 11 96 67Z"/>
|
6
|
+
<path id="STIXWEBMAIN-2B" stroke-width="10" d="M636 220h-261v-261h-66v261h-261v66h261v261h66v-261h261v-66Z"/>
|
7
|
+
<path id="STIXWEBMAINI-79" stroke-width="10" d="M243 186l21 -110c85 141 122 213 122 257c0 14 -7 20 -26 32c-20 13 -26 23 -26 39c0 22 17 37 40 37c30 0 52 -25 52 -55c0 -57 -48 -167 -131 -305c-104 -172 -211 -287 -268 -287c-30 0 -51 17 -51 43c0 22 17 40 39 40c35 0 35 -28 61 -28c13 0 25 8 48 33 c18 19 63 78 71 91c6 12 10 24 10 35c0 40 -55 264 -82 332c-19 49 -37 64 -77 64c-11 0 -20 -1 -31 -4v17c11 2 22 4 32 6c20 4 53 10 107 18h4c15 0 68 -166 85 -255Z"/>
|
8
|
+
</defs>
|
9
|
+
<g transform="matrix(1 0 0 1 0 0)">
|
10
|
+
<rect x="0" y="-1329" width="4012" height="1964" stroke="green" fill="none" stroke-width="5" />
|
11
|
+
<g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)">
|
12
|
+
<use href="#STIXWEBSIZE1-221A" x="0" y="-312" xlink:href="#STIXWEBSIZE1-221A"/>
|
13
|
+
<rect stroke="none" width="2950" height="60" x="1062" y="1190"/>
|
14
|
+
<g transform="translate(1062,0)">
|
15
|
+
<use href="#STIXWEBMAINI-78" xlink:href="#STIXWEBMAINI-78"/>
|
16
|
+
<use transform="scale(0.7071067811865476)" href="#STIXWEBMAIN-32" x="640" y="583" xlink:href="#STIXWEBMAIN-32"/>
|
17
|
+
<use href="#STIXWEBMAIN-2B" x="1132" y="0" xlink:href="#STIXWEBMAIN-2B"/>
|
18
|
+
<g transform="translate(2044,0)">
|
19
|
+
<use href="#STIXWEBMAINI-79" xlink:href="#STIXWEBMAINI-79"/>
|
20
|
+
<use transform="scale(0.7071067811865476)" href="#STIXWEBMAIN-32" x="634" y="583" xlink:href="#STIXWEBMAIN-32"/>
|
21
|
+
</g>
|
22
|
+
</g>
|
23
|
+
</g>
|
24
|
+
</g>
|
25
|
+
</svg>
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="300" height="300" viewBox="-100 -100 100 100" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<rect x="-98" y="-98" width="96" height="96" fill="blue" stroke="red" />
|
3
|
+
<line x1="-1000" y1="-1000" x2="1000" y2="1000" stroke="green" />
|
4
|
+
</svg>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
3
|
+
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
4
|
+
<svg width="100px" height="200px" version="1.1"
|
5
|
+
viewBox="0 0 1500 1000" preserveAspectRatio="none"
|
6
|
+
xmlns="http://www.w3.org/2000/svg">
|
7
|
+
<desc>Example ViewBox - uses the viewBox
|
8
|
+
attribute to automatically create an initial user coordinate
|
9
|
+
system which causes the graphic to scale to fit into the
|
10
|
+
viewport no matter what size the viewport is.</desc>
|
11
|
+
<!-- This rectangle goes from (0,0) to (1500,1000) in user space.
|
12
|
+
Because of the viewBox attribute above,
|
13
|
+
the rectangle will end up filling the entire area
|
14
|
+
reserved for the SVG content. -->
|
15
|
+
<rect x="0" y="0" width="1500" height="1000"
|
16
|
+
fill="yellow" stroke="blue" stroke-width="12" />
|
17
|
+
<!-- A large, red triangle -->
|
18
|
+
<path fill="red" d="M 750,100 L 250,900 L 1250,900 z"/>
|
19
|
+
<!-- A text string that spans most of the viewport -->
|
20
|
+
<text x="100" y="600" font-size="200" font-family="Verdana" >
|
21
|
+
Stretch to fit
|
22
|
+
</text>
|
23
|
+
</svg>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-svg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roger Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prawn
|
@@ -65,6 +65,9 @@ files:
|
|
65
65
|
- README.md
|
66
66
|
- Rakefile
|
67
67
|
- lib/prawn-svg.rb
|
68
|
+
- lib/prawn/svg/calculators/aspect_ratio.rb
|
69
|
+
- lib/prawn/svg/calculators/document_sizing.rb
|
70
|
+
- lib/prawn/svg/calculators/pixels.rb
|
68
71
|
- lib/prawn/svg/color.rb
|
69
72
|
- lib/prawn/svg/document.rb
|
70
73
|
- lib/prawn/svg/element.rb
|
@@ -75,16 +78,22 @@ files:
|
|
75
78
|
- lib/prawn/svg/parser/image.rb
|
76
79
|
- lib/prawn/svg/parser/path.rb
|
77
80
|
- lib/prawn/svg/parser/text.rb
|
81
|
+
- lib/prawn/svg/url_loader.rb
|
78
82
|
- lib/prawn/svg/version.rb
|
79
83
|
- prawn-svg.gemspec
|
80
|
-
- spec/
|
81
|
-
- spec/
|
82
|
-
- spec/lib/svg_spec.rb
|
84
|
+
- spec/prawn/svg/calculators/aspect_ratio_spec.rb
|
85
|
+
- spec/prawn/svg/calculators/document_sizing_spec.rb
|
83
86
|
- spec/prawn/svg/color_spec.rb
|
84
87
|
- spec/prawn/svg/document_spec.rb
|
85
88
|
- spec/prawn/svg/element_spec.rb
|
86
89
|
- spec/prawn/svg/font_spec.rb
|
90
|
+
- spec/prawn/svg/interface_spec.rb
|
91
|
+
- spec/prawn/svg/parser/path_spec.rb
|
87
92
|
- spec/prawn/svg/parser/text_spec.rb
|
93
|
+
- spec/prawn/svg/parser_spec.rb
|
94
|
+
- spec/prawn/svg/url_loader_spec.rb
|
95
|
+
- spec/sample_images/mushroom-long.jpg
|
96
|
+
- spec/sample_images/mushroom-wide.jpg
|
88
97
|
- spec/sample_output/directory
|
89
98
|
- spec/sample_svg/arcs01.svg
|
90
99
|
- spec/sample_svg/circle01.svg
|
@@ -95,6 +104,7 @@ files:
|
|
95
104
|
- spec/sample_svg/cubic02.svg
|
96
105
|
- spec/sample_svg/ellipse01.svg
|
97
106
|
- spec/sample_svg/google_charts.svg
|
107
|
+
- spec/sample_svg/hidden_paths.svg
|
98
108
|
- spec/sample_svg/highcharts.svg
|
99
109
|
- spec/sample_svg/image01.svg
|
100
110
|
- spec/sample_svg/image02_base64.svg
|
@@ -102,6 +112,7 @@ files:
|
|
102
112
|
- spec/sample_svg/maths.svg
|
103
113
|
- spec/sample_svg/matrix_transform.svg
|
104
114
|
- spec/sample_svg/matrix_transform_3.svg
|
115
|
+
- spec/sample_svg/negminy.svg
|
105
116
|
- spec/sample_svg/omnigraffle.svg
|
106
117
|
- spec/sample_svg/opacity01.svg
|
107
118
|
- spec/sample_svg/polygon01.svg
|
@@ -120,6 +131,8 @@ files:
|
|
120
131
|
- spec/sample_svg/tspan03.svg
|
121
132
|
- spec/sample_svg/tspan04.svg
|
122
133
|
- spec/sample_svg/use.svg
|
134
|
+
- spec/sample_svg/viewbox.svg
|
135
|
+
- spec/sample_svg/viewport.svg
|
123
136
|
- spec/spec_helper.rb
|
124
137
|
homepage: http://github.com/mogest/prawn-svg
|
125
138
|
licenses:
|
@@ -146,14 +159,19 @@ signing_key:
|
|
146
159
|
specification_version: 4
|
147
160
|
summary: SVG renderer for Prawn PDF library
|
148
161
|
test_files:
|
149
|
-
- spec/
|
150
|
-
- spec/
|
151
|
-
- spec/lib/svg_spec.rb
|
162
|
+
- spec/prawn/svg/calculators/aspect_ratio_spec.rb
|
163
|
+
- spec/prawn/svg/calculators/document_sizing_spec.rb
|
152
164
|
- spec/prawn/svg/color_spec.rb
|
153
165
|
- spec/prawn/svg/document_spec.rb
|
154
166
|
- spec/prawn/svg/element_spec.rb
|
155
167
|
- spec/prawn/svg/font_spec.rb
|
168
|
+
- spec/prawn/svg/interface_spec.rb
|
169
|
+
- spec/prawn/svg/parser/path_spec.rb
|
156
170
|
- spec/prawn/svg/parser/text_spec.rb
|
171
|
+
- spec/prawn/svg/parser_spec.rb
|
172
|
+
- spec/prawn/svg/url_loader_spec.rb
|
173
|
+
- spec/sample_images/mushroom-long.jpg
|
174
|
+
- spec/sample_images/mushroom-wide.jpg
|
157
175
|
- spec/sample_output/directory
|
158
176
|
- spec/sample_svg/arcs01.svg
|
159
177
|
- spec/sample_svg/circle01.svg
|
@@ -164,6 +182,7 @@ test_files:
|
|
164
182
|
- spec/sample_svg/cubic02.svg
|
165
183
|
- spec/sample_svg/ellipse01.svg
|
166
184
|
- spec/sample_svg/google_charts.svg
|
185
|
+
- spec/sample_svg/hidden_paths.svg
|
167
186
|
- spec/sample_svg/highcharts.svg
|
168
187
|
- spec/sample_svg/image01.svg
|
169
188
|
- spec/sample_svg/image02_base64.svg
|
@@ -171,6 +190,7 @@ test_files:
|
|
171
190
|
- spec/sample_svg/maths.svg
|
172
191
|
- spec/sample_svg/matrix_transform.svg
|
173
192
|
- spec/sample_svg/matrix_transform_3.svg
|
193
|
+
- spec/sample_svg/negminy.svg
|
174
194
|
- spec/sample_svg/omnigraffle.svg
|
175
195
|
- spec/sample_svg/opacity01.svg
|
176
196
|
- spec/sample_svg/polygon01.svg
|
@@ -189,4 +209,6 @@ test_files:
|
|
189
209
|
- spec/sample_svg/tspan03.svg
|
190
210
|
- spec/sample_svg/tspan04.svg
|
191
211
|
- spec/sample_svg/use.svg
|
212
|
+
- spec/sample_svg/viewbox.svg
|
213
|
+
- spec/sample_svg/viewport.svg
|
192
214
|
- spec/spec_helper.rb
|