prawn-icon 2.4.0 → 3.1.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/CHANGELOG.md +57 -0
- data/Gemfile +2 -0
- data/README.md +12 -0
- data/Rakefile +0 -1
- data/data/fonts/fab/fa-brands.ttf +0 -0
- data/data/fonts/fab/fab.yml +32 -3
- data/data/fonts/far/fa-regular.ttf +0 -0
- data/data/fonts/far/far.yml +1 -1
- data/data/fonts/fas/fa-solid.ttf +0 -0
- data/data/fonts/fas/fas.yml +67 -2
- data/data/fonts/mdi/LICENSE +20 -0
- data/data/fonts/mdi/materialdesignicons-webfont.ttf +0 -0
- data/data/fonts/mdi/mdi.yml +7099 -0
- data/examples/fontawesome.rb +3 -2
- data/examples/foundation_icons.rb +3 -2
- data/examples/mdi.rb +36 -0
- data/examples/paymentfont.rb +3 -2
- data/lib/prawn/icon/base.rb +16 -4
- data/lib/prawn/icon/compatibility.rb +25 -20
- data/lib/prawn/icon/configuration.rb +40 -0
- data/lib/prawn/icon/errors.rb +2 -2
- data/lib/prawn/icon/font_data.rb +13 -9
- data/lib/prawn/icon/interface.rb +38 -13
- data/lib/prawn/icon/parser.rb +14 -12
- data/lib/prawn/icon/version.rb +3 -3
- data/lib/prawn/icon.rb +4 -2
- data/prawn-icon.gemspec +12 -10
- data/spec/integration/icon_spec.rb +76 -15
- data/spec/unit/base_spec.rb +25 -6
- data/spec/unit/configuration_spec.rb +21 -0
- data/spec/unit/errors/icon_key_empty_spec.rb +1 -3
- data/spec/unit/errors/icon_not_found_spec.rb +1 -3
- data/spec/unit/font_data_spec.rb +9 -9
- data/spec/unit/icon_spec.rb +15 -15
- data/spec/unit/parser_spec.rb +6 -4
- metadata +31 -25
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright October 2020, Jesse Doyle. All rights reserved.
|
4
|
+
#
|
5
|
+
# This is free software. Please see the LICENSE and COPYING files for details.
|
6
|
+
|
7
|
+
describe Prawn::Icon::Configuration do
|
8
|
+
describe '#font_directory' do
|
9
|
+
before(:each) do
|
10
|
+
subject.font_directory = '/tmp/fakedir'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'returns a Pathname' do
|
14
|
+
expect(subject.font_directory).to be_a(Pathname)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'returns the configured path' do
|
18
|
+
expect(subject.font_directory.to_s).to eq('/tmp/fakedir')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -12,8 +12,6 @@ describe Prawn::Icon::Errors::IconNotFound do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'is thrown on an invalid icon key' do
|
15
|
-
|
16
|
-
|
17
|
-
expect(proc).to raise_error(described_class)
|
15
|
+
expect { pdf.icon('far-an invalid key') }.to raise_error(described_class)
|
18
16
|
end
|
19
17
|
end
|
data/spec/unit/font_data_spec.rb
CHANGED
@@ -72,15 +72,15 @@ describe Prawn::Icon::FontData do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'should error when key is nil' do
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
expect { Prawn::Icon::FontData.specifier_from_key(nil) }.to raise_error(
|
76
|
+
Prawn::Icon::Errors::IconKeyEmpty
|
77
|
+
)
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'should error when key is an empty string' do
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
expect { Prawn::Icon::FontData.specifier_from_key('') }.to raise_error(
|
82
|
+
Prawn::Icon::Errors::IconKeyEmpty
|
83
|
+
)
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'should handle strings without any dashes properly' do
|
@@ -141,9 +141,9 @@ describe Prawn::Icon::FontData do
|
|
141
141
|
end
|
142
142
|
|
143
143
|
it 'should raise an error if unable to match a key' do
|
144
|
-
|
145
|
-
|
146
|
-
|
144
|
+
expect { fontawesome.unicode('an invalid sequence') }.to raise_error(
|
145
|
+
Prawn::Icon::Errors::IconNotFound
|
146
|
+
)
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
data/spec/unit/icon_spec.rb
CHANGED
@@ -19,25 +19,25 @@ describe Prawn::Icon do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should raise an error if icon key is not found' do
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
expect { Prawn::Icon.new('far-__INVALID__', pdf) }.to raise_error(
|
23
|
+
errors::IconNotFound
|
24
|
+
)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
context 'invalid icon specifier' do
|
29
29
|
it 'should raise an error' do
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
expect { pdf.icon('__INVALID__ some text') }.to raise_error(
|
31
|
+
Prawn::Errors::UnknownFont
|
32
|
+
)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
context 'without a pdf object' do
|
37
37
|
it 'should raise an ArgumentError' do
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
expect { Prawn::Icon.new('far-address-book') }.to raise_error(
|
39
|
+
ArgumentError
|
40
|
+
)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -80,9 +80,9 @@ describe Prawn::Icon do
|
|
80
80
|
|
81
81
|
context 'without dashes in key' do
|
82
82
|
it 'raise an error about invalid keys' do
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
expect { Prawn::Icon.new('some invalid key', pdf) }.to raise_error(
|
84
|
+
Prawn::Errors::UnknownFont
|
85
|
+
)
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
@@ -98,9 +98,9 @@ describe Prawn::Icon do
|
|
98
98
|
|
99
99
|
context 'invalid icon key' do
|
100
100
|
it 'should raise IconNotFound' do
|
101
|
-
|
102
|
-
|
103
|
-
|
101
|
+
expect { Prawn::Icon.new('far-__INVALID__', pdf) }.to raise_error(
|
102
|
+
errors::IconNotFound
|
103
|
+
)
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|
data/spec/unit/parser_spec.rb
CHANGED
@@ -38,16 +38,18 @@ describe Prawn::Icon::Parser do
|
|
38
38
|
|
39
39
|
it 'should raise an error when an icon key is invalid' do
|
40
40
|
string = '<icon>an invalid key</icon>'
|
41
|
-
proc = Proc.new { Prawn::Icon::Parser.format(pdf, string) }
|
42
41
|
|
43
|
-
expect(
|
42
|
+
expect { Prawn::Icon::Parser.format(pdf, string) }.to raise_error(
|
43
|
+
Prawn::Errors::UnknownFont
|
44
|
+
)
|
44
45
|
end
|
45
46
|
|
46
47
|
it 'should raise an error when an icon is not found for valid set' do
|
47
48
|
string = '<icon>far-__INVALID__</icon>'
|
48
|
-
proc = Proc.new { Prawn::Icon::Parser.format(pdf, string) }
|
49
49
|
|
50
|
-
expect(
|
50
|
+
expect { Prawn::Icon::Parser.format(pdf, string) }.to raise_error(
|
51
|
+
Prawn::Icon::Errors::IconNotFound
|
52
|
+
)
|
51
53
|
end
|
52
54
|
end
|
53
55
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-icon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Doyle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prawn
|
@@ -45,61 +45,61 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 1.2.1
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: pdf-reader
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: '1.4'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
60
|
+
version: '1.4'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0
|
67
|
+
version: '0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- - "
|
72
|
+
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0
|
74
|
+
version: '0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: rspec
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: 3.5.0
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
88
|
+
version: 3.5.0
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
90
|
+
name: rubocop
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- - "
|
93
|
+
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
95
|
+
version: 1.35.1
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- - "
|
100
|
+
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 1.35.1
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: simplecov
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,10 +114,10 @@ dependencies:
|
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
|
-
description: |
|
118
|
-
|
119
|
-
|
120
|
-
|
117
|
+
description: |
|
118
|
+
Prawn::Icon provides various icon fonts including
|
119
|
+
FontAwesome, PaymentFont and Foundation Icons
|
120
|
+
for use with the Prawn PDF toolkit.
|
121
121
|
email:
|
122
122
|
- jdoyle@ualberta.ca
|
123
123
|
executables: []
|
@@ -146,6 +146,9 @@ files:
|
|
146
146
|
- data/fonts/fi/LICENSE
|
147
147
|
- data/fonts/fi/fi.yml
|
148
148
|
- data/fonts/fi/foundation-icons.ttf
|
149
|
+
- data/fonts/mdi/LICENSE
|
150
|
+
- data/fonts/mdi/materialdesignicons-webfont.ttf
|
151
|
+
- data/fonts/mdi/mdi.yml
|
149
152
|
- data/fonts/pf/LICENSE
|
150
153
|
- data/fonts/pf/paymentfont-webfont.ttf
|
151
154
|
- data/fonts/pf/pf.yml
|
@@ -154,10 +157,12 @@ files:
|
|
154
157
|
- examples/fas-beer.png
|
155
158
|
- examples/fontawesome.rb
|
156
159
|
- examples/foundation_icons.rb
|
160
|
+
- examples/mdi.rb
|
157
161
|
- examples/paymentfont.rb
|
158
162
|
- lib/prawn/icon.rb
|
159
163
|
- lib/prawn/icon/base.rb
|
160
164
|
- lib/prawn/icon/compatibility.rb
|
165
|
+
- lib/prawn/icon/configuration.rb
|
161
166
|
- lib/prawn/icon/errors.rb
|
162
167
|
- lib/prawn/icon/font_data.rb
|
163
168
|
- lib/prawn/icon/interface.rb
|
@@ -170,6 +175,7 @@ files:
|
|
170
175
|
- spec/support/pdf_helper.rb
|
171
176
|
- spec/unit/base_spec.rb
|
172
177
|
- spec/unit/compatibility_spec.rb
|
178
|
+
- spec/unit/configuration_spec.rb
|
173
179
|
- spec/unit/errors/icon_key_empty_spec.rb
|
174
180
|
- spec/unit/errors/icon_not_found_spec.rb
|
175
181
|
- spec/unit/font_data_spec.rb
|
@@ -180,7 +186,8 @@ licenses:
|
|
180
186
|
- RUBY
|
181
187
|
- GPL-2
|
182
188
|
- GPL-3
|
183
|
-
metadata:
|
189
|
+
metadata:
|
190
|
+
rubygems_mfa_required: 'true'
|
184
191
|
post_install_message:
|
185
192
|
rdoc_options: []
|
186
193
|
require_paths:
|
@@ -196,8 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
203
|
- !ruby/object:Gem::Version
|
197
204
|
version: 1.3.6
|
198
205
|
requirements: []
|
199
|
-
|
200
|
-
rubygems_version: 2.7.6.2
|
206
|
+
rubygems_version: 3.3.8
|
201
207
|
signing_key:
|
202
208
|
specification_version: 4
|
203
209
|
summary: Provides icon fonts for PrawnPDF
|