prawn-svg 0.9.1.11 → 0.12.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +78 -0
- data/lib/prawn/svg/element.rb +13 -16
- data/lib/prawn/svg/interface.rb +4 -2
- data/lib/prawn/svg/parser.rb +9 -6
- data/lib/prawn/svg/parser/path.rb +2 -1
- data/lib/prawn/svg/version.rb +1 -1
- data/spec/lib/path_spec.rb +3 -2
- data/spec/sample_svg/close_path.svg +10 -0
- data/spec/sample_svg/matrix_transform.svg +10 -0
- metadata +63 -76
- data/README +0 -57
data/.gitignore
CHANGED
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
prawn-svg
|
2
|
+
=========
|
3
|
+
|
4
|
+
An SVG renderer for the Prawn PDF library.
|
5
|
+
|
6
|
+
This will take an SVG file as input and render it into your PDF. Find out more about the Prawn PDF library at:
|
7
|
+
|
8
|
+
http://wiki.github.com/sandal/prawn/
|
9
|
+
|
10
|
+
Using prawn-svg
|
11
|
+
---------------
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
Prawn::Document.generate("svg.pdf") do
|
15
|
+
svg svg_data, :at => [x, y], :width => w
|
16
|
+
end
|
17
|
+
```
|
18
|
+
|
19
|
+
<tt>:at</tt> must be specified. <tt>:width</tt>, <tt>:height</tt>, or neither may be specified; if neither is present,
|
20
|
+
the resolution specified in the SVG will be used.
|
21
|
+
|
22
|
+
Supported features
|
23
|
+
------------------
|
24
|
+
|
25
|
+
prawn-svg is in its infancy and does not support the full SVG specifications. It currently supports:
|
26
|
+
|
27
|
+
- <tt>line</tt> tag
|
28
|
+
- <tt>polyline</tt> tag
|
29
|
+
- <tt>polygon</tt> tag
|
30
|
+
- <tt>circle</tt> tag
|
31
|
+
- <tt>ellipse</tt> tag (although this seems to be buggy)
|
32
|
+
|
33
|
+
- <tt>rect</tt> tag
|
34
|
+
supports rounded rects, but only one radius is applied to all corners
|
35
|
+
|
36
|
+
- <tt>path</tt> tag
|
37
|
+
supports moveto, closepath, lineto, horiz lineto, vert lineto, curveto, smooth curveto, quad curveto, smooth quad curveto
|
38
|
+
does not support elliptical arc
|
39
|
+
|
40
|
+
- <tt>text</tt> and <tt>tspan</tt> tags
|
41
|
+
attributes: size, text-anchor, font-family, font-weight, dx, dy
|
42
|
+
|
43
|
+
- <tt>svg</tt>, <tt>g</tt> and <tt>symbol</tt> tags
|
44
|
+
|
45
|
+
- <tt>use</tt> tag
|
46
|
+
|
47
|
+
- <tt>style</tt> tag, if css_parser gem is installed on the system (see CSS section below)
|
48
|
+
|
49
|
+
- attributes/styles: <tt>fill</tt>, <tt>stroke</tt>, <tt>stroke-width</tt>, <tt>opacity</tt>, <tt>fill-opacity</tt>, <tt>stroke-opacity</tt>, <tt>transform</tt>
|
50
|
+
|
51
|
+
- transform methods: <tt>translate</tt>, <tt>rotate</tt>, <tt>scale</tt>, <tt>matrix</tt>
|
52
|
+
|
53
|
+
- colors: HTML standard names, <tt>#xxx</tt>, <tt>#xxxxxx</tt>, <tt>rgb(1, 2, 3)</tt>, <tt>rgb(1%, 2%, 3%)</tt>
|
54
|
+
|
55
|
+
- measurements specified in <tt>pt</tt>, <tt>cm</tt>, <tt>dm</tt>, <tt>ft</tt>, <tt>in</tt>, <tt>m</tt>, <tt>mm</tt>, <tt>yd</tt>, <tt>%</tt>
|
56
|
+
|
57
|
+
- fonts: generic CSS fonts, built in PDF fonts, and any TTF fonts in your fonts path
|
58
|
+
|
59
|
+
By default, prawn-svg has a fonts path of <tt>["/Library/Fonts", "/usr/share/fonts/truetype/**"]</tt> to catch
|
60
|
+
Mac OS X and Debian Linux users. You can add to the font path:
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
Prawn::Svg.font_path << "/my/font/directory"
|
64
|
+
```
|
65
|
+
|
66
|
+
CSS
|
67
|
+
---
|
68
|
+
|
69
|
+
If the css_parser gem is installed, it will handle CSS style definitions, but only simple tag, class or id definitions. It's very basic
|
70
|
+
so do not expect too much of it.
|
71
|
+
|
72
|
+
Not supported
|
73
|
+
-------------
|
74
|
+
|
75
|
+
prawn-svg does NOT support external references, measurements in en or em, gradients/patterns or markers.
|
76
|
+
|
77
|
+
--
|
78
|
+
Copyright Roger Nesbitt <roger@seriousorange.com>. MIT licence.
|
data/lib/prawn/svg/element.rb
CHANGED
@@ -53,37 +53,34 @@ class Prawn::Svg::Element
|
|
53
53
|
case name
|
54
54
|
when 'translate'
|
55
55
|
x, y = arguments
|
56
|
-
x, y = x.split(/\s+/) if y.nil?
|
57
56
|
add_call_and_enter name, @document.distance(x), -@document.distance(y)
|
58
57
|
|
59
58
|
when 'rotate'
|
60
|
-
|
61
|
-
if
|
62
|
-
add_call_and_enter name, -
|
59
|
+
r, x, y = arguments.collect {|a| a.to_f}
|
60
|
+
if arguments.length == 3
|
61
|
+
add_call_and_enter name, -r, :origin => [@document.x(x), @document.y(y)]
|
63
62
|
else
|
64
|
-
add_call_and_enter name, -
|
63
|
+
add_call_and_enter name, -r, :origin => [0, @document.y('0')]
|
65
64
|
end
|
66
65
|
|
67
66
|
when 'scale'
|
68
|
-
|
69
|
-
|
70
|
-
y_scale = (args[1] || x_scale).to_f
|
67
|
+
x_scale = arguments[0].to_f
|
68
|
+
y_scale = (arguments[1] || x_scale).to_f
|
71
69
|
add_call_and_enter "transformation_matrix", x_scale, 0, 0, y_scale, 0, 0
|
72
70
|
|
73
71
|
when 'matrix'
|
74
|
-
|
75
|
-
if args.length != 6
|
72
|
+
if arguments.length != 6
|
76
73
|
@document.warnings << "transform 'matrix' must have six arguments"
|
77
74
|
else
|
78
|
-
a, b, c, d, e, f =
|
79
|
-
add_call_and_enter "transformation_matrix", a, b, c, d, @document.distance(e), -@document.distance(f)
|
75
|
+
a, b, c, d, e, f = arguments.collect {|argument| argument.to_f}
|
76
|
+
add_call_and_enter "transformation_matrix", a, -b, -c, d, @document.distance(e), -@document.distance(f)
|
80
77
|
end
|
81
78
|
else
|
82
79
|
@document.warnings << "Unknown transformation '#{name}'; ignoring"
|
83
80
|
end
|
84
81
|
end
|
85
|
-
end
|
86
|
-
|
82
|
+
end
|
83
|
+
|
87
84
|
# Opacity:
|
88
85
|
# We can't do nested opacities quite like the SVG requires, but this is close enough.
|
89
86
|
fill_opacity = stroke_opacity = clamp(@attributes['opacity'].to_f, 0, 1) if @attributes['opacity']
|
@@ -147,9 +144,9 @@ class Prawn::Svg::Element
|
|
147
144
|
def parse_css_method_calls(string)
|
148
145
|
string.scan(/\s*(\w+)\(([^)]+)\)\s*/).collect do |call|
|
149
146
|
name, argument_string = call
|
150
|
-
arguments = argument_string.split(
|
147
|
+
arguments = argument_string.strip.split(/\s*[,\s]\s*/)
|
151
148
|
[name, arguments]
|
152
|
-
end
|
149
|
+
end
|
153
150
|
end
|
154
151
|
|
155
152
|
# TODO : use http://www.w3.org/TR/SVG11/types.html#ColorKeywords
|
data/lib/prawn/svg/interface.rb
CHANGED
@@ -92,8 +92,10 @@ module Prawn
|
|
92
92
|
@relative_text_position = options[:at][0] + width + space_width
|
93
93
|
|
94
94
|
when 'transformation_matrix'
|
95
|
-
|
96
|
-
|
95
|
+
x = prawn.bounds.absolute_left
|
96
|
+
y = prawn.bounds.absolute_top
|
97
|
+
arguments[4] += x - (x * arguments[0] - y * arguments[1])
|
98
|
+
arguments[5] += y - (x * arguments[1] + y * arguments[0])
|
97
99
|
|
98
100
|
when 'save'
|
99
101
|
prawn.save_graphics_state
|
data/lib/prawn/svg/parser.rb
CHANGED
@@ -51,7 +51,6 @@ class Prawn::Svg::Parser
|
|
51
51
|
|
52
52
|
private
|
53
53
|
REQUIRED_ATTRIBUTES = {
|
54
|
-
"line" => %w(x1 y1 x2 y2),
|
55
54
|
"polyline" => %w(points),
|
56
55
|
"polygon" => %w(points),
|
57
56
|
"circle" => %w(r),
|
@@ -88,7 +87,7 @@ class Prawn::Svg::Parser
|
|
88
87
|
@svg_text.parse(element)
|
89
88
|
|
90
89
|
when 'line'
|
91
|
-
element.add_call 'line', x(attrs['x1']), y(attrs['y1']), x(attrs['x2']), y(attrs['y2'])
|
90
|
+
element.add_call 'line', x(attrs['x1'] || '0'), y(attrs['y1'] || '0'), x(attrs['x2'] || '0'), y(attrs['y2'] || '0')
|
92
91
|
|
93
92
|
when 'polyline'
|
94
93
|
points = attrs['points'].split(/\s+/)
|
@@ -164,11 +163,15 @@ class Prawn::Svg::Parser
|
|
164
163
|
end
|
165
164
|
|
166
165
|
commands.collect do |command, args|
|
167
|
-
|
168
|
-
|
169
|
-
|
166
|
+
if args && args.length > 0
|
167
|
+
point_to = [x(args[0]), y(args[1])]
|
168
|
+
if command == 'curve_to'
|
169
|
+
opts = {:bounds => [[x(args[2]), y(args[3])], [x(args[4]), y(args[5])]]}
|
170
|
+
end
|
171
|
+
element.add_call command, point_to, opts
|
172
|
+
else
|
173
|
+
element.add_call command
|
170
174
|
end
|
171
|
-
element.add_call command, point_to, opts
|
172
175
|
end
|
173
176
|
end
|
174
177
|
|
data/lib/prawn/svg/version.rb
CHANGED
data/spec/lib/path_spec.rb
CHANGED
@@ -9,7 +9,7 @@ describe Prawn::Svg::Parser::Path do
|
|
9
9
|
it "correctly parses a valid path" do
|
10
10
|
calls = []
|
11
11
|
@path.stub!(:run_path_command) {|*args| calls << args}
|
12
|
-
@path.parse("A12.34 -56.78 89B4 5 C 6,7 T QX 0")
|
12
|
+
@path.parse("A12.34 -56.78 89B4 5 C 6,7 T QX 0 Z")
|
13
13
|
|
14
14
|
calls.should == [
|
15
15
|
["A", [12.34, -56.78, 89]],
|
@@ -17,7 +17,8 @@ describe Prawn::Svg::Parser::Path do
|
|
17
17
|
["C", [6, 7]],
|
18
18
|
["T", []],
|
19
19
|
["Q", []],
|
20
|
-
["X", [0]]
|
20
|
+
["X", [0]],
|
21
|
+
["Z", []]
|
21
22
|
]
|
22
23
|
end
|
23
24
|
|
@@ -0,0 +1,10 @@
|
|
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="12cm" height="4cm" viewBox="0 0 1200 400"
|
5
|
+
xmlns="http://www.w3.org/2000/svg" version="1.1">
|
6
|
+
<desc>Example close_path - triangle with rounded corners</desc>
|
7
|
+
<!-- Show outline of canvas using 'polygon' element -->
|
8
|
+
<path d="M 10,10 L 15,20 L 20,10 z" />
|
9
|
+
</svg>
|
10
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<svg height="975" version="1.1" width="1275" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<text x="200" y="200" text-anchor="middle" stroke="none" fill="#000000" font-size="40px" font-weight="bold" transform="matrix(0.9848,0.1736,-0.1736,0.9848,0,0)">
|
3
|
+
Zero transform
|
4
|
+
</text>
|
5
|
+
<rect x="198" y="198" width="4" height="4" stroke="blue" fill="blue" />
|
6
|
+
<text x="638" y="471" text-anchor="middle" stroke="none" fill="#000000" font-size="80px" font-weight="bold" transform="matrix(0.7071,-0.7071,0.7071,0.7071,-146.1814,589.0868)">
|
7
|
+
Matrix transform
|
8
|
+
</text>
|
9
|
+
<rect x="636" y="469" width="4" height="4" stroke="blue" fill="blue" />
|
10
|
+
</svg>
|
metadata
CHANGED
@@ -1,82 +1,75 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-svg
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.12.0.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 9
|
9
|
-
- 1
|
10
|
-
- 11
|
11
|
-
version: 0.9.1.11
|
12
6
|
platform: ruby
|
13
|
-
authors:
|
7
|
+
authors:
|
14
8
|
- Roger Nesbitt
|
15
9
|
autorequire:
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
dependencies:
|
22
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-10-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
23
15
|
name: prawn
|
24
|
-
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
26
17
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
hash: 55
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
- 8
|
34
|
-
- 4
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
35
21
|
version: 0.8.4
|
36
22
|
type: :runtime
|
37
|
-
version_requirements: *id001
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: rspec
|
40
23
|
prerelease: false
|
41
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.8.4
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
42
33
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
|
47
|
-
segments:
|
48
|
-
- 0
|
49
|
-
version: "0"
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
50
38
|
type: :development
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: rake
|
54
39
|
prerelease: false
|
55
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
56
49
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
segments:
|
62
|
-
- 0
|
63
|
-
version: "0"
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
64
54
|
type: :development
|
65
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
66
62
|
description: SVG renderer for Prawn PDF library
|
67
63
|
email: roger@seriousorange.com
|
68
64
|
executables: []
|
69
|
-
|
70
65
|
extensions: []
|
71
|
-
|
72
66
|
extra_rdoc_files: []
|
73
|
-
|
74
|
-
files:
|
67
|
+
files:
|
75
68
|
- .gitignore
|
76
69
|
- .rspec
|
77
70
|
- Gemfile
|
78
71
|
- LICENSE
|
79
|
-
- README
|
72
|
+
- README.md
|
80
73
|
- Rakefile
|
81
74
|
- lib/prawn-svg.rb
|
82
75
|
- lib/prawn/svg/document.rb
|
@@ -99,12 +92,14 @@ files:
|
|
99
92
|
- spec/sample_output/directory
|
100
93
|
- spec/sample_svg/arcs01.svg
|
101
94
|
- spec/sample_svg/circle01.svg
|
95
|
+
- spec/sample_svg/close_path.svg
|
102
96
|
- spec/sample_svg/cubic01.svg
|
103
97
|
- spec/sample_svg/cubic01a.svg
|
104
98
|
- spec/sample_svg/cubic02.svg
|
105
99
|
- spec/sample_svg/ellipse01.svg
|
106
100
|
- spec/sample_svg/line01.svg
|
107
101
|
- spec/sample_svg/maths.svg
|
102
|
+
- spec/sample_svg/matrix_transform.svg
|
108
103
|
- spec/sample_svg/omnigraffle.svg
|
109
104
|
- spec/sample_svg/opacity01.svg
|
110
105
|
- spec/sample_svg/polygon01.svg
|
@@ -120,41 +115,31 @@ files:
|
|
120
115
|
- spec/sample_svg/tspan03.svg
|
121
116
|
- spec/sample_svg/use.svg
|
122
117
|
- spec/spec_helper.rb
|
123
|
-
has_rdoc: true
|
124
118
|
homepage: http://github.com/mogest/prawn-svg
|
125
119
|
licenses: []
|
126
|
-
|
127
120
|
post_install_message:
|
128
121
|
rdoc_options: []
|
129
|
-
|
130
|
-
require_paths:
|
122
|
+
require_paths:
|
131
123
|
- lib
|
132
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
125
|
none: false
|
134
|
-
requirements:
|
135
|
-
- -
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
|
138
|
-
|
139
|
-
- 0
|
140
|
-
version: "0"
|
141
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ! '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
131
|
none: false
|
143
|
-
requirements:
|
144
|
-
- -
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
|
147
|
-
segments:
|
148
|
-
- 0
|
149
|
-
version: "0"
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
150
136
|
requirements: []
|
151
|
-
|
152
137
|
rubyforge_project:
|
153
|
-
rubygems_version: 1.
|
138
|
+
rubygems_version: 1.8.23
|
154
139
|
signing_key:
|
155
140
|
specification_version: 3
|
156
141
|
summary: SVG renderer for Prawn PDF library
|
157
|
-
test_files:
|
142
|
+
test_files:
|
158
143
|
- spec/lib/parser_spec.rb
|
159
144
|
- spec/lib/path_spec.rb
|
160
145
|
- spec/lib/svg_spec.rb
|
@@ -165,12 +150,14 @@ test_files:
|
|
165
150
|
- spec/sample_output/directory
|
166
151
|
- spec/sample_svg/arcs01.svg
|
167
152
|
- spec/sample_svg/circle01.svg
|
153
|
+
- spec/sample_svg/close_path.svg
|
168
154
|
- spec/sample_svg/cubic01.svg
|
169
155
|
- spec/sample_svg/cubic01a.svg
|
170
156
|
- spec/sample_svg/cubic02.svg
|
171
157
|
- spec/sample_svg/ellipse01.svg
|
172
158
|
- spec/sample_svg/line01.svg
|
173
159
|
- spec/sample_svg/maths.svg
|
160
|
+
- spec/sample_svg/matrix_transform.svg
|
174
161
|
- spec/sample_svg/omnigraffle.svg
|
175
162
|
- spec/sample_svg/opacity01.svg
|
176
163
|
- spec/sample_svg/polygon01.svg
|
data/README
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
An SVG renderer for the Prawn PDF library.
|
2
|
-
|
3
|
-
This will take an SVG file as input and render it into your PDF. Find out more about the Prawn PDF library at:
|
4
|
-
|
5
|
-
http://wiki.github.com/sandal/prawn/
|
6
|
-
|
7
|
-
Using prawn-svg:
|
8
|
-
|
9
|
-
Prawn::Document.generate("svg.pdf") do
|
10
|
-
svg svg_data, :at => [x, y], :width => w
|
11
|
-
end
|
12
|
-
|
13
|
-
:at must be specified. :width, :height, or neither may be specified; if neither is present,
|
14
|
-
the resolution specified in the SVG will be used.
|
15
|
-
|
16
|
-
prawn-svg is in its infancy and does not support the full SVG specifications. It currently supports:
|
17
|
-
|
18
|
-
- line tag
|
19
|
-
- polyline tag
|
20
|
-
- polygon tag
|
21
|
-
- circle tag
|
22
|
-
- ellipse tag (although this seems to be buggy)
|
23
|
-
|
24
|
-
- rect tag
|
25
|
-
supports rounded rects, but only one radius is applied to all corners
|
26
|
-
|
27
|
-
- path tag
|
28
|
-
supports moveto, closepath, lineto, horiz lineto, vert lineto, curveto, smooth curveto, quad curveto, smooth quad curveto
|
29
|
-
does not support elliptical arc
|
30
|
-
|
31
|
-
- text and tspan tags
|
32
|
-
attributes: size, text-anchor, font-family, font-weight, dx, dy
|
33
|
-
|
34
|
-
- svg, g and symbol tags
|
35
|
-
|
36
|
-
- use tag
|
37
|
-
|
38
|
-
- style tag, if css_parser gem is installed on the system [1]
|
39
|
-
|
40
|
-
- attributes/styles: fill, stroke, stroke-width, opacity, fill-opacity, stroke-opacity, transform
|
41
|
-
|
42
|
-
- transform methods: translate, rotate, scale, matrix
|
43
|
-
|
44
|
-
- colors: html standard names, #xxx, #xxxxxx, rgb(1, 2, 3), rgb(1%, 2%, 3%)
|
45
|
-
|
46
|
-
- measurements specified in pt, cm, dm, ft, in, m, mm, yd, %
|
47
|
-
|
48
|
-
- fonts: generic CSS fonts, built in PDF fonts, and any TTF fonts in your fonts path
|
49
|
-
|
50
|
-
By default, prawn-svg has a fonts path of ["/Library/Fonts", "/usr/share/fonts/truetype/**"] to catch
|
51
|
-
Mac OS X and Debian Linux users. You can add to the font path:
|
52
|
-
|
53
|
-
Prawn::Svg.font_path << "/my/font/directory"
|
54
|
-
|
55
|
-
prawn-svg does NOT support external references, gradients/patterns or markers.
|
56
|
-
|
57
|
-
[1] If the css_parser gem is installed, it will handle CSS style definitions, but only simple tag, class or id definitions.
|