prawn-svg 0.27.1 → 0.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -2
- data/lib/prawn-svg.rb +3 -1
- data/lib/prawn/svg/{css.rb → css/font_family_parser.rb} +3 -4
- data/lib/prawn/svg/css/selector_parser.rb +174 -0
- data/lib/prawn/svg/css/stylesheets.rb +125 -0
- data/lib/prawn/svg/document.rb +3 -15
- data/lib/prawn/svg/elements.rb +2 -2
- data/lib/prawn/svg/elements/base.rb +20 -23
- data/lib/prawn/svg/elements/clip_path.rb +12 -0
- data/lib/prawn/svg/elements/container.rb +1 -3
- data/lib/prawn/svg/elements/text.rb +1 -1
- data/lib/prawn/svg/elements/text_component.rb +46 -13
- data/lib/prawn/svg/font_registry.rb +4 -3
- data/lib/prawn/svg/interface.rb +3 -1
- data/lib/prawn/svg/properties.rb +1 -0
- data/lib/prawn/svg/state.rb +6 -3
- data/lib/prawn/svg/version.rb +1 -1
- data/prawn-svg.gemspec +2 -2
- data/spec/prawn/svg/{css_spec.rb → css/font_family_parser_spec.rb} +3 -3
- data/spec/prawn/svg/css/selector_parser_spec.rb +33 -0
- data/spec/prawn/svg/css/stylesheets_spec.rb +113 -0
- data/spec/prawn/svg/document_spec.rb +0 -33
- data/spec/prawn/svg/elements/base_spec.rb +56 -0
- data/spec/prawn/svg/elements/text_spec.rb +59 -16
- data/spec/prawn/svg/font_registry_spec.rb +30 -0
- data/spec/prawn/svg/interface_spec.rb +33 -1
- data/spec/sample_output/{directory → .keep} +0 -0
- data/spec/sample_svg/text_stroke.svg +41 -0
- data/spec/sample_svg/warning-radioactive.svg +98 -0
- data/spec/spec_helper.rb +2 -2
- metadata +108 -9
@@ -4,6 +4,8 @@ describe Prawn::SVG::Elements::Text do
|
|
4
4
|
let(:document) { Prawn::SVG::Document.new(svg, [800, 600], {}, font_registry: Prawn::SVG::FontRegistry.new("Helvetica" => {:normal => nil}, "Courier" => {normal: nil}, 'Times-Roman' => {normal: nil})) }
|
5
5
|
let(:element) { Prawn::SVG::Elements::Text.new(document, document.root, [], fake_state) }
|
6
6
|
|
7
|
+
let(:default_style) { {:size=>16, :style=>:normal, :text_anchor=>'start', :at=>[:relative, :relative], :offset=>[0,0]} }
|
8
|
+
|
7
9
|
describe "xml:space preserve" do
|
8
10
|
let(:svg) { %(<text#{attributes}>some\n\t text</text>) }
|
9
11
|
|
@@ -77,17 +79,66 @@ Even more
|
|
77
79
|
|
78
80
|
expect(element.base_calls).to eq [
|
79
81
|
["text_group", [], [
|
80
|
-
["
|
81
|
-
|
82
|
-
["
|
83
|
-
["draw_text", ["spaced", {:size=>16, :style=>:normal, :text_anchor=>'start', :at=>[:relative, :relative], :offset=>[0,0]}], []]
|
84
|
-
]]
|
82
|
+
["font", ["Helvetica", {style: :normal}], []],
|
83
|
+
["character_spacing", [5.0], [
|
84
|
+
["draw_text", ["spaced", default_style], []]
|
85
85
|
]]
|
86
86
|
]]
|
87
87
|
]
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
+
describe "fill/stroke modes" do
|
92
|
+
context "with a stroke and no fill" do
|
93
|
+
let(:svg) { '<text stroke="red" fill="none">stroked</text>' }
|
94
|
+
|
95
|
+
it "calls text_rendering_mode with the requested options" do
|
96
|
+
element.process
|
97
|
+
|
98
|
+
expect(element.base_calls).to eq [
|
99
|
+
["text_group", [], [
|
100
|
+
["stroke_color", ["ff0000"], []],
|
101
|
+
["font", ["Helvetica", {style: :normal}], []],
|
102
|
+
["text_rendering_mode", [:stroke], [
|
103
|
+
["draw_text", ["stroked", default_style], []]
|
104
|
+
]]
|
105
|
+
]]
|
106
|
+
]
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
context "with a mixture of everything" do
|
111
|
+
let(:svg) { '<text stroke="red" fill="none">stroked <tspan fill="black">both</tspan><tspan stroke="none">neither</tspan></text>' }
|
112
|
+
|
113
|
+
it "calls text_rendering_mode with the requested options" do
|
114
|
+
element.process
|
115
|
+
|
116
|
+
expect(element.base_calls).to eq [
|
117
|
+
["text_group", [], [
|
118
|
+
["stroke_color", ["ff0000"], []],
|
119
|
+
["font", ["Helvetica", {style: :normal}], []],
|
120
|
+
["text_rendering_mode", [:stroke], [
|
121
|
+
["draw_text", ["stroked ", default_style], []],
|
122
|
+
["save", [], []],
|
123
|
+
["fill_color", ["000000"], []],
|
124
|
+
["font", ["Helvetica", {style: :normal}], []],
|
125
|
+
["text_rendering_mode", [:fill_stroke], [
|
126
|
+
["draw_text", ["both", default_style], []]
|
127
|
+
]],
|
128
|
+
["restore", [], []],
|
129
|
+
["save", [], []],
|
130
|
+
["font", ["Helvetica", {style: :normal}], []],
|
131
|
+
["text_rendering_mode", [:invisible], [
|
132
|
+
["draw_text", ["neither", default_style], []]
|
133
|
+
]],
|
134
|
+
["restore", [], []],
|
135
|
+
]]
|
136
|
+
]]
|
137
|
+
]
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
91
142
|
describe "font finding" do
|
92
143
|
context "with a font that exists" do
|
93
144
|
let(:svg) { '<text font-family="monospace">hello</text>' }
|
@@ -124,11 +175,9 @@ Even more
|
|
124
175
|
|
125
176
|
it "references the text" do
|
126
177
|
element.process
|
127
|
-
expect(flatten_calls(element.base_calls)[11
|
178
|
+
expect(flatten_calls(element.base_calls)[9..11]).to eq [
|
128
179
|
["fill_color", ["ff0000"]],
|
129
|
-
["fill", []],
|
130
180
|
["font", ["Helvetica", {:style=>:normal}]],
|
131
|
-
["character_spacing", [0]],
|
132
181
|
["draw_text", ["my reference text", {:size=>16, :style=>:normal, :text_anchor=>"start", :at=>[10.0, :relative], :offset=>[0,0]}]],
|
133
182
|
]
|
134
183
|
end
|
@@ -137,14 +186,12 @@ Even more
|
|
137
186
|
describe "dx and dy attributes" do
|
138
187
|
let(:svg) { '<text x="10 20" dx="30 50 80" dy="2">Hi there, this is a good test</text>' }
|
139
188
|
|
140
|
-
it "correctly calculates the
|
189
|
+
it "correctly calculates the positions of the text" do
|
141
190
|
element.process
|
142
191
|
|
143
192
|
expect(flatten_calls(element.base_calls)).to eq [
|
144
193
|
["text_group", []],
|
145
|
-
["fill", []],
|
146
194
|
["font", ["Helvetica", {:style=>:normal}]],
|
147
|
-
["character_spacing", [0]],
|
148
195
|
["draw_text", ["H", {:size=>16, :style=>:normal, :text_anchor=>"start", :at=>[10.0, :relative], :offset=>[30.0, 2.0]}]],
|
149
196
|
["draw_text", ["i", {:size=>16, :style=>:normal, :text_anchor=>"start", :at=>[20.0, :relative], :offset=>[50.0, 0]}]],
|
150
197
|
["draw_text", [" there, this is a good test", {:size=>16, :style=>:normal, :text_anchor=>"start", :at=>[:relative, :relative], :offset=>[80.0, 0]}]]
|
@@ -155,21 +202,17 @@ Even more
|
|
155
202
|
describe "rotate attribute" do
|
156
203
|
let(:svg) { '<text rotate="10 20 30 40 50 60 70 80 90 100">Hi <tspan rotate="0">this</tspan> ok!</text>' }
|
157
204
|
|
158
|
-
it "correctly calculates the
|
205
|
+
it "correctly calculates the positions of the text" do
|
159
206
|
element.process
|
160
207
|
|
161
208
|
expect(flatten_calls(element.base_calls)).to eq [
|
162
209
|
["text_group", []],
|
163
|
-
["fill", []],
|
164
210
|
["font", ["Helvetica", {:style=>:normal}]],
|
165
|
-
["character_spacing", [0]],
|
166
211
|
["draw_text", ["H", {:size=>16, :style=>:normal, :text_anchor=>"start", :at=>[:relative, :relative], :offset=>[0, 0], :rotate=>-10.0}]],
|
167
212
|
["draw_text", ["i", {:size=>16, :style=>:normal, :text_anchor=>"start", :at=>[:relative, :relative], :offset=>[0, 0], :rotate=>-20.0}]],
|
168
213
|
["draw_text", [" ", {:size=>16, :style=>:normal, :text_anchor=>"start", :at=>[:relative, :relative], :offset=>[0, 0], :rotate=>-30.0}]],
|
169
214
|
["save", []],
|
170
|
-
["fill", []],
|
171
215
|
["font", ["Helvetica", {:style=>:normal}]],
|
172
|
-
["character_spacing", [0]],
|
173
216
|
["draw_text", ["this", {:size=>16, :style=>:normal, :text_anchor=>"start", :at=>[:relative, :relative], :offset=>[0, 0]}]],
|
174
217
|
["restore", []],
|
175
218
|
["draw_text", [" ", {:size=>16, :style=>:normal, :text_anchor=>"start", :at=>[:relative, :relative], :offset=>[0, 0], :rotate=>-80.0}]],
|
@@ -32,6 +32,36 @@ RSpec.describe Prawn::SVG::FontRegistry do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
describe "#installed_fonts" do
|
36
|
+
let(:ttf) { instance_double(Prawn::SVG::TTF, family: "Awesome Font", subfamily: "Italic") }
|
37
|
+
let(:ttf2) { instance_double(Prawn::SVG::TTF, family: "Awesome Font", subfamily: "Regular") }
|
38
|
+
before { Prawn::SVG::FontRegistry.external_font_families.clear }
|
39
|
+
|
40
|
+
let(:pdf) do
|
41
|
+
doc = Prawn::Document.new
|
42
|
+
doc.font_families.update({
|
43
|
+
"Awesome Font" => {:italic => "second.ttf", :normal => "file.ttf"}
|
44
|
+
})
|
45
|
+
doc
|
46
|
+
end
|
47
|
+
|
48
|
+
let(:font_registry) { Prawn::SVG::FontRegistry.new(pdf.font_families) }
|
49
|
+
|
50
|
+
it "does not override existing entries in pdf when loading external fonts" do
|
51
|
+
expect(Prawn::SVG::FontRegistry).to receive(:font_path).and_return(["x"])
|
52
|
+
expect(Dir).to receive(:[]).with("x/**/*").and_return(["file.ttf", "second.ttf"])
|
53
|
+
expect(Prawn::SVG::TTF).to receive(:new).with("file.ttf").and_return(ttf)
|
54
|
+
expect(Prawn::SVG::TTF).to receive(:new).with("second.ttf").and_return(ttf2)
|
55
|
+
expect(File).to receive(:file?).at_least(:once).and_return(true)
|
56
|
+
|
57
|
+
Prawn::SVG::FontRegistry.load_external_fonts
|
58
|
+
font_registry.installed_fonts
|
59
|
+
|
60
|
+
existing_font = font_registry.installed_fonts["Awesome Font"]
|
61
|
+
expect(existing_font).to eq(:italic => "second.ttf",:normal => "file.ttf")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
35
65
|
describe "::load_external_fonts" do
|
36
66
|
let(:ttf) { instance_double(Prawn::SVG::TTF, family: "Awesome Font", subfamily: "Italic") }
|
37
67
|
let(:ttf2) { instance_double(Prawn::SVG::TTF, family: "Awesome Font", subfamily: "Regular") }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Prawn::SVG::Interface do
|
4
|
-
let(:bounds) { double(width: 800, height: 600) }
|
4
|
+
let(:bounds) { double(width: 800, height: 600, absolute_left: 0, absolute_top: 0) }
|
5
5
|
let(:prawn) { instance_double(Prawn::Document, font_families: {}, bounds: bounds, cursor: 600) }
|
6
6
|
let(:svg) { '<svg width="250" height="100"></svg>' }
|
7
7
|
|
@@ -30,6 +30,38 @@ describe Prawn::SVG::Interface do
|
|
30
30
|
expect(interface.document.warnings).to eq ["Zero or negative sizing data means this SVG cannot be rendered"]
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
describe "rewrites" do
|
35
|
+
before do
|
36
|
+
[:save_font, :bounding_box].each { |message| allow(prawn).to receive(message).and_yield }
|
37
|
+
allow(prawn).to receive_messages([:move_to, :line_to, :close_path, :fill_color, :stroke_color, :transformation_matrix, :restore_graphics_state])
|
38
|
+
allow(prawn).to receive(:save_graphics_state) { |&block| block.call if block }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "when fill_and_stroke is issued" do
|
42
|
+
context "and fill rule is not set" do
|
43
|
+
let(:interface) { Prawn::SVG::Interface.new('<svg width="250" height="100"><rect width="10" height="10" stroke="red"></rect></svg>', prawn, {}) }
|
44
|
+
|
45
|
+
it "adds content 'B'" do
|
46
|
+
expect(prawn).to receive(:rectangle).with([0, 100], 10, 10)
|
47
|
+
expect(prawn).to receive(:add_content).with("W n")
|
48
|
+
expect(prawn).to receive(:add_content).with("B")
|
49
|
+
interface.draw
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context "and fill rule is evenodd" do
|
54
|
+
let(:interface) { Prawn::SVG::Interface.new('<svg width="250" height="100"><rect width="10" height="10" stroke="red" fill-rule="evenodd"></rect></svg>', prawn, {}) }
|
55
|
+
|
56
|
+
it "adds content 'B*'" do
|
57
|
+
expect(prawn).to receive(:rectangle).with([0, 100], 10, 10)
|
58
|
+
expect(prawn).to receive(:add_content).with("W n")
|
59
|
+
expect(prawn).to receive(:add_content).with("B*")
|
60
|
+
interface.draw
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
33
65
|
end
|
34
66
|
|
35
67
|
describe "#position" do
|
File without changes
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="800">
|
2
|
+
<text x="10" y="50" style="stroke: red; stroke-width: 2; font-size: 50pt; fill: none; font-family: sans-serif;">
|
3
|
+
Stroke only
|
4
|
+
</text>
|
5
|
+
|
6
|
+
<text x="10" y="100" style="stroke: black; stroke-width: 3; font-size: 50pt; fill: blue; font-family: sans-serif;">
|
7
|
+
Stroke and fill
|
8
|
+
</text>
|
9
|
+
|
10
|
+
<text x="10" y="150" style="stroke: none; font-size: 50pt; fill: none; font-family: sans-serif;">
|
11
|
+
No stroke or fill
|
12
|
+
</text>
|
13
|
+
|
14
|
+
<text x="10" y="200" style="stroke: none; stroke-width: 3; font-size: 50pt; fill: blue; font-family: sans-serif;">
|
15
|
+
Fill only
|
16
|
+
</text>
|
17
|
+
|
18
|
+
<g style="stroke: black; stroke-width: 3; fill: green;">
|
19
|
+
<text x="10" y="250" style="font-size: 50pt; font-family: sans-serif;">
|
20
|
+
Inherited
|
21
|
+
</text>
|
22
|
+
</g>
|
23
|
+
|
24
|
+
<text x="10" y="300" style="font-size: 50pt; font-family: sans-serif;">
|
25
|
+
Mixed
|
26
|
+
<tspan style="stroke: black; fill: none;">modes</tspan>
|
27
|
+
in a text
|
28
|
+
</text>
|
29
|
+
|
30
|
+
<text x="10" y="350" style="font-size: 50pt; font-family: sans-serif; stroke: black; fill: none;">
|
31
|
+
More mixed
|
32
|
+
<tspan style="fill: black; stroke: none;">modes</tspan>
|
33
|
+
in a text
|
34
|
+
</text>
|
35
|
+
|
36
|
+
<text x="10" y="400" style="font-size: 50pt; font-family: sans-serif; stroke: none; fill: none;">
|
37
|
+
Even more
|
38
|
+
<tspan style="fill: black; stroke: red;">mixed modes</tspan>
|
39
|
+
in a text
|
40
|
+
</text>
|
41
|
+
</svg>
|
@@ -0,0 +1,98 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3
|
+
<svg version="1.2" width="20mm" height="17.5mm" viewBox="15631 16374 2000 1750" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xml:space="preserve">
|
4
|
+
<defs class="ClipPathGroup">
|
5
|
+
<clipPath id="presentation_clip_path" clipPathUnits="userSpaceOnUse">
|
6
|
+
<rect x="15631" y="16374" width="2000" height="1750"/>
|
7
|
+
</clipPath>
|
8
|
+
</defs>
|
9
|
+
<defs class="TextShapeIndex">
|
10
|
+
<g ooo:slide="id1" ooo:id-list="id3 id4 id5 id6 id7 id8 id9"/>
|
11
|
+
</defs>
|
12
|
+
<defs class="EmbeddedBulletChars">
|
13
|
+
<g id="bullet-char-template(57356)" transform="scale(0.00048828125,-0.00048828125)">
|
14
|
+
<path d="M 580,1141 L 1163,571 580,0 -4,571 580,1141 Z"/>
|
15
|
+
</g>
|
16
|
+
<g id="bullet-char-template(57354)" transform="scale(0.00048828125,-0.00048828125)">
|
17
|
+
<path d="M 8,1128 L 1137,1128 1137,0 8,0 8,1128 Z"/>
|
18
|
+
</g>
|
19
|
+
<g id="bullet-char-template(10146)" transform="scale(0.00048828125,-0.00048828125)">
|
20
|
+
<path d="M 174,0 L 602,739 174,1481 1456,739 174,0 Z M 1358,739 L 309,1346 659,739 1358,739 Z"/>
|
21
|
+
</g>
|
22
|
+
<g id="bullet-char-template(10132)" transform="scale(0.00048828125,-0.00048828125)">
|
23
|
+
<path d="M 2015,739 L 1276,0 717,0 1260,543 174,543 174,936 1260,936 717,1481 1274,1481 2015,739 Z"/>
|
24
|
+
</g>
|
25
|
+
<g id="bullet-char-template(10007)" transform="scale(0.00048828125,-0.00048828125)">
|
26
|
+
<path d="M 0,-2 C -7,14 -16,27 -25,37 L 356,567 C 262,823 215,952 215,954 215,979 228,992 255,992 264,992 276,990 289,987 310,991 331,999 354,1012 L 381,999 492,748 772,1049 836,1024 860,1049 C 881,1039 901,1025 922,1006 886,937 835,863 770,784 769,783 710,716 594,584 L 774,223 C 774,196 753,168 711,139 L 727,119 C 717,90 699,76 672,76 641,76 570,178 457,381 L 164,-76 C 142,-110 111,-127 72,-127 30,-127 9,-110 8,-76 1,-67 -2,-52 -2,-32 -2,-23 -1,-13 0,-2 Z"/>
|
27
|
+
</g>
|
28
|
+
<g id="bullet-char-template(10004)" transform="scale(0.00048828125,-0.00048828125)">
|
29
|
+
<path d="M 285,-33 C 182,-33 111,30 74,156 52,228 41,333 41,471 41,549 55,616 82,672 116,743 169,778 240,778 293,778 328,747 346,684 L 369,508 C 377,444 397,411 428,410 L 1163,1116 C 1174,1127 1196,1133 1229,1133 1271,1133 1292,1118 1292,1087 L 1292,965 C 1292,929 1282,901 1262,881 L 442,47 C 390,-6 338,-33 285,-33 Z"/>
|
30
|
+
</g>
|
31
|
+
<g id="bullet-char-template(9679)" transform="scale(0.00048828125,-0.00048828125)">
|
32
|
+
<path d="M 813,0 C 632,0 489,54 383,161 276,268 223,411 223,592 223,773 276,916 383,1023 489,1130 632,1184 813,1184 992,1184 1136,1130 1245,1023 1353,916 1407,772 1407,592 1407,412 1353,268 1245,161 1136,54 992,0 813,0 Z"/>
|
33
|
+
</g>
|
34
|
+
<g id="bullet-char-template(8226)" transform="scale(0.00048828125,-0.00048828125)">
|
35
|
+
<path d="M 346,457 C 273,457 209,483 155,535 101,586 74,649 74,723 74,796 101,859 155,911 209,963 273,989 346,989 419,989 480,963 531,910 582,859 608,796 608,723 608,648 583,586 532,535 482,483 420,457 346,457 Z"/>
|
36
|
+
</g>
|
37
|
+
<g id="bullet-char-template(8211)" transform="scale(0.00048828125,-0.00048828125)">
|
38
|
+
<path d="M -4,459 L 1135,459 1135,606 -4,606 -4,459 Z"/>
|
39
|
+
</g>
|
40
|
+
</defs>
|
41
|
+
<defs class="TextEmbeddedBitmaps"/>
|
42
|
+
<g class="SlideGroup">
|
43
|
+
<g>
|
44
|
+
<g id="id1" class="Slide" clip-path="url(#presentation_clip_path)">
|
45
|
+
<g class="Page">
|
46
|
+
<g class="Group">
|
47
|
+
<g class="Group">
|
48
|
+
<g class="com.sun.star.drawing.ClosedBezierShape">
|
49
|
+
<g id="id3">
|
50
|
+
<rect class="BoundingBox" stroke="none" fill="none" x="15630" y="16373" width="2003" height="1752"/>
|
51
|
+
<path fill="rgb(0,0,0)" stroke="none" d="M 16568,16411 C 16259,16947 15950,17484 15642,18020 15613,18069 15644,18124 15701,18124 16321,18124 16941,18124 17561,18124 17617,18124 17649,18070 17621,18021 L 16694,16410 C 16665,16362 16596,16362 16568,16411 Z"/>
|
52
|
+
</g>
|
53
|
+
</g>
|
54
|
+
<g class="com.sun.star.drawing.ClosedBezierShape">
|
55
|
+
<g id="id4">
|
56
|
+
<rect class="BoundingBox" stroke="none" fill="none" x="15642" y="16382" width="1983" height="1735"/>
|
57
|
+
<path fill="rgb(255,255,0)" stroke="none" d="M 16582,16406 C 16279,16931 15950,17505 15648,18030 15630,18061 15654,18115 15695,18116 L 17567,18115 C 17593,18115 17642,18080 17616,18030 17303,17486 16994,16949 16682,16406 16663,16374 16600,16374 16582,16406 Z"/>
|
58
|
+
</g>
|
59
|
+
</g>
|
60
|
+
<g class="com.sun.star.drawing.ClosedBezierShape">
|
61
|
+
<g id="id5">
|
62
|
+
<rect class="BoundingBox" stroke="none" fill="none" x="15668" y="16410" width="1926" height="1685"/>
|
63
|
+
<path fill="rgb(0,0,0)" stroke="none" d="M 16590,16444 C 16300,16959 15970,17511 15680,18026 15661,18059 15659,18092 15712,18093 L 17549,18093 C 17602,18092 17598,18055 17581,18023 17280,17501 16973,16968 16673,16445 16647,16399 16617,16397 16590,16444 Z M 16632,16626 C 16374,17075 16116,17524 15858,17972 L 17406,17972 C 17148,17524 16890,17075 16632,16626 Z"/>
|
64
|
+
</g>
|
65
|
+
</g>
|
66
|
+
</g>
|
67
|
+
<g class="Group">
|
68
|
+
<g class="com.sun.star.drawing.EllipseShape">
|
69
|
+
<g id="id6">
|
70
|
+
<rect class="BoundingBox" stroke="none" fill="none" x="16554" y="17446" width="156" height="156"/>
|
71
|
+
<path fill="rgb(0,0,0)" stroke="none" d="M 16632,17601 C 16617,17601 16605,17598 16593,17591 16580,17583 16572,17575 16564,17562 16557,17550 16554,17538 16554,17524 16554,17509 16557,17497 16564,17485 16572,17472 16580,17464 16593,17456 16605,17449 16617,17446 16632,17446 16646,17446 16658,17449 16670,17456 16683,17464 16691,17472 16699,17485 16706,17497 16709,17509 16709,17524 16709,17538 16706,17550 16699,17562 16691,17575 16683,17583 16670,17591 16658,17598 16646,17601 16632,17601 L 16632,17601 Z"/>
|
72
|
+
</g>
|
73
|
+
</g>
|
74
|
+
<g class="com.sun.star.drawing.ClosedBezierShape">
|
75
|
+
<g id="id7">
|
76
|
+
<rect class="BoundingBox" stroke="none" fill="none" x="16246" y="17188" width="328" height="336"/>
|
77
|
+
<path fill="rgb(0,0,0)" stroke="none" d="M 16515,17522 C 16426,17522 16336,17522 16246,17522 16250,17396 16307,17268 16438,17188 16483,17267 16528,17345 16573,17424 16539,17444 16516,17480 16515,17522 Z"/>
|
78
|
+
</g>
|
79
|
+
</g>
|
80
|
+
<g class="com.sun.star.drawing.ClosedBezierShape">
|
81
|
+
<g id="id8">
|
82
|
+
<rect class="BoundingBox" stroke="none" fill="none" x="16689" y="17188" width="328" height="336"/>
|
83
|
+
<path fill="rgb(0,0,0)" stroke="none" d="M 16689,17423 C 16734,17345 16779,17266 16824,17188 16932,17254 17014,17368 17016,17522 16926,17522 16837,17522 16747,17521 16746,17479 16723,17442 16689,17423 Z"/>
|
84
|
+
</g>
|
85
|
+
</g>
|
86
|
+
<g class="com.sun.star.drawing.ClosedBezierShape">
|
87
|
+
<g id="id9">
|
88
|
+
<rect class="BoundingBox" stroke="none" fill="none" x="16438" y="17624" width="386" height="286"/>
|
89
|
+
<path fill="rgb(0,0,0)" stroke="none" d="M 16632,17639 C 16653,17639 16672,17634 16690,17624 16734,17701 16779,17779 16823,17857 16713,17918 16573,17932 16439,17857 16484,17779 16529,17701 16574,17624 16591,17634 16611,17639 16632,17639 Z"/>
|
90
|
+
</g>
|
91
|
+
</g>
|
92
|
+
</g>
|
93
|
+
</g>
|
94
|
+
</g>
|
95
|
+
</g>
|
96
|
+
</g>
|
97
|
+
</g>
|
98
|
+
</svg>
|
data/spec/spec_helper.rb
CHANGED
@@ -8,8 +8,8 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
8
8
|
module Support
|
9
9
|
def flatten_calls(calls)
|
10
10
|
[].tap do |flattened_calls|
|
11
|
-
add = -> (
|
12
|
-
|
11
|
+
add = -> (local_calls) do
|
12
|
+
local_calls.each do |call|
|
13
13
|
flattened_calls << call[0..1]
|
14
14
|
add.call call[2]
|
15
15
|
end
|
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.28.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:
|
11
|
+
date: 2018-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prawn
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '1.
|
39
|
+
version: '1.6'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '1.
|
46
|
+
version: '1.6'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,12 +99,15 @@ files:
|
|
99
99
|
- lib/prawn/svg/calculators/document_sizing.rb
|
100
100
|
- lib/prawn/svg/calculators/pixels.rb
|
101
101
|
- lib/prawn/svg/color.rb
|
102
|
-
- lib/prawn/svg/css.rb
|
102
|
+
- lib/prawn/svg/css/font_family_parser.rb
|
103
|
+
- lib/prawn/svg/css/selector_parser.rb
|
104
|
+
- lib/prawn/svg/css/stylesheets.rb
|
103
105
|
- lib/prawn/svg/document.rb
|
104
106
|
- lib/prawn/svg/elements.rb
|
105
107
|
- lib/prawn/svg/elements/base.rb
|
106
108
|
- lib/prawn/svg/elements/call_duplicator.rb
|
107
109
|
- lib/prawn/svg/elements/circle.rb
|
110
|
+
- lib/prawn/svg/elements/clip_path.rb
|
108
111
|
- lib/prawn/svg/elements/container.rb
|
109
112
|
- lib/prawn/svg/elements/depth_first_base.rb
|
110
113
|
- lib/prawn/svg/elements/ellipse.rb
|
@@ -142,7 +145,9 @@ files:
|
|
142
145
|
- spec/prawn/svg/calculators/document_sizing_spec.rb
|
143
146
|
- spec/prawn/svg/calculators/pixels_spec.rb
|
144
147
|
- spec/prawn/svg/color_spec.rb
|
145
|
-
- spec/prawn/svg/
|
148
|
+
- spec/prawn/svg/css/font_family_parser_spec.rb
|
149
|
+
- spec/prawn/svg/css/selector_parser_spec.rb
|
150
|
+
- spec/prawn/svg/css/stylesheets_spec.rb
|
146
151
|
- spec/prawn/svg/document_spec.rb
|
147
152
|
- spec/prawn/svg/elements/base_spec.rb
|
148
153
|
- spec/prawn/svg/elements/gradient_spec.rb
|
@@ -164,7 +169,7 @@ files:
|
|
164
169
|
- spec/prawn/svg/url_loader_spec.rb
|
165
170
|
- spec/sample_images/mushroom-long.jpg
|
166
171
|
- spec/sample_images/mushroom-wide.jpg
|
167
|
-
- spec/sample_output
|
172
|
+
- spec/sample_output/.keep
|
168
173
|
- spec/sample_svg/arcs01.svg
|
169
174
|
- spec/sample_svg/arrows.svg
|
170
175
|
- spec/sample_svg/cap_styles.svg
|
@@ -210,6 +215,7 @@ files:
|
|
210
215
|
- spec/sample_svg/subviewports.svg
|
211
216
|
- spec/sample_svg/subviewports2.svg
|
212
217
|
- spec/sample_svg/text_entities.svg
|
218
|
+
- spec/sample_svg/text_stroke.svg
|
213
219
|
- spec/sample_svg/tref01.svg
|
214
220
|
- spec/sample_svg/triangle01.svg
|
215
221
|
- spec/sample_svg/tspan01.svg
|
@@ -222,6 +228,7 @@ files:
|
|
222
228
|
- spec/sample_svg/use.svg
|
223
229
|
- spec/sample_svg/viewbox.svg
|
224
230
|
- spec/sample_svg/viewport.svg
|
231
|
+
- spec/sample_svg/warning-radioactive.svg
|
225
232
|
- spec/sample_ttf/OpenSans-SemiboldItalic.ttf
|
226
233
|
- spec/spec_helper.rb
|
227
234
|
homepage: http://github.com/mogest/prawn-svg
|
@@ -244,8 +251,100 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
251
|
version: '0'
|
245
252
|
requirements: []
|
246
253
|
rubyforge_project:
|
247
|
-
rubygems_version: 2.
|
254
|
+
rubygems_version: 2.6.8
|
248
255
|
signing_key:
|
249
256
|
specification_version: 4
|
250
257
|
summary: SVG renderer for Prawn PDF library
|
251
|
-
test_files:
|
258
|
+
test_files:
|
259
|
+
- spec/integration_spec.rb
|
260
|
+
- spec/prawn/svg/attributes/transform_spec.rb
|
261
|
+
- spec/prawn/svg/calculators/aspect_ratio_spec.rb
|
262
|
+
- spec/prawn/svg/calculators/document_sizing_spec.rb
|
263
|
+
- spec/prawn/svg/calculators/pixels_spec.rb
|
264
|
+
- spec/prawn/svg/color_spec.rb
|
265
|
+
- spec/prawn/svg/css/font_family_parser_spec.rb
|
266
|
+
- spec/prawn/svg/css/selector_parser_spec.rb
|
267
|
+
- spec/prawn/svg/css/stylesheets_spec.rb
|
268
|
+
- spec/prawn/svg/document_spec.rb
|
269
|
+
- spec/prawn/svg/elements/base_spec.rb
|
270
|
+
- spec/prawn/svg/elements/gradient_spec.rb
|
271
|
+
- spec/prawn/svg/elements/line_spec.rb
|
272
|
+
- spec/prawn/svg/elements/marker_spec.rb
|
273
|
+
- spec/prawn/svg/elements/path_spec.rb
|
274
|
+
- spec/prawn/svg/elements/polygon_spec.rb
|
275
|
+
- spec/prawn/svg/elements/polyline_spec.rb
|
276
|
+
- spec/prawn/svg/elements/text_spec.rb
|
277
|
+
- spec/prawn/svg/font_registry_spec.rb
|
278
|
+
- spec/prawn/svg/font_spec.rb
|
279
|
+
- spec/prawn/svg/interface_spec.rb
|
280
|
+
- spec/prawn/svg/loaders/data_spec.rb
|
281
|
+
- spec/prawn/svg/loaders/file_spec.rb
|
282
|
+
- spec/prawn/svg/loaders/web_spec.rb
|
283
|
+
- spec/prawn/svg/pathable_spec.rb
|
284
|
+
- spec/prawn/svg/properties_spec.rb
|
285
|
+
- spec/prawn/svg/ttf_spec.rb
|
286
|
+
- spec/prawn/svg/url_loader_spec.rb
|
287
|
+
- spec/sample_images/mushroom-long.jpg
|
288
|
+
- spec/sample_images/mushroom-wide.jpg
|
289
|
+
- spec/sample_output/.keep
|
290
|
+
- spec/sample_svg/arcs01.svg
|
291
|
+
- spec/sample_svg/arrows.svg
|
292
|
+
- spec/sample_svg/cap_styles.svg
|
293
|
+
- spec/sample_svg/circle01.svg
|
294
|
+
- spec/sample_svg/clip_path.svg
|
295
|
+
- spec/sample_svg/close_path.svg
|
296
|
+
- spec/sample_svg/cubic01.svg
|
297
|
+
- spec/sample_svg/cubic01a.svg
|
298
|
+
- spec/sample_svg/cubic02.svg
|
299
|
+
- spec/sample_svg/display_none.svg
|
300
|
+
- spec/sample_svg/ellipse01.svg
|
301
|
+
- spec/sample_svg/gistfile1.svg
|
302
|
+
- spec/sample_svg/google_charts.svg
|
303
|
+
- spec/sample_svg/gradients.svg
|
304
|
+
- spec/sample_svg/hidden_paths.svg
|
305
|
+
- spec/sample_svg/highcharts.svg
|
306
|
+
- spec/sample_svg/image01.svg
|
307
|
+
- spec/sample_svg/image02_base64.svg
|
308
|
+
- spec/sample_svg/image03.svg
|
309
|
+
- spec/sample_svg/line01.svg
|
310
|
+
- spec/sample_svg/marker.svg
|
311
|
+
- spec/sample_svg/markers_degenerate_cp.svg
|
312
|
+
- spec/sample_svg/maths.svg
|
313
|
+
- spec/sample_svg/matrix_transform.svg
|
314
|
+
- spec/sample_svg/matrix_transform_3.svg
|
315
|
+
- spec/sample_svg/negminy.svg
|
316
|
+
- spec/sample_svg/no_width_or_height.svg
|
317
|
+
- spec/sample_svg/offset_viewport.svg
|
318
|
+
- spec/sample_svg/omnigraffle.svg
|
319
|
+
- spec/sample_svg/opacity01.svg
|
320
|
+
- spec/sample_svg/path.svg
|
321
|
+
- spec/sample_svg/pie_piece.svg
|
322
|
+
- spec/sample_svg/polygon01.svg
|
323
|
+
- spec/sample_svg/polyline01.svg
|
324
|
+
- spec/sample_svg/preserve-space.svg
|
325
|
+
- spec/sample_svg/quad01.svg
|
326
|
+
- spec/sample_svg/rect01.svg
|
327
|
+
- spec/sample_svg/rect02.svg
|
328
|
+
- spec/sample_svg/rotate_scale.svg
|
329
|
+
- spec/sample_svg/scale.svg
|
330
|
+
- spec/sample_svg/scruffy_graph.svg
|
331
|
+
- spec/sample_svg/subfamilies.svg
|
332
|
+
- spec/sample_svg/subviewports.svg
|
333
|
+
- spec/sample_svg/subviewports2.svg
|
334
|
+
- spec/sample_svg/text_entities.svg
|
335
|
+
- spec/sample_svg/text_stroke.svg
|
336
|
+
- spec/sample_svg/tref01.svg
|
337
|
+
- spec/sample_svg/triangle01.svg
|
338
|
+
- spec/sample_svg/tspan01.svg
|
339
|
+
- spec/sample_svg/tspan02.svg
|
340
|
+
- spec/sample_svg/tspan03-cc.svg
|
341
|
+
- spec/sample_svg/tspan03.svg
|
342
|
+
- spec/sample_svg/tspan04.svg
|
343
|
+
- spec/sample_svg/tspan05.svg
|
344
|
+
- spec/sample_svg/tspan91.svg
|
345
|
+
- spec/sample_svg/use.svg
|
346
|
+
- spec/sample_svg/viewbox.svg
|
347
|
+
- spec/sample_svg/viewport.svg
|
348
|
+
- spec/sample_svg/warning-radioactive.svg
|
349
|
+
- spec/sample_ttf/OpenSans-SemiboldItalic.ttf
|
350
|
+
- spec/spec_helper.rb
|